Services issues

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.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Services issues

Post by Box293 »

Well you've been given several solutions, there's not much left at the bottom of the barrel!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

Re: Services issues

Post by imran_khan »

Hello,

Thanks for the help.

I have checked and found that negate (/usr/local/nagios/libexec/negate) is already installed on the server.
So what will be the command with negate to check this? Current command is as below.

Command:-
define command{
command_name space
command_line /usr/local/nagios/libexec/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o 1.3.6.1.4.1.2021.9.1.9.8 -w $ARG2$ -c $ARG3$
}

Thanks,
Imran Khan.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Services issues

Post by abrist »

You can use negate to change UNKNOWN to CRITICAL:

Code: Select all

 ./negate -u CRITICAL <command>
From: ./negate --help
-u, --unknown=STATUS
STATUS can be 'OK', 'WARNING', 'CRITICAL' or 'UNKNOWN' without single
quotes. Numeric values are accepted. If nothing is specified, permutes
OK and CRITICAL.
Command:

Code: Select all

define command{
command_name space
command_line /usr/local/nagios/libexec/negate -u CRITICAL /usr/local/nagios/libexec/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o 1.3.6.1.4.1.2021.9.1.9.8 -w $ARG2$ -c $ARG3$
}
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

Re: Services issues

Post by imran_khan »

Hello,

I have tried the negate plugin command but not getting status “CRITCAL”.
Currently “SMART CHECK VPORT 11” status is showing UNKNOWN in Nagios. Please suggest me on the same.

[root@NAGIOS ~]# /usr/local/nagios/libexec/negate -u CRITICAL /usr/local/nagios/libexec/check_nrpe -H ServerIP -c smartctl.exe -a -H /dev/sda,11
smartctl 6.2 2013-07-26 r3841 [x86_64-w64-mingw32-2008r2-sp1] (sf-6.2-1)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
Please note the following marginal Attributes:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
190 Airflow_Temperature_Cel 0x0022 074 045 045 Old_age Always In_the_past 26 (Min/Max 22/51)

Command:-
define command{
command_name smartctl.exe
command_line $USER1$/check_nrpe -t 30 -H $HOSTADDRESS$ -c smartctl.exe -a $ARG1$ $ARG2$
}

define service{
use generic-service,srv-pnp ; Name of service template to use
host_name example.com
service_description SMART CHECK VPORT 11
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 30
retry_check_interval 5
contact_groups exadm
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command smartctl.exe!-H!/dev/sda,11
}

Thanks,
Imran Khan.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Services issues

Post by Box293 »

imran_khan wrote:[root@NAGIOS ~]# /usr/local/nagios/libexec/negate -u CRITICAL /usr/local/nagios/libexec/check_nrpe -H ServerIP -c smartctl.exe -a -H /dev/sda,11
smartctl 6.2 2013-07-26 r3841 [x86_64-w64-mingw32-2008r2-sp1] (sf-6.2-1)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, http://www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
Please note the following marginal Attributes:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
190 Airflow_Temperature_Cel 0x0022 074 045 045 Old_age Always In_the_past 26 (Min/Max 22/51)
At the command line, after executing this command type:

Code: Select all

echo $?
If it returns 2 then it is working (assuming an unknown state was received)

To use negate you'll need to define it in your command:

Code: Select all

define command{
command_name smartctl.exe
command_line $USER1$/negate -u CRITICAL $USER1$/check_nrpe -t 30 -H $HOSTADDRESS$ -c smartctl.exe -a $ARG1$ $ARG2$
}
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

Re: Services issues

Post by imran_khan »

Hello,

As per your suggestion, I have made the changes in Nagios but still I am getting below UNKNOWN error for below command.

Error:-
"No data returned from command"

define command{
command_name check_snmp_time
command_line /usr/local/nagios/libexec/negate -u CRITICAL $USER1$/check_snmp_time -H $HOSTADDRESS$ -C $ARG1$ -w $ARG2$ -c $ARG3$
}

define service{
use generic-service,srv-pnp ; Name of service template to use
host_name Example.com
service_description Time Skew
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 60
retry_check_interval 1
contact_groups exadm
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_snmp_time!community name!30!60
}

Thanks,
Imran Khan.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Services issues

Post by Box293 »

What does it report at the command line?

Code: Select all

su nagios
/usr/local/nagios/libexec/negate -u CRITICAL /usr/local/nagios/libexec/check_snmp_time -H replace_with_address -C replace_with_community_name -w 30 -c 60
echo $?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

Re: Services issues

Post by imran_khan »

Hello,

Thanks for the reply.

I am getting value 3 after executing negate command.

[root@NAGIOS ~]# /usr/local/nagios/libexec/negate -u CRITICAL /usr/local/nagios/libexec/check_snmp_time -H Server_IP -C Community Name -w 30 -c 60
No data returned from command

[root@NAGIOS ~]# echo $?
3

Thanks,
Imran Khan.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Services issues

Post by abrist »

imran_khan wrote:No data returned from command
This implies there is an issues with the command.
Does the command actually work on its own?

Code: Select all

/usr/local/nagios/libexec/check_snmp_time -H Server_IP -C Community_Name -w 30 -c 60
echo $?
Is there a verbose mode?

Code: Select all

/usr/local/nagios/libexec/check_snmp_time -H Server_IP -C Community_Name -w 30 -c 60 -vvv
echo $?
Are you replacing Server_IP and Community_Name?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

Re: Services issues

Post by imran_khan »

Hello,

Yes. I have replaced server ip and community name.
Command is successfully running its own.

[root@NAGIOS ~]# /usr/local/nagios/libexec/check_snmp_time -H Server_IP -C Community_Name -w 30 -c 60
Time difference is less than 30 seconds: 0|diff=0
[root@NAGIOS ~]# echo $?
0

No there is no verbose option.

[root@NAGIOS ~]# /usr/local/nagios/libexec/check_snmp_time -H Server_IP -C Community_Name -w 30 -c 60 -vvv
Unknown option -vvv.

Usage: /usr/local/nagios/libexec/check_snmp_time -H HOSTADDRESS [-C COMMUNITY] [-w WARNING] [-c CRITICAL] [-v VERSION]

-H HOSTADDRESS
The host to check, either IP address or a resolvable hostname.
-C COMMUNITY
The SNMP community to use, defaults to public.
-v VERSION
The SNMTP version to use, defaults to 2c.
-w WARNING
The amount of seconds from where warnings start. Defaults to 30.
-c CRITICAL
The amount of seconds from where criticals start. Defaults to 60.
[root@NAGIOS ~]# echo $?
3

Thanks,
Imran Khan.
Locked