Page 1 of 1

define services for Nagios core 4.0.8

Posted: Mon Jul 27, 2015 10:01 am
by ThinkFast86
Good day all,

I have already install Nagios core 4.0.8 and i already configure hosts. The only service that i enable is ping because i can t enable nothing else. I am trying to use services over snmp with using MIB for my devices but when i am trying to make a new service the most times i receive the "unkown" state with error no "specified OID" or "unkown command". Does anyone can help me on how i have to make a new service for my host? For e.g. how i can make a service for check the uptime of a network switch or cpu usage or anything else like this?

Sorry for my English!

Thank you in advance.

Re: define services for Nagios core 4.0.8

Posted: Mon Jul 27, 2015 3:19 pm
by jdalrymple
This is a very basic concept and I encourage you to start with this documentation. It gives a pretty solid overview of how to start monitoring using SNMP:

https://assets.nagios.com/downloads/nag ... uters.html

Otherwise if you're experiencing any specific problems when trying to setup your service we'll need verbose and repeatable errors as well as copies of your configurations to give advice on.

Re: define services for Nagios core 4.0.8

Posted: Tue Jul 28, 2015 1:39 pm
by ThinkFast86
I did it and thank you for the help. I have one more question: when i am trying this command (network printer):

[*]./check_snmp_printer -H 192.168.4.196 -C public -x "CONSUM TONER" -w 20 -c 10[*]

manually i take the correct results but when i am creating the bellow service:
[*]define service {
host_name bizhubc284e
use generic-service
service_description CONSUM_TONER
check_command check_snmp_printer!192.168.4.196!public!"CONSUM TONER"!20!10
normal_check_interval 10
retry_check_interval 1
} [*]


i receive the warning message from nagios:

WARNING: No SNMP response from 192.168.4.194! Make sure host is up and SNMP is configured properly

Can you please help me what am i doing wrong? I have already configure the default snmp for the specific network printer and everything seems good.

Re: define services for Nagios core 4.0.8

Posted: Tue Jul 28, 2015 4:28 pm
by tgriep
Can you post how your check_snmp_printer command is defined in the commands.cfg file?

Re: define services for Nagios core 4.0.8

Posted: Wed Jul 29, 2015 1:45 am
by ThinkFast86
This is the command from the command.cfg:

[*]define command {
command_name check_snmp_printer
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2$ -w $ARG3$ -c $ARG4$
} [*]

If i use the command line it works perfect, but when i am using the service i receive the error that i post before. How it works from the command line and from the service i receive this error?

Re: define services for Nagios core 4.0.8

Posted: Wed Jul 29, 2015 12:49 pm
by jdalrymple
ThinkFast86 wrote:

Code: Select all

check_command check_snmp_printer!192.168.4.196!public!"CONSUM TONER"!20!10
Get your $HOSTADDRESS$ out of there, that's handled by Nagios.

Code: Select all

check_command check_snmp_printer!public!"CONSUM TONER"!20!10

Re: define services for Nagios core 4.0.8

Posted: Wed Jul 29, 2015 5:12 pm
by ThinkFast86
Ok i did it and i have a new UNKNOWN status that says:
"Hostname and/or Community variables have not been set!"
I check the snmp_printer.cfg and i saw that the community have been set ok to public.

My command.cfg now is like this
[*]define command {
command_name check_snmp_printer
command_line $USER1$/check_snmp_printer -C $ARG1$ -x $ARG2$ -w $ARG3$ -c $ARG4$
} [*]

And the service for the host is like this:
[*]define service {
host_name bizhubc284e
use generic-service
service_description CONSUM_TONER
check_command check_snmp_printer!public!"CONSUM TONER"!20!10
normal_check_interval 10
retry_check_interval 1
} [*]

Re: define services for Nagios core 4.0.8

Posted: Wed Jul 29, 2015 8:38 pm
by Box293
You still need the $HOASTADDRESS$ variable in the command, it should be:

Code: Select all

define command {
command_name check_snmp_printer
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2$ -w $ARG3$ -c $ARG4$
}
By using the $HOSTADDRESS$ variable, when nagios constructs the command, it looks at the host object to get the HOSTADDRESS. This is the flexibility of nagios.

Re: define services for Nagios core 4.0.8

Posted: Thu Jul 30, 2015 1:39 am
by ThinkFast86
Thank you very much guys it works perfect now. Really thank you!!

Re: define services for Nagios core 4.0.8

Posted: Thu Jul 30, 2015 9:12 am
by tmcdonald
I'll be closing this thread now, but feel free to open another if you need anything in the future!