Feeds:
Articole
Comentarii

Blog moved to my site!

Hi there! The new address of this blog is: http://mihai.radoveanu.ro/

For the moment I will let my posts here but after a few days I will delete them (don’t worry you can find them already here: http://mihai.radoveanu.ro/)

Thanks,
Mihai out.

Hi there! The new address of this blog is: http://mihai.radoveanu.ro/
The address of this article (there is a new version) is http://mihai.radoveanu.ro/2010/02/tutorial-to-monitor-aros-apc-ups-s-via-snmp-with-nagios/

Before you start this tutorial please make sure that your network responds to the same OID as here and that you have configured all the UPS-s to work with the snmp (note down your snmp community string). In my tests I used the standard powernet395.mib from APC and the rfc1628.mib for AROS.

First make sure that you activated the check_snmp command in the file commands.cfg. If you don’t, add it as follows:

# ‘check_snmp’ command definition

define command{

command_name check_snmp

command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$

}

So we will use this command with the following switches

check_snmp -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] [-C community] [-s string] [-u units]

Add the corresponding templates (this is good if you want a service allocation by type or model) on the templates.cfg. Here is the example:

# Define a template for the UPS’s that we can reuse

define host{

name generic-ups

use generic-host

check_period 24×7

check_interval 5

retry_interval 1

max_check_attempts 10

check_command check-host-alive

notification_period 24×7

notification_interval 30

contact_groups admins

register 0 ; DONT REGISTER THIS – ITS JUST A TEMPLATE

}

# Define a template for the AROS UPS’s that we can reuse

define host{

name generic-aros

use generic-ups

hostgroups 007-ups-all,007-ups-all-aros

contact_groups admins

icon_image aros.png

icon_image_alt UPS_AROS

register 0 ; DONT REGISTER THIS – ITS JUST A TEMPLATE

}

# Define a template for the APC UPS’s that we can reuse

define host{

name generic-apc

use generic-ups

hostgroups 007-ups-all,007-ups-all-apc

contact_groups admins

icon_image apc.png

icon_image_alt UPS_APC

register 0 ; DONT REGISTER THIS – ITS JUST A TEMPLATE

}

Create the new corresponding groups:

define hostgroup{

hostgroup_name 007-ups-all

alias UPS (all)

}

define hostgroup{

hostgroup_name 007-ups-all-aros

alias UPS (all AROS)

}

define hostgroup{

hostgroup_name 007-ups-all-apc

alias UPS (all apc)

}

Create a new configuration file (I named it ups.cfg) and add the entry to the Nagios main configuration file:

#Definitions for monitoring the UPS Devices

cfg_file=/usr/local/nagios/etc/objects/ups.cfg

Now we can start work on the configuration file. First we declare the hosts:

define host{

use generic-apc

host_name IT-UPS-APC

alias this is a standard apc ups

address 192.168.3.60 ; IP address of the device

}

define host{

use generic-aros

host_name IT-UPS-AROS

alias this is a standard aros ups

address 192.168.3.61 ; IP address of the device

}

Then we declare the services (first the generic services):

define service{

use generic-service ;

hostgroup_name 007-ups-all

service_description PING

check_command check_ping!200.0,20%!600.0,60%

normal_check_interval 5

retry_check_interval 1

}

# Monitor uptime via SNMP

define service{

use generic-service ;

hostgroup_name 007-ups-all

service_description Uptime

check_command check_snmp!-C Default_snmp_string -o sysUpTime.0

}

After we can make the UPS checks by device type:

#######################################################################################################################

##

## APC UPS Checks

##

#######################################################################################################################

define service{

use generic-service ;

hostgroup_name 007-ups-all-apc

service_description APC Battery temperature

check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.2.2.2.0 -C Default_snmp_string -w 35 -c 45 -u C

}

define service{

use generic-service ;

# host_name IT-MILUPS-CEDA, IT-MILUPS-CEDB

hostgroup_name 007-ups-all-apc

service_description APC Battery run time remaining

check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.2.2.3.0 -C Default_snmp_string

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-apc

service_description APC Battery needs replacement

check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.2.2.4.0 -C Default_snmp_string -c 2

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-apc

service_description APC Line-in voltage

check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.3.2.1.0 -C Default_snmp_string -w 280 -c 300 -u VAC

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-apc

service_description APC UPS load

check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.4.2.3.0 -C Default_snmp_string -w 70 -c 90 -u %

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-apc

service_description APC output current

check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.4.2.4.0 -C Default_snmp_string -w 40 -c 50 -u A

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-apc

service_description APC output voltage

check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.4.2.1.0 -C Default_snmp_string -w 230 -c 245 -u VAC

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-apc

service_description APC status

check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.4.1.1.0 -C Default_snmp_string -c 3

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-apc

service_description APC UPS Model

check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.1.1.1.0 -C Default_snmp_string

}

#######################################################################################################################

##

## AROS UPS Checks

##

#######################################################################################################################

define service{

use generic-service ;

hostgroup_name 007-ups-all-aros

service_description AROS Battery temperature

check_command check_snmp!-o 1.3.6.1.2.1.33.1.2.7.0 -C Default_snmp_string -w 35 -c 45 -u C

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-aros

service_description AROS Battery run-time remaining

check_command check_snmp!-o 1.3.6.1.2.1.33.1.2.3.0 -C Default_snmp_string -u min

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-aros

service_description AROS Battery charge level

check_command check_snmp!-o 1.3.6.1.2.1.33.1.2.4.0 -C Default_snmp_string -u %

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-aros

service_description AROS number of alarms

check_command check_snmp!-o 1.3.6.1.2.1.33.1.6.1.0 -C Default_snmp_string -w 1 -c 2

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-aros

service_description AROS software version

check_command check_snmp!-o 1.3.6.1.2.1.33.1.1.3.0 -C Default_snmp_string

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-aros

service_description AROS output load

check_command check_snmp!-o .1.3.6.1.2.1.33.1.4.4.1.5 -C Default_snmp_string -w 70 -c 90 -u %

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-aros

service_description AROS input voltage

check_command check_snmp!-o .1.3.6.1.2.1.33.1.3.3.1.3 -C Default_snmp_string -w 280 -c 300 -u V

}

define service{

use generic-service ;

hostgroup_name 007-ups-all-aros

service_description AROS output voltage

check_command check_snmp!-o .1.3.6.1.2.1.33.1.4.4.1.2 -C Default_snmp_string -w 230 -c 245 -u V

}

The SNMP values that appear here where retrieved with a freeware mib browser from servercheck.

Check the configuration file:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If all it’s ok restart Nagios:

service nagios restart

You should see something like this:

nagiosUPS.JPG

That’s all.

Technorati : , , , ,
Del.icio.us : , , , ,
Zooomr : , , , ,
Flickr : , , , ,

Proiectează un site ca acesta, cu WordPress.com
Începe