Page 2 of 5

Re: Services issues

Posted: Tue Feb 10, 2015 4:09 pm
by Box293
Well you've been given several solutions, there's not much left at the bottom of the barrel!

Re: Services issues

Posted: Wed Feb 11, 2015 1:25 pm
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.

Re: Services issues

Posted: Wed Feb 11, 2015 4:27 pm
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$
}

Re: Services issues

Posted: Wed Feb 11, 2015 5:59 pm
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.

Re: Services issues

Posted: Wed Feb 11, 2015 7:49 pm
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$
}

Re: Services issues

Posted: Thu Feb 12, 2015 7:27 pm
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.

Re: Services issues

Posted: Thu Feb 12, 2015 8:00 pm
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 $?

Re: Services issues

Posted: Fri Feb 13, 2015 10:50 am
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.

Re: Services issues

Posted: Fri Feb 13, 2015 11:30 am
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?

Re: Services issues

Posted: Fri Feb 13, 2015 12:00 pm
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.