Golive Monitor
Learn why we have built Golive Monitor and how it will help you to keep your Golive environment inventory always up to date.
Why should you use Golive Monitor?
Monitoring and Observability is a vast area covered by lots of very powerful and well known tools like Dynatrace, New Relic, Datadog,… For economical reasons, these tools can rarely be used to monitor all your testing environments. Even if your company has the money, all environments do not require the same level of observation and using such tools to monitor everything may be overkill.
On its side, Golive is aimed to manage ALL your applications and IT environments.
Golive Monitor was born because we wanted to provide a free basic and easy to use monitoring solution for the users of Golive. Golive Monitor is basically an HTTP URL checker. It can scan all the URLs defined in your Golive environments and automatically set the status of your environments to “Up” or “Down” accordingly to the response received.
When the call of an URL, stored in Golive, is not returning a valid response, it either means that the:
Environment URL is not valid anymore and that it should be updated (common situation when testing environments have been moved)
Environment is effectively down or that it does not work properly
Golive Monitor is a basic and open source “Synthetic Monitor” that can be deployed within your private network. It is able to check hundreds of environment urls in a breeze. It can make you save a tremendous quantity of energy to keep your Golive environment inventory always up to date.
Learn more about why it is so important to track statuses of your environments here: Status Tracking
What is it?
Golive Monitor is an open source tool provided by Apwide to simply monitor your web servers and update their corresponding Golive environment statuses.
Sources are available on Github.
It is available in 2 forms:
as a bash script
as a docker image
It performs the following operations:
tests the availability of each environment using
url
or using the environment value associated with an attribute name provided (seeURL_TO_CHECK
configuration variable)perform status-change of each environment that has changed status (use
DRY_RUN=true
to avoid)
Configuration
Both versions rely on environment variables to read its configuration.
Variable name | Default value | Description |
---|---|---|
JIRA_USERNAME | Only for Golive Server/DC | |
JIRA_PASSWORD | Only for Golive Server/DC | |
BASE_URL | Only for Golive Server/DC | |
|
|
Variable name | Default value | Description |
---|---|---|
STATUS_UP | “Up” | status value in golive for an environment to be seen as UP |
STATUS_DOWN | “Down” | status value in golive for an environment to be seen as DOWN |
GOLIVE_QUERY | (optional) -- query string to filter the environment search | |
URL_TO_CHECK | (optional) -- environment attribute value to look for a test url, if not provided the environment url is used | |
IGNORED_STATUSES | (optional) -- comma separated list of status. If the environment has this status, it will not be checked | |
DRY_RUN | (optional) -- set to `true` to not update the status after the test | |
PERIOD | 1 | only docker version amount of minutes between to run when using the docker image as cron, cannot be smaller than one |
Notes on the following examples
Secrets should not be written in file.
Make sure to use the available solutions in your environment to protect the PASSWORD
or the API_KEY
.
Examples using Jira Server or Data Center
Filtering on category `Dev` and application `Payment`.
USERNAME=service_123123
PASSWORD=abc123
BASE_URL=https://jira.example.com/rest/apwide/tem/1.1
GOLIVE_QUERY=categoryName=Dev&application=Payment
Same but ignoring environments that has status set to None or Maintenance
USERNAME=service_123123
PASSWORD=abc123
BASE_URL=https://jira.example.com/rest/apwide/tem/1.1
GOLIVE_QUERY=categoryName=Dev&application=Payment
IGNORED_STATUSES=Maintenance,None
Same but using an environment attribute named `heartbeat` to check instead of the url
USERNAME=service_123123
PASSWORD=abc123
BASE_URL=https://jira.example.com/rest/apwide/tem/1.1
GOLIVE_QUERY=categoryName=Dev&application=Payment
IGNORED_STATUSES=Maintenance,None
URL_TO_CHECK=heartbeat
Same but disallow the script to update the statuses (useful to test the setup)
USERNAME=service_123123
PASSWORD=abc123
BASE_URL=https://jira.example.com/rest/apwide/tem/1.1
GOLIVE_QUERY=categoryName=Dev&application=Payment
IGNORED_STATUSES=Maintenance,None
URL_TO_CHECK=heartbeat
DRY_RUN=true
Usage
Bash Script
Define your environment variables in a file (e.g. .env
) and run the following command:
export $(cat .env | grep -v "^#" | xargs) && ./golive-monitor.sh
This runs once and exists.
cron
can be used to run this script periodically or use the docker version described below
Docker
To run it from the terminal, define your environment variables in a file (e.g. .env
) and run the following command:
$ docker run -ti --env-file=.env apwide/golive-monitor
Based on the value of PERIOD
, the docker will be different
if
PERIOD=1
, the script runs once and exitsif bigger than 1 (
n
) , the script will run ever everyn
minutes (it will not start if it is still running)