define services for Nagios core 4.0.8
-
- Posts: 26
- Joined: Fri Jul 24, 2015 5:30 am
define services for Nagios core 4.0.8
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.
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.
-
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: define services for Nagios core 4.0.8
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.
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.
-
- Posts: 26
- Joined: Fri Jul 24, 2015 5:30 am
Re: define services for Nagios core 4.0.8
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.
[*]./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
Can you post how your check_snmp_printer command is defined in the commands.cfg file?
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 26
- Joined: Fri Jul 24, 2015 5:30 am
Re: define services for Nagios core 4.0.8
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?
[*]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?
-
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: define services for Nagios core 4.0.8
Get your $HOSTADDRESS$ out of there, that's handled by Nagios.ThinkFast86 wrote:Code: Select all
check_command check_snmp_printer!192.168.4.196!public!"CONSUM TONER"!20!10
Code: Select all
check_command check_snmp_printer!public!"CONSUM TONER"!20!10
-
- Posts: 26
- Joined: Fri Jul 24, 2015 5:30 am
Re: define services for Nagios core 4.0.8
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
} [*]
"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
} [*]
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: define services for Nagios core 4.0.8
You still need the $HOASTADDRESS$ variable in the command, it should be:
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.
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$
}
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
- Posts: 26
- Joined: Fri Jul 24, 2015 5:30 am
Re: define services for Nagios core 4.0.8
Thank you very much guys it works perfect now. Really thank you!!
Re: define services for Nagios core 4.0.8
I'll be closing this thread now, but feel free to open another if you need anything in the future!
Former Nagios employee