Resources to create a Docker image of the Nagios NRPE used for monitoring the Labs workbench infrastructure.
To build:
- Docker
To run:
- A remote machine's credentials: username / ssh key / hostname
- Kubernetes
The usual docker build command:
docker build -t ndslabs/nagios-nrpe:latest .Modify nagios-nrpe.yaml to adjust image to point to your own, and then run:
kubectl create -f nagios-nrpe.yamlNOTE: This will start a DaemonSet for the NRPE container, which will run a copy on each node in the cluster.
docker run --privileged -v /:/mnt/ROOT --rm --name nrpe -p 5666:5666 ndslabs/nagios-nrpeThen, you'll need to SSH into your NAGIOS instance and add this cluster to the list of "servers":
sudo su -
cd /usr/local/nagios/etc/servers
cp cwtest.cfg yourcluster.cfg
# Modify yourcluster.cfg to your liking
cat /home/nagios/.ssh/id_rsa.pubOnce NRPE is running and you've retrieved the public key for the nagios user, you will need to create a nagios user on your local node and add the SSH key from your NAGIOS monitor to ~/.ssh/authorized_keys:
sudo useradd -m -d /home/nagios nagios
sudo passwd nagios (value doesn't matter)
sudo vi /home/nagios/.ssh/authorized_keys
# paste value from nagios id_rsa.pub
chmod 600 /home/nagios/.ssh/authorized_keysNOTE: Make sure /home/nagios and home/nagios/.ssh are owned by nagios:nagios with correct permissions
- From the NAGIOS server, confirm that you can SSH from the monitor to the target node without using a password:
sudo su - nagios
ssh nagios@yourserver
# Should SSH without password from nagios user to nagios user- Open browser to http://NAGIOS_MONITOR_HOSTNAME/nagios
- Find your server. Service status should be pending. Wait until OK.