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
by using git
Set the JEC_CONF_SOURCE_TYPE
and JEC_CONF_LOCAL_FILEPATH
variables.
For Redhat 6/Centos 6
Edit the /etc/init.d/jec file
Add the following export commands just before the "start()" function:
export JEC_CONF_SOURCE_TYPE="local"
export JEC_CONF_LOCAL_FILEPATH="/home/jsm/jec/config.json"
start().......
For Redhat 7 / Centos 7 and Debian / Ubuntu
Edit the /etc/systemd/system/jec.service file.
In the [Service] key section, add the following environment properties just before the start of the [install] key:
...
[Service]
...
...
Environment="JEC_CONF_SOURCE_TYPE=local"
Environment="JEC_CONF_LOCAL_FILEPATH=~/jec/config.json"
...
[Install]
For Windows Sytems
Edit the jecService<32 | 64>.json file (present in the downloaded zip file).
The JSON contains a key called "Env" which takes an array as its value. List the "JEC_CONF_LOCAL_FILEPATH" and "JEC_CONF_SOURCE_TYPE" with their values within the "Env" key’s array.
JSON
...
...
"Env": [
"JEC_CONF_LOCAL_FILEPATH=C:\\jsm\\jec-win64\\config.json",
"JEC_CONF_SOURCE_TYPE=local"
],
...
...
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 don’t need to set a 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.
Configuration variables
Key | Value Properties | Example |
---|
JEC_CONF_SOURCE_TYPE | git, for reading from git local, for reading from a local environment | JEC_CONF_SOURCE_TYPE=git JEC_CONF_SOURCE_TYPE=local |
JEC_CONF_LOCAL_FILEPATH | filepath with extension (.yaml, .yml or .json) Default: ~/jec/config.json | JEC_CONF_LOCAL_FILEPATH=/home/JSM/JECConfig.yaml JEC_CONF_LOCAL_FILEPATH=~/JECConfig.json |
JEC_CONF_GIT_URL | HTTPS or SSH url of the git repository | JEC_CONF_GIT_URL=git@bitbucket.com:username/test-private-conf-cem.git or JEC_CONF_GIT_URL=https://bitbucket.org/username/test-conf-cem.git |
JEC_CONF_GIT_FILEPATH | Filepath in the git repository folder (.yaml, .yml or .json) | JEC_CONF_GIT_FILEPATH=~/jec/config.json |
JEC_CONF_GIT_PRIVATE_KEY_FILEPATH | Location of git ssh key in the local drive | JEC_CONF_GIT_PRIVATE_KEY_FILEPATH=~/.ssh/id_rsa |
JEC_CONF_GIT_PASSPHRASE | ssh passphrase | JEC_CONF_GIT_PASSPHRASE=1234 |
JEC_LOG_FORMAT_TYPE | text → logrus text type logs json → logrus json type logs colored → colored logrus type logs (default) | JEC_LOG_FORMAT_TYPE=text |
JEC_API_KEY | API key from the JEC integration page, if this property is set, it overrides apiKey provided in the configuration file. | JEC_API_KEY=4XXXXXX7-XXXX-XXXX-XXXX-9XXXXXXXXXX4 |
You can gather Prometheus default metrics 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 for JEC are located at the following:
At the end of the file name, there is a program identifier (pid) that indicates which process is running.
JEC supports json and yaml file extensions with fields. Set the configuration file path in JEC_CONF_LOCAL_FILEPATH
or JEC_CONF_GIT_FILEPATH
based on whether it is local or git.
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. |
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 |
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. |
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. |
poolConf → keepAliveTimeInMillis | integer | false | Alive time limit for any worker that is idle when actual worker count is higher than minNumberOfWorker |
poolConf → monitoringPeriodInMillis | integer | false | Monitoring interval to record pool metrics |
The local variable of args, flags, and env overrides the global variables.
apiKey, jsmUrl (baseUrl), and payload (JEC callback as JSON) pass to args as flag format. These flags should be parsed in action scripts or executables.
The payload consists of alert information and integration-specific parameters. Integration-specific parameters exist for “Send via JEC” option.
JEC updates the git repositories 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).
Sample JSON file
{
"appName": "JEC-Example",
"apiKey" : "4w3a0df7-d5c8-40d7-96db-975986bx3cb4",
"baseUrl" : "https://api.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
}
}
Sample YAML file
---
appName: JEC-Example
apiKey: 4w3a0df7-d5c8-40d7-96db-975986bx3cb4
baseUrl: https://api.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
Add Comment