APC UPS Nagios Monitoring

1. Make sure to enable SNMPv1/2 service and configure the community name under APC NM Card.

 

2. Download the nagios plugins from https://exchange.nagios.org/directory/Plugins/Hardware/UPS/APC/Check-APC-UPS/details.

3. Copy the plugin to /usr/lib/nagios/plugins

sudo cp check_apc.pl /usr/lib/nagios/plugins

4. Install dependency.

sudo apt-get install libswitch-perl

5. Create custom nagios commands (under /etc/nagios4/objects/commands.cfg) as below.

define command{
        command_name    check_apc_ups
        command_line    $USER1$/check_apc.pl -H $HOSTADDRESS$ -C public -l $ARG1$
        }

6. Create your ups host and service configuration.

define host{
        use                     generic-switch
        host_name               apc_ups1
        alias                   APC UPS1
        address                 192.168.40.57
        }

define service{
        use                     generic-service
        host_name               apc_ups1
        service_description     Info
        check_command           check_apc_ups!id
        }

define service{
        use                     generic-service
        host_name               apc_ups1
        service_description     Battery Status
        check_command           check_apc_ups!bat_status
        }

define service{
        use                     generic-service
        host_name               apc_ups1
        service_description     Battery Capacity
        check_command           check_apc_ups!bat_capacity -w 80 -c 70
        }

define service{
        use                     generic-service
        host_name               apc_ups1
        service_description     Battery Temp
        check_command           check_apc_ups!bat_temp -w 40 -c 45
        }

define service{
        use                     generic-service
        host_name               apc_ups1
        service_description     Battery Runtime Remaining
        check_command           check_apc_ups!bat_run_remaining -w 60 -c 30
        }
define service{
        use                     generic-service
        host_name               apc_ups1
        service_description     UPS Input Voltage
        check_command           check_apc_ups!in_volt
        }

define service{
        use                     generic-service
        host_name               apc_ups1
        service_description     UPS Input Frequency
        check_command           check_apc_ups!in_freq
        }

define service{
        use                     generic-service
        host_name               apc_ups1
        service_description     UPS State
        check_command           check_apc_ups!out_status
        }

define service{
        use                     generic-service
        host_name               apc_ups1
        service_description     UPS Output Voltage
        check_command           check_apc_ups!out_volt
        }

define service{
        use                     generic-service
        host_name               apc_ups1
        service_description     UPS Output Frequency
        check_command           check_apc_ups!out_freq
        }
define service{
        use                     generic-service
        host_name               apc_ups1
        service_description     UPS Output Load
        check_command           check_apc_ups!out_load -w 70 -c 80
        }

define service{
        use                     generic-service
        host_name               apc_ups1
        service_description     UPS Output Current
        check_command           check_apc_ups!out_current
        }

7. Remember to restart your nagios service.

sudo systemctl restart nagios4

8. Check nagios in action.

Comments