Last update : Jan 15 2006
Commands
Here are commands example to use my scripts
with nagios.
It's only the basic things you can do, check the help of every
script if you need more advanced features especially if you need
performance outputs.
The command definitions are complete, but not the service definitions
: you must add host name, contact groups, etc....
All these commands use $USER<n>$ macros
to put snmp login. The reason for this is that the ressources.cfg
file cannot be read by the CGI, preventing your "passwords"
to be seen with the config.
You must set the $USER7$ or $USER8$ to make these examples work.
The $USER<n>$ macro are defined in the resources.cfg file
SNMP login with $USER<n>$
About regular expressions
Configuration examples
of
check_snmp_boostedge.pl
check_snmp_cpfw.pl
check_snmp_css.pl
& check_snmp_css_main.pl
check_snmp_env.pl
check_snmp_linkproof_nhr.pl
check_snmp_load.pl
check_snmp_interface.pl
check_snmp_mem.pl
check_snmp_nsbox.pl
check_snmp_process.pl
check_snmp_storage.pl
check_snmp_vrrp.pl
check_snmp_win.pl
Checks you can make by
host type
SNMP
login
For more information, you can have a look at information
on snmp login
If you are using snmp v1 :
$USER7$=-C <community>
If you are using snmp v2c :
$USER7$=-C <community> -2
or you can use $USER9$ if you need both v1 and v2c.
Examples of snmp v3 login :
AuthNoPriv (md5) :
$USER8$=-l <login> -x <pass>
AuthPriv (md5,aes) :
$USER8$=-l <login> -x <pass> -X <pass>
-L md5,aes
About
regular expressions
With all these scripts, when you select an
interface, a service or process name etc... you use by default regular
expresions :
Note : you can disable this by using "-r"
Examples : Don't forget it is perl regular
expressions.
Regexp |
Will match |
eth |
eth0, eth1, eth2 but also Fastethernet0/0
.... |
eth[1-9] |
eth1, eth2, ... eth9 but also eth10, eth11 |
eth[1-2]$ |
eth1, eth2 only (not eth11 for ex). |
dhcp |
dhcpc, dhpcd |
check_snmp_boostedge.pl
Command |
check_snmp_boostedge |
Nagios cmd |
define command{
command_name check_snmp_boostedge_v1
command_line $USER1$/check_snmp_boostedge.pl -H $HOSTADDRESS$
$USER7$ -s $ARG1$ -n $ARG2$ $ARG3$
} |
Arguments |
ARG1 : Service name (regexp)
ARG2 : Number of services selected by regexp which must be in
running & enabled state
ARG3 : additional arguments if needed. |
Service |
boostedge_services : checks is there is 3 active
& enabled service matching "test" with
snmp v2c
|
Nagios service |
define service {
name boostedge_services
check_command check_snmp_boostedge_v1!test!3!-2
} |
check_snmp_cpfw.pl
Command |
check_cpfw1_v3 |
Nagios cmd |
define command{
command_name check_cpfw1_v3
command_line $USER1$/check_snmp_cpfw.pl -H $HOSTADDRESS$
$USER8$ $ARG1$
} |
Arguments |
ARG1 : all arguments. |
Service |
checkpoint_verification : checks high availability
cluster, with policy "CP_Policy" installed, and
warning at 100000 connexions, critical at 200000
CP_Management : checks management station
|
Nagios service |
define service {
name checkpoint_verification
check_command check_cpfw1_v3!-swa -p CP_Policy
-c 100000,200000 -f
} |
Nagios service |
define service {
name CP_Management
service_description CPFW1 management
check_command check_cpfw1_v3!-sm
}
|
check_snmp_css.pl
& check_snmp_css_main.pl
Command |
check_snmp_css_main : get index from the host, services
are then checked using check_snmp_css_indexed (snmpv2)
check_snmp_css_indexed : check services indexed by
check_snmp_css_main (snmpv2)
check_snmp_css : directly read index & data from
the host (snmpv2)
|
Nagios cmd |
define command{
command_name check_snmp_css_main
command_line $USER1$/check_snmp_css_main.pl -H $HOSTADDRESS$
$USER7$ -2
} |
Nagios cmd |
define command{
command_name check_snmp_css_indexed
command_line $USER1$/check_snmp_css.pl -H $HOSTADDRESS$
$USER7$ -2 -d -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
} |
Nagios cmd |
define command{
command_name check_snmp_css
command_line $USER1$/check_snmp_css.pl -H $HOSTADDRESS$
$USER7$ -2 -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
} |
Arguments |
ARG1 : regexp of service(s) to check
ARG2 : warning level for : minimum number of active &
alive service , average response time, number of connexions
ARG3 : critical level for : minimum number of active &
alive service , average response time, number of connexions
ARG4 : additional arguments if needed.
|
Service |
css_index_file_create : This is a "fake"
service, which only creates index file in /tmp. It normally
returns the number of services it indexes, or an error if
he can't.
css_verif_TEST : checks at least 2 services
mathnig TEST are up. Warning if 1, critical if 0. This service
uses the index file created by css_index_file_create, and
returns UNKNOWN if it can't find it.
css_verif_TEST2 : checks at least 2 services
mathnig TEST2 are up. Warning if 1, critical if 0. This service
doesn't use an index file.
|
Nagios service |
define service {
name css_index_file_create
check_command check_snmp_css_main
} |
Nagios service |
define service {
name css_verif_TEST
check_command check_snmp_css_indexed!"TEST"!1!0
}
|
Nagios service |
define service {
name css_verif_TEST2
check_command check_snmp_css!"TEST2"!1!0
}
|
check_snmp_env.pl
Command |
check_snmp_env (snmpv1)
check_snmp_env_v3 (snmpv3) |
Nagios cmd |
define command{
command_name check_snmp_env
command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$
$USER7$ -T $ARG1$ $ARG2$
} |
Nagios cmd |
define command{
command_name check_snmp_env_v3
command_line $USER1$/check_snmp_env.pl -H $HOSTADDRESS$
$USER8$ -T $ARG1$ $ARG2$
} |
Arguments |
ARG1 : type (cisco|nokia|bc|iron)
ARG2 : additional arguments if needed. |
Service |
ironport_env : checks ironport fans RPM > 1500
and temp < 70 deg celcius
nokia_env : checks nokia IP fans and power supply status
cisco_env : checks cisco fans and power supply status
|
Nagios service |
define service {
name ironport_env
check_command check_snmp_env!iron!-F
1500 -c 70
} |
Nagios service |
define service {
name nokia_env
check_command check_snmp_env_v3!nokia
}
|
Nagios service |
define service {
name cisco_env
check_command check_snmp_env_v3!cisco
}
|
check_snmp_linkproof_nhr.pl
Command |
check_snmp_lp_nhr_v3 (snmpv3 and performance output) |
Nagios cmd |
define command{
command_name check_snmp_lp_nhr_v3
command_line $USER1$/check_snmp_linkproof_nhr.pl
-H $HOSTADDRESS$ $USER8$ -f
} |
Arguments |
None |
Service |
linkproof_nhr : returns
WARNING if one nhr at least is in "no new session"
or "inactive" mode.
CRITICAL if all nhr are inactive.
|
Nagios service |
define service {
name linkproof_nhr
check_command check_snmp_lp_nhr_v3
} |
check_snmp_load.pl
Command |
check_snmp_load_v1 : using snmpv1 (or v2 depending
on $USER7$ value)
check_snmp_load_v3 : using snmpv3 |
Command |
define command{
command_name check_snmp_load_v1
command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$
$USER7$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
} |
Command |
define command{
command_name check_snmp_load_v3
command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$
$USER8$ -T $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
} |
Arguments |
ARG1 : host type (stand,netsc,netsl,as400,cisco,cata,nsc,fg,bc,nokia,hp,lp,hpux)
ARG2 : warning level
ARG3 : critical level
ARG4 : additional arguments if needed.
|
Service |
bluecoat_load : Bluecoat cpu usage
Linux_load : Linux load (1min, 5 min, 15 min)
Cisco_load : Cisco cpu usage
lp_load : Radware Linkproff cpu usage |
Service |
define service {
name bluecoat_load
check_command check_snmp_load_v1!bc!95!99
} |
Service |
define service {
name Linux_load
check_command check_snmp_load_v1!netsl!4,3,3!8,5,5
}
|
Service |
define service {
name Cisco_load
check_command check_snmp_load_v1!cisco!90,80,60!100,100,100
}
|
Service |
define service {
name lp_load
check_command check_snmp_load_v1!lp!90!99
} |
check_snmp_interface.pl
Command |
check_snmp_int_v1 : using snmpv1
check_snmp_int_v3 : using snmpv3
|
Command |
define command{
command_name check_snmp_int_v1
command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$
$USER7$ -n $ARG1$ $ARG2$
} |
Command |
define command{
command_name check_snmp_int_v3
command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$
$USER8$ -n $ARG1$ $ARG2$
} |
Arguments |
ARG1 : regexp of interface
ARG2 : additional arguments if needed.
|
Service |
check_int_1_6: Checks FastEthernet 1 to 6 are up (snmpv1)
check_int_eth0_bdw : Checks input bandwith on eth1 is
< 100 KBytes/s and output is < 50 Kbytes/s (critical at
0,0 means no critical levels). (snmpv3) |
Service |
define service {
name check_int_1_6
check_command check_snmp_int_v1!"FastEthernet-[1-6]"
}
|
Service |
define service {
name check_int_eth0_bdw
check_command check_snmp_int_v3!eth0!-k
-w 100,50 -c 0,0
} |
check_snmp_mem.pl
Command |
check_snmp_mem |
Command |
define command{
command_name check_snmp_mem_v1
command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$
$USER7$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
} |
Command |
define command{
command_name check_snmp_mem_v3
command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$
$USER8$ $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
} |
Arguments |
ARG1 : Host type (-N, -I, -E)
ARG2 : warning level(s)
ARG3 : critical level(s)
ARG4 : additional arguments if needed.
|
Service |
Linux_memory : warning at 95% memory used and 60% swap
used, critical at 99% mem and 90% swap
Cisco_mem : warning at 80% used, critical at 99% used. |
Service |
define service {
name Linux_memory
check_command check_snmp_mem_v1!-N!95,60!99,90
} |
Service |
define service {
name Cisco_mem
check_command check_snmp_mem_v1!-I!80!99
}
|
check_snmp_nsbox.pl
Command |
check_snmp_nsbox (snmpv1 or v2c) |
Nagios cmd |
define command{
command_name check_snmp_nsbox
command_line $USER1$/check_snmp_nsbox.pl -H $HOSTADDRESS$ $USER7$
-d $ARG1$ -s $ARG2$ -n $ARG3$ $ARG4$
} |
Arguments |
ARG1 : Diode name (regexp)
ARG2 : Vhost name (regexp)
ARG3 : Number of diodes and vhost that must be up
ARG4 : additional arguments if needed.
|
Service |
check_service_nsbox : checks using snmpv2
- 6 diodes matching "diode_name" are up
- 3 vhosts matching "vhost_name" are up
|
Nagios service |
define service {
name check_service_nsbox
check_command check_snmp_nsbox_v1!diode_name!vhost_name!6,3!-2
} |
check_snmp_process.pl
Command |
check_snmp_process |
Command |
define command{
command_name check_snmp_process_v1
command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$
$USER7$ -n $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
} |
Arguments |
ARG1 : regexp of process name
ARG2 : warning level(s)
ARG3 : critical level(s)
ARG4 : additional arguments if needed.
|
Services |
proxy_checks : checks with snmpv2 (-2 option) that
there is more than 21 process matching "proxy", but
no more than 1999 (critical at 20 & 2000)
Check_httpd_all : Checks that process matching
"httpd"
- Process number is > 5 and < 100 (or returns warning)
- Process number is > 0 (or returns critical)
- Memory used (by httpd process using the max memory) is <
20 Mbytes or < 30 Mbytes
- Cpu used (by all process together) is < 90% or 99%.
check_crontab : checks crontab is running (critical if
not, no warnings). |
Service |
define command {
name proxy_checks
check_command check_snmp_process_v1!proxy!21,1999!20,2000!-2
} |
Service |
define command {
name Check_httpd_all
check_command check_snmp_process_v1!httpd!5,100!0!-2
-m 20,30 -u 90,99
} |
Service |
define service {
name check_crontab
check_command check_snmp_process!crond!0!0
}
|
check_snmp_storage.pl
Command |
check_snmp_storage |
Command |
define command{
command_name check_snmp_storage_v1
command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$
$USER7$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
} |
Command |
define command{
command_name check_snmp_storage_v3
command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$
$USER8$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
} |
Arguments |
ARG1 : regexp of storage name
ARG2 : warning level
ARG3 : critical level
ARG4 : additional arguments if needed.
|
Service |
Check_LinDisk_home : Checks "/home" mountpoint
(and only this one because of -r) usage < 90 and 97 % |
|
define service {
name Check_LinDisk_home
service_description Verification /home
check_command check_snmp_storage_v3!/home!90!97!-r
}
|
Service |
Win_check_swap : Checks virtual (ram+swap) mem on windows
< 60% or 90% |
|
define command {
name Win_check_swap
service_description Verification swap Windows
check_command check_snmp_storage_v3!Virtual!60!90
}
|
Service |
check_linux_swap : checks Linux swap < 60 and 90% |
|
define command {
name check_linux_swap
service_description Verfication swap linux
check_command check_snmp_storage_v1!Swap!60!90!
} |
Service |
check_disk_all : Checks that "/", "/opt"
, "/var", "/config" mountpoints usage is
< 80 and 90% |
|
define command {
name check_disk_all
service_description Verification / /opt /var /config
check_command check_snmp_storage_v1!"^/$|opt|config|var"!80!90!
} |
check_snmp_vrrp.pl
Command |
check_snmp_vrrp |
Command |
define command{
command_name check_snmp_vrrp_v1
command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$
$USER7$ -T $ARG1$ -s $ARG2$
} |
Command |
define command{
command_name check_snmp_vrrp_v3
command_line $USER1$/check_snmp_vrrp.pl -H $HOSTADDRESS$
$USER8$ -T $ARG1$ -s $ARG2$
} |
Arguments |
ARG1 : Host type (nokia, alteon, lp, nsc, ipso)
ARG2 : state (master or backup) or number of members, max
% assigned to nodes (for ipso).
|
Service |
Linkproof_check_vrrp_master : Checks that all interface
are in master state |
Service |
define service {
name Linkproof_check_vrrp_master
check_command check_snmp_vrrp_v3!lp!master
}
|
Service |
Nokia_check_vrrp_backup : Checks that all interface
are in backup state |
Service |
define service {
name Linkproof_check_vrrp_backup
check_command check_snmp_vrrp_v3!lp!backup
} |
Service |
Nokia_clustering : checks that nokia cluster has 2
members and that the load assigned to each member < 98% |
Service |
define service {
name Nokia_clustering
check_command check_snmp_vrrp_v3!ipso!2,98%
} |
check_snmp_win.pl
Command |
check_snmp_win |
Nagios |
define command {
command_name check_win
command_line $USER1$/check_snmp_win.pl -H $HOSTADDRESS$
$USER7$ -n $ARG2$
# comment community service(s) name
} |
Service |
check_win_dhcp : Checks dhcp service is running |
Nagios |
define service {
name check_win_dhcp
service_description Checks dhcp service is running
check_command check_win!dhcp
}
|
Service |
check_win_reg_spool: Checks registery access &
print spool is active (French windows !!) |
Nagios |
define service {
name check_win_reg_spool
service_description Checks registery access &
print spool is active
check_command check_win!"au registre",spouleur
}
|
Checks you can
make by host type
N/A : nothing of this type to check
SNMP : yes with simple snmp query
?? : not tested because useless most of the time.
Specific : name of the script to look
at for platform specific checks.
Host type |
Interface |
storage |
load/cpu |
mem |
process |
env |
specific |
Linux |
Yes |
Yes |
Yes |
Yes |
Yes |
No |
|
Windows |
Yes |
Yes |
Yes |
Yes |
Yes |
No |
check_snmp_win.pl |
Cisco router/switch |
Yes |
N/A |
Yes |
Yes |
N/A |
Yes |
|
HP router/switch |
Yes |
N/A |
Yes |
Yes |
N/A |
No |
|
Bluecoat proxy |
Yes |
snmp |
Yes |
snmp |
No |
Yes |
|
CheckPoint on SPLAT |
Yes |
Yes |
Yes |
Yes |
Yes |
No |
check_snmp_cpfw.pl |
CheckPoint on Nokia IP |
Yes |
Yes |
Yes |
No |
?? |
No |
check_snmp_vrrp.pl |
Boostedge |
Yes |
Yes |
Yes |
Yes |
?? |
No |
check_snmp_boostedge.pl |
AS400 |
Yes |
Yes |
Yes |
Yes |
No |
No |
|
NetsecureOne Netbox |
Yes |
Yes |
Yes |
?? |
Yes |
No |
|
Radware Linkproof |
Yes |
N/A |
snmp |
snmp |
No |
No |
check_snmp_linkproof_nhr
check_snmp_vrrp.pl
|
IronPort |
Yes |
snmp |
snmp |
snmp |
No |
Yes |
|
Cisco CSS |
Yes |
?? |
Yes |
Yes |
No |
?? |
check_snmp_css.pl |
|