The answer to the question "how to ..."





Introduction

Here are some step-by-step examples on how to set up various tasks in Apan. For more information on syntax, specific parameters etc, look at the previous parts of the documentation


Measure ping rount-trip times

1. Create a service-definition in Nagios:
define service {
host_name                      server
service_description            Ping
check_command                  apan!ping!100.0,20%!500.0,60%
name                           Ping
use                            generic-service
normal_check_interval          1
}

2. Create a RRD:
rrdtool create /usr/local/nagios/rrd/server_Ping.rrd -s 60 DS:ping:GAUGE:300:0:U RRA:AVERAGE:0.5:1:50400 RRA:AVERAGE:0.5:60:43800

3. Add a line in apan.cfg:
server;Ping;/usr/local/nagios/rrd/server_ping.rrd;ping;ping:LINE2;Ping round-trip time;Seconds

4. Add an icon and a link as extended service-info:
define serviceextinfo{
host_name               server
service_description     Ping
notes_url               /nagios/cgi-bin/apan.cgi?host=server&service=Ping
icon_image              graph.png
icon_image_alt          View graphs
}




Measure bandwith-usage

This example uses SNMP to get number of packets sent/received on a network-interface in the server.
1. Create a service-definition in Nagios:
define service {
host_name                      server
service_description            Net-usage
check_command                  apan!snmpget!10!20
use                            generic-service
normal_check_interval          1
}
Note that the last two arguments in the check_command not are used by this plugin.

2. Create a RRD:
rrdtool create /usr/local/nagios/rrd/server_Net-usage.rrd -s 60 DS:IN:COUNTER:300:0:U DS:OUT:COUNTER:300:0:U RRA:AVERAGE:0.5:1:50400 RRA:AVERAGE:0.5:60:43800

3. Add a line in apan.cfg:
server;Net-usage;/usr/local/nagios/rrd/server_Net-usage.rrd;public:.1.3.6.1.2.1.2.2.1.10.2|public:.1.3.6.1.2.1.2.2.1.16.2;IN:LINE2 OUT:LINE2;Network throughput;Bytes/sek;

4. Add an icon and a link as extended service-info:
define serviceextinfo{
host_name               server
service_description     Net-usage
notes_url               /nagios/cgi-bin/apan.cgi?host=server&service=Net-usage
icon_image              graph.png
icon_image_alt          View graphs
}




Measure SMTP-traffic on a Exchange-server

This example uses NSClient to get number of messages sent/received by the Exchange-server.
1. Create a service-definition in Nagios:
define service {
host_name                      server
service_description            SMTP-messages
check_command                  apan!nt-smtp!10!20
use                            generic-service
normal_check_interval          1
}
Note that the last two arguments in the check_command not are used by this plugin.

2. Create a RRD:
rrdtool create /usr/local/nagios/rrd/server_SMTP-messages.rrd -s 60 DS:SENT:COUNTER:300:0:U DS:RECV:COUNTER:300:0:U RRA:AVERAGE:0.5:1:50400 RRA:AVERAGE:0.5:60:43800

3. Add a line in apan.cfg:
server;SMTP-messages;/usr/local/nagios/rrd/server_SMTP-messages.rrd;Messages Sent Total|Messages Received Total;SENT:LINE2 RECV:LINE2;Messages;Msgs/min;

Note that the plugin multiplies the result with 60 so RRDTool will display the rate as messages/minute

4. Add an icon and a link as extended service-info:
define serviceextinfo{
host_name               server
service_description     SMTP-messages
notes_url               /nagios/cgi-bin/apan.cgi?host=server&service=SMTP-messages
icon_image              graph.png
icon_image_alt          View graphs
}




Monitor disk-usage on a UNIX-machine

This example monitors the filesystems / and /export/home on a server.
1. Create a service-definition in Nagios:
define service {
host_name                      server
service_description            disk-usage
check_command                  apan!disk!85!95
use                            generic-service
normal_check_interval          1
}
Note that the last two arguments in the check_command specifies at wich levels the plugin should return warning or critical status to Nagios.

2. Create a RRD:
rrdtool create /usr/local/nagios/rrd/server_disk_usage.rrd -s 60 DS:root:GAUGE:300:0:U DS:home:GAUGE:300:0:U RRA:AVERAGE:0.5:1:50400 RRA:AVERAGE:0.5:60:43800

Note that the DS-name cannot contain /
3. Add a line in apan.cfg:
server;disk_usage;/usr/local/nagios/rrd/server_disk_usage.rrd;/|/export/home;root:LINE2 home:LINE2;Disk usage;%;

4. Add an icon and a link as extended service-info:
define serviceextinfo{
host_name               server
service_description     disk_usage
notes_url               /nagios/cgi-bin/apan.cgi?host=server&service=disk_usage
icon_image              graph.png
icon_image_alt          View graphs
}




Monitor disk-usage on a Windows-machine

This example uses NSClient to monitor the filesystems c: and d: on a Windows-server.
1. Create a service-definition in Nagios:
define service {
host_name                      win-server
service_description            disk-usage
check_command                  apan!nt-disk!150!100
use                            generic-service
normal_check_interval          1
}
Note that the last two arguments in the check_command specifies minimal megabytes free before the plugin returns warning or critical status to Nagios.

2. Create a RRD:
rrdtool create /usr/local/nagios/rrd/win-server_disk_usage.rrd -s 60 DS:c-used:GAUGE:300:0:U DS:c-free:GAUGE:300:0:U DS:d-used:GAUGE:300:0:U DS:d-free:GAUGE:300:0:U RRA:AVERAGE:0.5:1:50400 RRA:AVERAGE:0.5:60:43800

Note that this plugin takes the argument ('c') and generates the DS-names <argument>-free and <argument>-used, so the DS-names for disk c must be 'c-used' and 'c-free'.
Expect this to change in the future!

3. Add a line in apan.cfg:
win-server;disk_usage;/usr/local/nagios/rrd/win-server_disk_usage.rrd;c|d;c-used:AREA c-free:STACK c-used:AREA c-free:STACK;Disk usage;Bytes;-l 1 -b 1024;

Note 1; When the graps is drawn, the free and used space is drawn as areas with free space on the top.
Note 2; '-l 1 -b 1024' at the end of the line makes the graphs have a scaling-factor of 1024 (1 kB).

4. Add an icon and a link as extended service-info:
define serviceextinfo{
host_name               win-server
service_description     disk_usage
notes_url               /nagios/cgi-bin/apan.cgi?host=win-server&service=disk_usage
icon_image              graph.png
icon_image_alt          View graphs
}





Copyright © 2002 Fredrik Wänglund


Powered by:
SourceForge Logo