Install Nagios with Debian or Ubuntu
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
python >= 3.8 and python-pip3 should be installed prior to installing the bigpanda-agent package.
Note: Access to JFrog, pypi, and yum repositories are required to install all dependencies.
Install the BigPanda Agent on Debian or Ubuntu
Connect to the host where your server is installed, and install the BigPanda agent package.
Ensure packages are installed prior to downloading the BigPanda agent package:
$ sudo apt update && sudo apt install -y gnupg2 curl lsb-release
Add the BigPanda repository and download the OpenPGP key:
$ echo deb https://bigpandaio.jfrog.io/artifactory/int-deb `lsb_release -c -s` main | sudo tee /etc/apt/sources.list.d/bigpanda.list $ curl -sL https://bigpandaio.jfrog.io/artifactory/api/security/keypair/bigpanda/public | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/bigpanda.gpg > /dev/null
The
--dearmor
option is for unpacking input from an OpenPGP ASCII armored key.Since
apt-key
is marked to be deprecated on future releases of Debian and Ubuntu, it is preferred to manage keyring files in trusted.gpg.d instead.Note:
apt-key
can still be used in place of OpenPGP, but it is less secure.$ curl -sL https://bigpandaio.jfrog.io/artifactory/api/security/keypair/bigpanda/public | sudo apt-key add -
Update the repo list and install the BigPanda agent package.
$ sudo apt update $ sudo apt install -y bigpanda-agent
Note: For the OIM, bigpanda-agent v10.0.0+ is required.
Troubleshooting:
Error:
E: The method driver /usr/lib/apt/methods/https could not be found. N: Is the package apt-transport-https installed?
Solution:
$ sudo ln -sf /usr/lib/apt/methods/http /usr/lib/apt/methods/https $ sudo apt install -y apt-transport-https $ sudo apt update
Install the bp_listener package
The bp_listener package is hosted in JFrog and can be installed via pip. The listener uses a specific location to work correctly with the BigPanda agent:
Activate the virtual environment
$ source /opt/bigpanda/venv/bin/activate
The agent is installed in a virtual environment, so you must add the bp_listener module into the environment:
$ sudo /opt/bigpanda/venv/bin/pip3 install --extra-index-url https://bigpandaio.jfrog.io/artifactory/api/pypi/int-pypi/simple bp_listener
You can verify the bp_listener package has been installed into the virtual environment’s ``site-packages``:
$ sudo pip3 show bp_listener
Deactivate the virtual environment.
Configure the BigPanda Agent
Generate the agent's configuration file:
$ sudo bigpanda-config --init --token <Your Org Bearer Token> $ sudo bigpanda-config --add nagios -notifications --app-key <Your App Key>
Add the Nagios user to the bigpanda group by running the following command:
sudo usermod -a -G bigpanda <Nagios username>
Start the BigPanda agent service by running the following command:
sudo service bigpanda start
Configure the bp_listener service
Update the configuration file as needed before starting the bigpanda-listener service:
$ sudo vim /etc/bigpanda/listener/bp_listener.json
You have the following configuration options:
bp.queue: The BigPanda queue the agent is configured to use.
bp.logfile: The log file path for bp_listener.
listener.port: The port the listener will listen on.
listener.host: The host ip the listener will bind to.
listener.timeout: The timeout in seconds for the socket to stay open.
listener.source_timezone: The IANA compliant timezone identifier.
listener.timestamp_key: The key in the payload that contains the timestamp.
listener.timestamp_format: The format of the timestamp in the payload.
listener.inbound_queue_size: The socket queue for inbound connections, uses up server resources.
listener.max_threads: The maximum number of threads to use for processing events.
log.level: The log level for bp_listener.
log.verbose: Boolean switch to log verbose output.
log.log_count: The number of log files to keep.
Start the BigPanda Listener service
Start the BigPanda Listener service by running the following command:
$ sudo systemctl start bigpanda-listener
Verify the service is running with the following command:
$ systemctl status bigpanda-listener
Testing the BigPanda Listener Service
The client.py script is used to test the functionality of the server, and is located within the bp_listener python package in the installed python3 site-packages/
directory.
The following command will list the location of the bp_listener package:
$ sudo pip3 show bp_listener
The client.py script contains a default payload that is sent to the bigpanda-listener service. A json file can be used to submit a custom payload in place of the default.
To run the client.py script, use the following command:
$ python3 /path/to/bp_listener/test_client/client.py
Example Use:
usage: client.py [-h] [-s SERVER] [-p PORT] [-f FILE] Client to send test payloads to BP Listener. options: -h, --help show this help message and exit -s SERVER, --server SERVER Server address the listener is configured to listen on (default: 127.0.0.1) -p PORT, --port PORT Port the listener is configured to listen on (default: 4011) -f FILE, --file FILE Optional JSON file to send as payload (default: None) -r RAW, --raw RAW Optional TXT file containing a raw EIF type message (default: None)
Configure Nagios
Configure Nagios to send notifications to BigPanda.
Edit the main configuration file (
nagios.cfg
). The default location is:/usr/local/nagios/etc/nagios.cfg
.Add the following line:
cfg_file=/etc/bigpanda/bigpanda-contact.cfg
Ensure that notifications are enabled
enable_notifications=1
In the file where your host objects are defined (for example,
templates.cfg
):Add the
bigpanda
contact to thecontact_groups
.Set the
notification_options
for the host to:d,r,u,f,s
.
For example:
define host{ name generic-host contact_groups admins,bigpanda notification_period 24x7 notification_options d,r,u,f,s }
If the
contact_groups
option is not already listed in your definitions, you can add it.In the file where your service objects are defined (for example,
templates.cfg
):Add the
bigpanda
contact to thecontact_groups
.Set the
notification_options
for the service to:c,r,w,u,f,s
.
For example:
define service{ name generic-service check_period 24x7 contact_groups admins,bigpanda notification_interval 60 notification_period 24x7 notification_options c,r,w,u,f,s }
If you have already configured notification options on a more specific template or definition, those settings will take precedence over the generic settings.
To get the most out of this integration, ensure all of the desired notifications are sent to BigPanda.
Restart the Nagios service.
sudo service nagios restart
Test the Integration
Run the following command:
/usr/bin/bigpanda-notification --send-test
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
You should be able to see all your active alerts from this integration in the Incidents tab.