What is the best practice using commands?
Posted: Fri Jul 10, 2015 2:55 pm
Hey all,
Trying to figure out what is the best practice in regards to commands.
For example, i'm using nagios3 in the etc directory under the conf.d directory and have my cfg_dir=/etc/nagios/conf.d enabled to so i can have multiple .d directories because i have so many different locations that i'm monitoring. For now, my commands.cfg file in the /etc/nagios3 directory houses all my commands.
I'm using the check_snmp command to check many different things and devices. Right now my check command is defined in the top structure, /etc/nagios3/commands.cfg file:
define command {
command_name check_snmp
command_line $USER1$/check_snmp -P $ARG1$ -H $HOSTADDRESS$ -C $ARG2$ -o $ARG3$ -w $ARG4$ -c $ARG5$
}
All my sub directories in conf.d have their service definition reference this check_snmp command. Now that i've added multiple devices i realized that some of the snmp checks I don't need warning or critical thresholds.
Can I have multiple check_commands in many different directories using a SINGLE check command called check_snmp command, but maybe doesn't need to use all the arugments such asARG4/ARG5? Or do I need to create another check_snmp command somewhere else in another .cfg file. I tried doing this already and nagios yells at me saying check_snmp is already define or something like that, so i'm guessing the way to go is probably find a way to pass null values somehow to the arguments that I don't need in my command.
Here are two service checks for reference, each in a different sub directory under the conf.d/
define service {
use generic-service
host_name xxxxxxx.xxxxx.xxxxxx.x,xxxxxxxx.x.xxxxxx.xxx.xx
service_description Signal
check_command check_snmp!1!xxxx!.1.3.6.1.4.1.12394.1.1.11.10.0
notification_interval 0;
}
As you can see in this one I don't need anything in my check_command for -c or -w thresholds.
In this one I do:
define service {
use generic-service
host_name xxxxx.xxxx.xxxx.x,xxxxx.xxxx.xxxx.x
service_description Data In
check_command check_snmp!1!xxxxx!.1.3.6.1.2.1.2.2.1.10.1!100!200
}
Thanks so much!
Trying to figure out what is the best practice in regards to commands.
For example, i'm using nagios3 in the etc directory under the conf.d directory and have my cfg_dir=/etc/nagios/conf.d enabled to so i can have multiple .d directories because i have so many different locations that i'm monitoring. For now, my commands.cfg file in the /etc/nagios3 directory houses all my commands.
I'm using the check_snmp command to check many different things and devices. Right now my check command is defined in the top structure, /etc/nagios3/commands.cfg file:
define command {
command_name check_snmp
command_line $USER1$/check_snmp -P $ARG1$ -H $HOSTADDRESS$ -C $ARG2$ -o $ARG3$ -w $ARG4$ -c $ARG5$
}
All my sub directories in conf.d have their service definition reference this check_snmp command. Now that i've added multiple devices i realized that some of the snmp checks I don't need warning or critical thresholds.
Can I have multiple check_commands in many different directories using a SINGLE check command called check_snmp command, but maybe doesn't need to use all the arugments such asARG4/ARG5? Or do I need to create another check_snmp command somewhere else in another .cfg file. I tried doing this already and nagios yells at me saying check_snmp is already define or something like that, so i'm guessing the way to go is probably find a way to pass null values somehow to the arguments that I don't need in my command.
Here are two service checks for reference, each in a different sub directory under the conf.d/
define service {
use generic-service
host_name xxxxxxx.xxxxx.xxxxxx.x,xxxxxxxx.x.xxxxxx.xxx.xx
service_description Signal
check_command check_snmp!1!xxxx!.1.3.6.1.4.1.12394.1.1.11.10.0
notification_interval 0;
}
As you can see in this one I don't need anything in my check_command for -c or -w thresholds.
In this one I do:
define service {
use generic-service
host_name xxxxx.xxxx.xxxx.x,xxxxx.xxxx.xxxx.x
service_description Data In
check_command check_snmp!1!xxxxx!.1.3.6.1.2.1.2.2.1.10.1!100!200
}
Thanks so much!