Run Opsgenie Edge Connector
On Linux
Following commands start, stop and restart OEC:
Shell
sudo systemctl start oec sudo systemctl stop oec sudo systemctl restart oec Example usage with environment variables:
Shell
sudo systemctl set-environment OEC_CONF_SOURCE_TYPE=git sudo systemctl set-environment OEC_CONF_GIT_URL=git@gitlab.com:metehan2/test-private-conf.git sudo systemctl set-environment OEC_CONF_GIT_PRIVATE_KEY_FILEPATH=~/.ssh/id_rsa sudo systemctl set-environment OEC_CONF_GIT_FILEPATH=~/oec/config.json sudo systemctl start oec or
Shell
sudo systemctl set-environment OEC_CONF_SOURCE_TYPE=local sudo systemctl set-environment OEC_CONF_LOCAL_FILEPATH=~/opsgenie/oec/config.json sudo systemctl start oec
Older RHEL based distributions (6.x.x and older)
Shell
sudo service oec start sudo service oec stop sudo service oec restart # Environment variables can be put in bash configuration files
On Windows
SIGINT and SIGTERM signals are used to stop OEC. It is not possible to stop/restart OEC via native methods of Windows while using OEC as a service. It is provided a helper executable to run OEC as a service.
Environment variables(Env) and arguments(Args) can be set via
oecService<32|64>.jsonlike following:
JSON
{ "Name": "OEC Service", "DisplayName": "OEC Service", "Description": "Run the OEC Service", "OECPath" : "C:\\Users\\Administrator\\Desktop\\OpsgenieEdgeConnector<32|64>.exe", "Args" : ["-oec-metrics", "7070"], "Env": [ "OEC_CONF_LOCAL_FILEPATH=C:\\Users\\Administrator\\Desktop\\config.json", "OEC_CONF_SOURCE_TYPE=local" ], "Stderr": "C:\\Users\\Administrator\\Desktop\\oecErr.log", "Stdout": "C:\\Users\\Administrator\\Desktop\\oecOut.log" } Following commands start, stop and restart OEC amd64 version:
Shell
oecService64.exe start oecService64.exe stop oecService64.exe restart Following commands start, stop and restart OEC 386 version:
Shell
oecService32.exe start oecService32.exe stop oecService32.exe restart
Running OEC With Docker
Clone the repository with
git clone https://github.com/opsgenie/OEC.gitRun
docker build . -t oecSince OEC uses configuration files to run, you need to provide volumes to Docker container so that the files are accessible from the container. You also need to provide environment variables explained above to the container. Here is an example command to run docker container:
Shell
docker run -ti \ -v /Users/foo/Documents/bar:/home/opsgenie \ -e OEC_CONF_SOURCE_TYPE="local" \ -e OEC_CONF_LOCAL_FILEPATH="/home/opsgenie/OEC.yaml" \ OEC Above command runs the container with two environment variables and creates a volume between “bar” folder in host machine and “opsgenie” folder in the container.
Since you are using docker container to run OEC, you need to give the file paths according to the container not to host machine.
If you want to use the configuration from your repository, you need to add your ssh_known_hosts file to image by using a volume. You may also need to set SSH_KNOWN_HOSTS environment variable to your ssh_know_hosts file path in the image. Below is an example command to run OEC with using configuration file from a repository. The command also creates additional volume to access the log files from the host machine.
Shell
docker run -ti \ -v /Users/erenkizilay/Documents/dummyDir:/home/opsgenie \ -v /Users/erenkizilay/Documents/dummyDir:/var/log/opsgenie \ -v /Users/erenkizilay/.ssh/known_hosts:/etc/ssh/ssh_known_hosts \ -e OEC_CONF_SOURCE_TYPE="git" -e OEC_CONF_GIT_FILEPATH=/config.json \ -e OEC_CONF_GIT_PRIVATE_KEY_FILEPATH=/var/log/opsgenie/id_rsa \ -e OEC_CONF_GIT_URL=git@gitlab.com:erenkizilay/OEC-conf.git \ -e SSH_KNOWN_HOSTS=/etc/ssh/ssh_known_hosts \ OEC Was this helpful?