Installing Nagios on Debian Jessie and SNMP (UPS) monitoring

sudo apt-get update;apt-get install nagios3 nagios-plugins nagios-nrpe-plugin apache2 snmp

You will be prompted to set a nagios password during installation. And can now navigate to http://localhost/nagios3/ to access nagios. The admin username is nagiosadmin, and the password is that which you set during installation.

The following is based on the example here. It’s probably better to refer to that for full APC UPS monitoring instructions. I’m going to be looking at monitoring the Arduino I previously setup.

Add the following to /etc/nagios3/:

cfg_file=/etc/nagios3/objects/ups.cfg

Then create the file /etc/nagios3/objects/ups.cfg, with the following contents (you will also need to create the objects directory):

###############################################################################
# HOST DEFINITIONS
###############################################################################
# Define the UPS that we'll be monitoring
define host{
	use				generic-host
	host_name			ArduinoVoltMon
	alias				Arduino Voltage Monitor
	notification_period		24x7
	check_period			24x7
#	contacts			nagiosadmin
	address				192.168.2.64
	}

###############################################################################
# HOST GROUP DEFINITIONS
###############################################################################
define hostgroup{
	hostgroup_name			ups
	alias				ups
	members				ArduinoVoltMon
	}

###############################################################################
# SERVICE DEFINITIONS
###############################################################################
# Ping UPS
define service{
	use				generic-service
	host_name			ArduinoVoltMon
	check_period		24x7
	notification_interval 10
	service_description           	PING
	check_command			check_ping!100.0,20%!500.0,60%
	}

define service{
	use				generic-service
	host_name			ArduinoVoltMon
	service_description           	UPS Capacity
	check_command			snmp_ups_capacity! -H $HOSTADDRESS$ -C public
	}

Then add the following to the end of /etc/nagios3/commands.cfg:

# 'snmp_ups_capacity' command definition
define command{
        command_name    snmp_ups_capacity
        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o .1.3.6.1.4.1.318.1.1.1.2.2.1.0 -l '\Battery Charge\' -u '\%\' 
        }

If you click on Services in Nagios you should now see the following:

ardvolt

I might try this with cacti next. Which in my previous experience seems a lot better than Nagios.