Install Icinga with Docker
Configure the BigPanda agent to send monitoring alerts from Icinga.
The BigPanda agent is a low-footprint utility installed on the master host of your monitoring tool. It consumes alerts from the tool in real-time and then transmits them to BigPanda via TLS-encrypted HTTP calls.
Python Compatibility
To use the Open Integration Manager for Agent-based integrations, Python version>= 3.8.0 and an Agent version >= 10.2 are required.
Prerequisites
Docker Desktop or Docker Engine must be installed prior to installing the BigPanda agent docker image
.
-
Follow the Docker Installation Guide for your system.
-
If using
Docker Compose
, follow the Install Docker Compose guide to ensure the latest version of compose is installed on your system.Docker Compose
is built with the latest version ofDocker Desktop
.- If using
Docker CLI
, ensureDocker CLI's Compose Plugin
is installed separately.
Note: If you have issues running any of the docker commands, you either need to run docker with sudo
, or add your user to run in the docker group as a non-root user.
Environment Variables
The docker image provides the following environment variables, which can be used to initialize the agent with the appropriate plugin.
- BP_TOKEN: Initializes the BigPanda Agent Bearer Token
- SNMP_APP_KEY: Initializes the BigPanda Agent Bearer Token
- HTTP_PROXY: Adds the proxy settings to bigpanda.conf
- FORCE_APP_KEY: Set to
true
to override the existing plugin app key - NAGIOS_APP_KEY: Sets the Nagios App Key and configures the plugin
- NAGIOS_USER: Sets the Nagios Username and is required to set up Nagios plugin
- ZABBIX_APP_KEY: Sets the Zabbix App Key and configures the plugin
- ZENNOSS_APP_KEY: Sets the Zenoss App Key and configures the plugin
- ICINGA_APP_KEY: Sets the Icinga App Key and configures the plugin
Pull the BigPanda docker image
-
Pull the
latest
BigPanda agent docker image from the BigPanda JFrog Docker Registry:docker pull bigpandaio-int-docker.jfrog.io/bigpanda-agent:latest
-
Check that the latest image was downloaded successfully:
docker image ls
Optional:
You can configure a dedicated docker network for the agent. This is useful if you require the agent to communicate with other docker services.
-
Create the docker network:
docker network create <network-name>
-
Check that the network was created:
docker network ls
Configure Icinga
Open the main Icinga configuration file (usually /usr/local/icinga/etc/icinga.cfg
or /etc/icinga/icinga.cfg
):
$ sudo vim /usr/local/icinga/etc/icinga.cfg
- Set
log_rotation_method
tod
(= daily log rotation) - Make sure
log_archive_path
is configured (= location of old logs) - Test that Icinga (usually
nagios
user) has write permissions to thelog_archive_path
folder
Reload the Icinga service for the changes to take effect.
sudo service icinga restart
Configure a docker container to work with Icinga
-
Run the container in detached mode, passing both BP_TOKEN and ICINGA_APP_KEY environment variables to docker run.
docker run -dit \ --name bp_agent \ -e BP_TOKEN=<Your Org Bearer Token> \ -e ICINGA_APP_KEY=<Your App Key> \ -v /var/log/icinga/icinga.log:/var/log/icinga/icinga.log \ -v /var/cache/icinga/status.dat:/var/cache/icinga/status.dat \ -v /var/cache/icinga/objects.cache:/var/cache/icinga/objects.cache \ bigpandaio-int-docker.jfrog.io/bigpanda-agent:latest
Ensure the paths mounted coincide with the locations of
LOGFILE.log
,status.dat
andobjects.cache
files. -
View the logs of the running docker container:
docker container logs -f bp_agent
Optional - Docker Compose
Services can be managed via Docker Compose
, which requires either the Docker Compose Plugin or the latest Docker Desktop installed.
-
Create a file called
docker-compose.yml
:vim docker-compose.yml
-
Add the BigPanda agent service configuration to
docker-compose.yml
:version: '3.9' services: bp_agent: image: bigpandaio-int-docker.jfrog.io/bigpanda-agent:latest container_name: bp_agent restart: always ports: - 5000:5000/udp environment: - BP_TOKEN=<Your Org Bearer Token> - _APP_KEY=<Your App Key> volumes: - /var/log/icinga/icinga.log:/var/log/icinga/incinga.log - /var/cache/icinga/status.dat:/var/cache/icinga/status.dat - /var/cache/icinga/objects.cache:/var/cache/icinga/objects.cache networks: - bigpanda networks: bigpanda: external: true
Note: Ensure the paths mounted coincide with the locations of
LOGFILE.log
,status.dat
andobjects.cache
files.It's important to note that the following commands are based on having Docker Engine 19+ installed, or Docker Desktop installed which has Docker Compose support. If the docker-compose plugin is installed separately, then the command will start with
docker-compose
vsdocker compose
. -
Bring up the agent container:
docker compose up -d
-d
is used to run the container in detached mode. -
View the logs of the running docker container:
docker compose logs -f
-
You can bring down the container with the
down
command:docker compose down
Configure the Icinga plugin
The Icinga plugin requires configuration, which means that we need an interactive session to set it up. The problem when running a docker container in detached mode is the entrypoint script is running the shell session in the background. For this, we can attach to the running session to complete the configuration.
-
Attach to the shell session to continue setting up Icinga
docker attach --detach-keys="ctrl-q" agent
Since
ctrl-c
will send a kill signal to the shell, stopping the container,--detach-keys
passes an alternate key sequence. -
When prompted, specify the locations of
LOGFILE.log
,status.dat
andobjects.cache
files.The script output should look like this:
Log File Path: /var/log/SOURCE_SYSTEM_FOLDER/LOGFILE.log Status Dat Path: /var/cache/SOURCE_SYSTEM_FOLDER/status.dat Objects Cache Path: /var/cache/SOURCE_SYSTEM_FOLDER/objects.cache
Of course, the actual paths will depend on your installation.
Update Permissions
-
Give the agent read permissions to the objects.cache, status.dat and log files. A possible way to do it:
docker exec -it bp_agent usermod -aG "<GROUP OF OBJECT CACHE FILE>,<GROUP OF LOG FILE>,<GROUP OF STATUS DAT FILE>" bigpanda
Test the Integration
-
Run the following command inside the container:
docker exec -it bp_agent /usr/bin/bigpanda-notification --send-test
docker exec
executes a command inside a container.- A test alert should arrive in a few moments.
-
In BigPanda, click the Incidents tab at the top of the screen.
-
Confirm that the test alert was received.
-
Since it's a test alert, it won't be resolved automatically. Click Resolve incident to manually resolve it.
Success
The next time Icinga sends a notification for an alert, you will see the alert in the Incident Dashboard.
Updated about 1 month ago