define services for Nagios core 4.0.8

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
ThinkFast86
Posts: 26
Joined: Fri Jul 24, 2015 5:30 am

define services for Nagios core 4.0.8

Post 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.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: define services for Nagios core 4.0.8

Post 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.
ThinkFast86
Posts: 26
Joined: Fri Jul 24, 2015 5:30 am

Re: define services for Nagios core 4.0.8

Post 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.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: define services for Nagios core 4.0.8

Post by tgriep »

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!
ThinkFast86
Posts: 26
Joined: Fri Jul 24, 2015 5:30 am

Re: define services for Nagios core 4.0.8

Post 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?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: define services for Nagios core 4.0.8

Post 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
ThinkFast86
Posts: 26
Joined: Fri Jul 24, 2015 5:30 am

Re: define services for Nagios core 4.0.8

Post 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
} [*]
User avatar
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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ThinkFast86
Posts: 26
Joined: Fri Jul 24, 2015 5:30 am

Re: define services for Nagios core 4.0.8

Post by ThinkFast86 »

Thank you very much guys it works perfect now. Really thank you!!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: define services for Nagios core 4.0.8

Post by tmcdonald »

I'll be closing this thread now, but feel free to open another if you need anything in the future!
Former Nagios employee
Locked