Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
minLevel1
maxLevel3
outlinefalse
typelist
printablefalse

Environment variables

Prerequisites
For setting Set the configuration file properties such as location and path:

...

. But first, you

...

need to set some environment variables for the

...

local configuration file.

...

You can get the configuration file:

  • from a local drive or

  • by using git.

...

Reading configuration files from a local drive

...

...

Set the JEC_CONF_SOURCE_TYPE and 

...

JEC_CONF_LOCAL_FILEPATH variables.

Expand
titleFor Redhat 6/Centos 6

...

  1. Edit the /etc/init.d/

...

  1. jec file

  2. Add the following export commands just before the "start()" function:

/etc/init.d/oec

Code Block
export 
OEC
JEC_CONF_SOURCE_TYPE="local"
export 
OEC
JEC_CONF_LOCAL_FILEPATH="/home/jsm/jec/config.json"

start().......

Expand
titleFor Redhat 7 / Centos 7 and Debian / Ubuntu

...

  1. Edit the /etc/systemd/system/

...

  1. jec.service file

...

  1. .

  2. In the [Service] key section, add the following

...

  1. environment properties just before the start of the [install] key:

/etc/systemd/system/oec.service

Code Block
...
[Service]
...
...
Environment="
OEC
JEC_CONF_SOURCE_TYPE=local"
Environment="
OEC
JEC_CONF_LOCAL_FILEPATH=~/
oec
jec/config.json"
...
[Install]

Expand
titleFor Windows Sytems

...

  1. Edit the

...

  1. jecService<32 | 64>.json file

...

  1. (present in the downloaded zip file

...

  1. ).

  2. The JSON contains a key called "Env"

...

  1. which takes an array as its value

...

  1. . List the "

...

  1. JEC_CONF_LOCAL_FILEPATH" and "

...

  1. JEC_CONF_SOURCE_TYPE" with their values within the "Env"

...

  1. key’s array.

JSON

Code Block
...
...
"Env": [
        "
OEC
JEC_CONF_LOCAL_FILEPATH=C:\\
opsgenie
jsm\\
oec
jec-win64\\config.json",
        "
OEC
JEC_CONF_SOURCE_TYPE=local"
    ],
...
...

...

Reading configuration files from a git repository

...

...

Set the JEC_CONF_GIT_URL

...

JEC_CONF_GIT_FILEPATH

...

JEC_CONF_GIT_PRIVATE_KEY_FILEPATH, and 

...

JEC_CONF_GIT_PASSPHRASE variables.

...

If you are using a public repository, you should use an https format of a git url and you do not need to set private key and passphrase.

...

You can optionally set 

...

JEC_API_KEY

...

; if this property is set in the environment, its value

...

is used as apiKey

...

or else apiKey from the configuration file

...

is used.

Key

Value Properties

Example

OECJEC_CONF_SOURCE_TYPE

git → For getting , for reading from git

local → For getting from , for reading from a local environment

OECJEC_CONF_SOURCE_TYPE=git
or
OEC

JEC_CONF_SOURCE_TYPE=local

OECJEC_CONF_LOCAL_FILEPATH

filepath with extension (.yaml, .yml or .json)
Default: ~/oecjec/config.json

OECJEC_CONF_LOCAL_FILEPATH=/home/JSM/OECConfigJECConfig.yamlor
OEC


JEC_CONF_LOCAL_FILEPATH=~/OECConfigJECConfig.json

OECJEC_CONF_GIT_URL

HTTPS or SSH url of the git repository

OECJEC_CONF_GIT_URL=git@bitbucket.com:metehan/test-private-conf-cem.git
or
OECJEC_CONF_GIT_URL=https://bitbucket.org/metehan_ozturk/test-conf-cem.git

OECJEC_CONF_GIT_FILEPATH

filepath Filepath in the git repository folder (.yaml, .yml or .json)

OECJEC_CONF_GIT_FILEPATH=~/oecjec/config.json

OECJEC_CONF_GIT_PRIVATE_KEY_FILEPATH

Location of git ssh key location in the local drive

OECJEC_CONF_GIT_PRIVATE_KEY_FILEPATH=~/.ssh/id_rsa

OECJEC_CONF_GIT_PASSPHRASE

ssh passphrase

OECJEC_CONF_GIT_PASSPHRASE=1234

OECJEC_LOG_FORMAT_TYPE

text → logrus text type logs
json → logrus json type logs
colored → colored logrus type logs (default)

OECJEC_LOG_FORMAT_TYPE=text

OECJEC_API_KEY

API key from Opsgenie’s OEC Integration the JEC integration page, if this property is set, it will override overrides apiKey provided in the configuration file.

OECJEC_API_KEY=4XXXXXX7-XXXX-XXXX-XXXX-9XXXXXXXXXX4

Info

Use the ‘~’ character can be used as home directory for running the program as a user in a customer’s server.

Flag

You can gather Prometheus default metrics can be grabbed from from http://localhost:<port-number>/metrics. To run multiple JEC instances in the same environment,

...

set the -

...

jec-metrics

...

 as distinct port number values

...

: -

...

jec-metrics <port-number>

...

 

Logs

Logs for JEC log file is locatedare located at the following:

  • On Windows: var/log/opsgeniejsm/oec<pid>jec<pid>.logOn

  • Linux: /var/log/opsgeniejsm/oec<pid>jec<pid>.log

At the end of the file name

...

, there is a program identifier (pid)

...

that indicates which process is running. 

 Configuration file

Configuration File

JEC supports json and yaml file extension extensions with fields. Configuration filepath should be set on OECSet the configuration file path in JEC_CONF_LOCAL_FILEPATH

 or 

OEC or JEC_CONF_GIT_FILEPATHaccording to based on whether it is local or git choice.

Expand

...

title

...

Configuration fields

Field

Type

Mandatory

Description

apiKey

string

true

The API key which is copied from the JEC Integration page.

baseUrl

string

false

The API url of the Jira Service Management mirror

...

. Default: 'https://api.

...

jsm.com'

logLevel

string

false

Log level of the JEC
Default: ‘info'
Options: ‘info’, ‘debug’, 'trace’, ‘error’, ‘warn’

globalArgs

list of string

false

Execute arguments that applies to all actions

globalFlags

map of string key-value

false

Execute flags that applies to all actions
Map field consists flag keys and values.
Given flags might enforce to be parsed in action script or executable.

globalEnv

list of string

false

Each element indicates one environment variable name and value separated with ‘=’ character. Applies to all actions. (e.g., “ENV1=value”)

actionMappings

map of string key and mappedAction value

true

Map of the alert action mappings
Each mapping has an action name(string) as a key which is defined in Jira Service Management (e.g., Create).
At least one action should be existed.

...

actionMappings → mappedAction

map

true

Each mappedAction represents an action and includes an action properties sourceType, filepath, gitOptions and environmentVariables.

...

actionMappings → mappedAction → sourceType

string

true

Type of script file location can be ‘local' or 'git’

...

actionMappings → mappedAction → filepath

string

true

Location of script or executable file

...

. If “local”, full path should be provided (‘~’ can be used). If “git”, the path of the directory should be provided.

...

actionMappings → mappedAction → stdout

string

false

stdout filepath of action

...

actionMappings → mappedAction → stderr

string

false

stderr filepath of action

...

actionMappings → mappedAction → args

list of string

false

Execute arguments that applies to specified action

...

actionMappings → mappedAction → flags

map of string key-value

false

Execute flags that applies to specified action
Map field consists flag keys and values.
Given flags might enforce to be parsed in action script or executable.

...

actionMappings → mappedAction → env

list of strings

false

Each element indicates one environment variable name and value separated with ‘=’ character. Applies to specified action. (e.g., “ENV1=value”)

...

actionMappings → mappedAction → gitOptions

map

true for git source

This field includes all three string properties,
which are
url (git repository url),
privateKeyFilePath (ssh key file),
passphrase (if any).
Properties are same git variables at which Environment Variables section.

  • If soruceType is “git”, gitOptions should be set.

...

actionMappings → mappedAction → gitOptions → url

string

true for git source

HTTPS or SSH url of the git repository of the mappedAction

...

actionMappings → mappedAction → gitOptions → privateKeyFilepath

string

false

Private key filepath of the git repository of the mappedAction (if needed)

...

actionMappings → mappedAction → gitOptions → passphrase

string

false

Passphrase of the git repository of the mappedAction (if needed)

pollerConf

map

false

The field gets all three integer properties specifying behavior of the poller that poll the sqs queue of

...

JEC.

...

pollerConf → pollingWaitIntervalInMillis

integer

false

The wait period of the poller when there is no new message in the queue or free job worker
Default: 100 (milliseconds)
Small values of this field (e.g., <100ms.) might cause high cpu usage.

...

pollerConf → visibilityTimeoutInSeconds

integer

false

The visibility timeout of messages that are polled from sqs queue

  • Default: 30 (seconds)

...

pollerConf → maxNumberOfMessages

integer

false

Maximum number of messages that are received at a time
Default: 10
Limited by 10 at most.

poolConf

map

false

The field gets all five integer properties specifying
behaviour of the worker pool that manages workers (go routines)

...

poolConf → maxNumberOfWorker

integer

false

Maximum number of worker processing action
Default: 12
Cpu bound processes may not need higher values of maxNumberOfWorker.

  • Higher values of maxNumberOfWorker may be meaningful for I/O bound processes.

...

poolConf → minNumberOfWorker

integer

false

Minimum number of worker processing action
Default: 4
When there is not much active process, minNumberOfWorker determines the lower limit of idle worker number.

...

poolConf → queueSize

integer

false

Internal queue size of messages that are received from sqs queue
Default: 0
When all workers are busy, messages can be stored in internal queue.

  • Enabling queue size is not recommended and may cause data loss if any program crash.

...

poolConf → keepAliveTimeInMillis

integer

false

Alive time limit for any worker that is idle when actual worker count is higher than minNumberOfWorker

  • Default: 6000 (milliseconds)

...

poolConf → monitoringPeriodInMillis

integer

false

Monitoring interval to record pool metrics

  • Default: 15000 (milliseconds)

 

...

The local variable of args, flags, and env overrides the global

...

variables.

  • apiKey, opsgenieUrl  jsmUrl (baseUrl) and payload , and payload (JEC callback as JSON) passes pass to args as flag format. These flags should be parsed in action scripts or executables.

  • Payload The payload consists of alert info information and integration-specific paramsparameters. Integration-specific params will parameters exist for “send “Send via JEC” option.

  • JEC updates the git repositories periodically every 1 minute.

...

  • every 1 minute.

JEC integration uses direct actions (for example, Create, Close, Acknowledge, etc). Other integrations primarily use mapped actions related to themselves (for example, addCommentToIssue, createIssue, etc. for Jira integration).

...

Example of JSON File

Expand
titleSample JSON file
Code Block
{
    "appName": "
OEC
JEC-Example",
    "apiKey" : "4w3a0df7-d5c8-40d7-96db-975986bx3cb4",
    "baseUrl" : "https://api.
opsgenie
jsm.com",
    "logLevel" : "debug",
    "globalArgs" : ["globalArg"],
    "_globalFlags" : {
        "comment out" : "remove '_' sign to enable globalFlags",
        "flagKey" : "flagValue"
    },
    "globalEnv" : ["globalEnv1=value"],
    "actionMappings" : {
        "Create" : {
            "sourceType" : "local",
            "filepath" : "~/Desktop/executable",
            "args" : ["arg"],
            "_flags": {
                "comment out" : "remove '_' sign to enable flags",
                "flagKey" : "flagValue"
            },
            "env" : ["env1=value"],
            "stdout" : "~/Desktop/createOut.txt",
            "stderr" : "~/Desktop/createErr.txt"
        },
        "Acknowledge" : {
            "sourceType" : "git",
            "filepath" : "/executable",
            "gitOptions" : {
                "url" : "https://bitbucket.org/example/example.git"
            },
            "stdout" : "~/Desktop/ackOut.txt",
            "stderr" : "~/Desktop/ackErr.txt"
        },
        "Custom" : {
            "sourceType" : "git",
            "filepath" : "/executable",
            "gitOptions" : {
                "url" : "git@gitlab.com:example/example.git",
                "privateKeyFilepath" : "~/.ssh/id_rsa",
                "passphrase" : "pass"
            }
        }
    },
    "pollerConf" : {
        "pollingWaitIntervalInMillis" : 100,
        "visibilityTimeoutInSeconds" : 30,
        "maxNumberOfMessages" : 10
    },
    "poolConf" : {
        "maxNumberOfWorker": 12,
        "minNumberOfWorker": 4,
        "queueSize" : 0,
        "keepAliveTimeInMillis" : 6000,
        "monitoringPeriodInMillis" : 15000
    }
}

...

Expand
titleSample YAML file
Code Block
---
appName: 
OEC
JEC-Example
apiKey: 4w3a0df7-d5c8-40d7-96db-975986bx3cb4
baseUrl: https://api.
opsgenie
jsm.com
logLevel: debug
globalArgs:
- globalArg
_globalFlags:
  comment out: remove '_' sign to enable globalFlags
  flagKey: flagValue
globalEnv:
- globalEnv1=value
actionMappings:
  Create:
    sourceType: local
    filepath: "~/Desktop/executable"
    args:
    - arg
    _flags:
      comment out: remove '_' sign to enable flags
      flagKey: flagValue
    env:
    - env1=value
    stdout: "~/Desktop/createOut.txt"
    stderr: "~/Desktop/createErr.txt"
  Acknowledge:
    sourceType: git
    filepath: "/executable"
    gitOptions:
      url: https://bitbucket.org/example/example.git
    stdout: "~/Desktop/ackOut.txt"
    stderr: "~/Desktop/ackErr.txt"
  Custom:
    sourceType: git
    filepath: "/executable"
    gitOptions:
      url: git@gitlab.com:example/example.git
      privateKeyFilepath: "~/.ssh/id_rsa"
      passphrase: pass
pollerConf:
  pollingWaitIntervalInMillis: 100
  visibilityTimeoutInSeconds: 30
  maxNumberOfMessages: 10
poolConf:
  maxNumberOfWorker: 12
  minNumberOfWorker: 4
  queueSize: 0
  keepAliveTimeInMillis: 6000
  monitoringPeriodInMillis: 15000