Nagios 4.3.1 not accepting single quote '

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.
padu_3891
Posts: 50
Joined: Thu Sep 05, 2013 10:12 pm

Nagios 4.3.1 not accepting single quote '

Post by padu_3891 »

Hello All ,

I tried upgrading the nagios core from 3.5.1 to 4.3.1 in my production centos server . Nagios 4.3.1 is not accepting the single quote ' in my services.cfg whic was working fine with 3.5.1 .

For example : check_nsc_counter-graph!'\\LogicalDisk(R:)\\Avg. Disk Queue Length' this was the chack command directive defined in services.cfg file of 3.5.1 but after upgrading its turning to CRITICAL .

Please help me fix this issue
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nagios 4.3.1 not accepting single quote '

Post by mcapra »

Can you share the full service definition that is returning CRITICAL, as well as the command definition for check_nsc_counter-graph?

Can you also share the full output of whatever plugin is associated with the check_nsc_counter-graph command executed from the CLI? Does executing the plugin from the CLI also return CRITICAL?

If the plugin associated with the check_nsc_counter-graph command is not a standard nagios plugin, can you also share a copy of the plugin or tell us where you found it?
Former Nagios employee
https://www.mcapra.com/
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Nagios 4.3.1 not accepting single quote '

Post by dwhitfield »

Also, can you post your services.cfg? It's possible there's something that isn't closed, but I'm not sure why it wouldn't have show up in 3.x.
padu_3891
Posts: 50
Joined: Thu Sep 05, 2013 10:12 pm

Re: Nagios 4.3.1 not accepting single quote '

Post by padu_3891 »

Thank you taking this case .

I would like to give you more info . i have two instance one with 3.5.1 and other with 4.3.1 . SAME DEFANITION .. works fine with 3.5.1 and its giving critical error with 4.3.1 .

services.cfg

Code: Select all

 define service{
        use                             windows-counter-graph
        host_name                       HOST1
        service_description             COUNTER-LogicalDisk_D_Avg_Disk_sec_Write
        contact_groups                  GMC
        check_command                   check_nsc_counter-graph!'\\LogicalDisk(D:)\\Avg. Disk sec/Write'
        }

define service{
        use                             generic-counter-graph-only-sql
        host_name                       HOST1
        service_description             COUNTER-MSSQL_NEXIM:Transactions-Transactions
        contact_groups                  GMC
        [code]check_command                   check_nsc_counter-graph!'\\MSSQL$$NEXIM:Transactions\\Transactions'
}
[/code]

ERROR Infor in 4.3.1

Code: Select all

CRIT: Counter not found: \LogicalDisk(D:)\Avg. Disk sec/Write: -2147481648: Unable to connect to the specified computer or the computer is offline.
Perfect output at 3.5.1(working fine)

Code: Select all

OK: LogicalDisk(D:)Avg. Disk sec/Write: 0

check command defanintion (common for both the versions)

Code: Select all

define command{
        command_name    check_nsc_counter-graph
        command_line    $USER1$/check_nrpe -u -H $HOSTADDRESS$ -p 56660 -c checkcounter -a $ARG1$ ShowAll
        }

TROUBLESHOOTINGS We tried

Code: Select all

 check_nsc_counter-graph!'\\MSSQL$$NEXIM:Transactions\\Transactions' 
we changed to

Code: Select all

check_nsc_counter-graph!"\\MSSQL\$$NEXIM:Transactions\\Transactions"
steps 1) double quote replaced with single quote
2) $$ replaced with \$$
the aboved steps rectified the issue .

But its really very tough to change all the single quote with double quote in my nagios server cfg files . Please help me find a way to make single quote works as it workes in 3.5.1
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios 4.3.1 not accepting single quote '

Post by tgriep »

Can you run the following commands as root on both the Core 3 and the Core 4 servers and post the output?
Replace xxx.xxx.xxx.xxx with the IP address of you remote host.

Code: Select all

/usr/local/nagios/libexec/check_nrpe -V
/usr/local/nagios/libexec/check_nrpe -u -H xxx.xxx.xxx.xxx -p 56660 -c checkcounter -a '\\LogicalDisk(D:)\\Avg. Disk sec/Write' ShowAll
/usr/local/nagios/libexec/check_nrpe -u -H xxx.xxx.xxx.xxx -p 56660 -c checkcounter -a '\LogicalDisk(D:)\Avg. Disk sec/Write' ShowAll
And post the nagios.cfg files from both servers as well?
Be sure to check out our Knowledgebase for helpful articles and solutions!
padu_3891
Posts: 50
Joined: Thu Sep 05, 2013 10:12 pm

Re: Nagios 4.3.1 not accepting single quote '

Post by padu_3891 »

PRODUCTION 3.5.1 OUTPUTs

Code: Select all

# /usr/local/nagios/libexec/check_nrpe -V
/usr/local/nagios/libexec/check_nrpe: invalid option -- 'V'

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)
Version: 2.12
Last Modified: 03-10-2008
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required

Code: Select all

# /usr/local/nagios/libexec/check_nrpe -u -H 10.165.7.56 -p 56660 -c checkcounter -a '\\LogicalDisk(D:)\\Avg. Disk sec/Write' ShowAll
CRIT: Counter not found: \\LogicalDisk(D:)\\Avg. Disk sec/Write: -2147481648: Unable to connect to the specified computer or the computer is offline.

#/usr/local/nagios/libexec/check_nrpe -u -H 10.165.7.56 -p 56660 -c checkcounter -a '\LogicalDisk(D:)\Avg. Disk sec/Write' ShowAll
OK: \LogicalDisk(D:)\Avg. Disk sec/Write: 0|'\LogicalDisk(D:)\Avg. Disk sec/Write'=0
TEST server 4.3.1 output

Code: Select all

 /usr/local/nagios/libexec/check_nrpe -V
/usr/local/nagios/libexec/check_nrpe: invalid option -- 'V'

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)
Version: 2.12
Last Modified: 03-10-2008
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required

Code: Select all

/usr/local/nagios/libexec/check_nrpe -u -H 10.165.7.56 -p 56660 -c checkcounter -a '\\LogicalDisk(D:)\\Avg. Disk sec/Write' ShowAll
CRIT: Counter not found: \\LogicalDisk(D:)\\Avg. Disk sec/Write: -2147481648: Unable to connect to the specified computer or the computer is offline.

/usr/local/nagios/libexec/check_nrpe -u -H 10.165.7.56 -p 56660 -c checkcounter -a '\LogicalDisk(D:)\Avg. Disk sec/Write' ShowAll
OK: \LogicalDisk(D:)\Avg. Disk sec/Write: 0|'\LogicalDisk(D:)\Avg. Disk sec/Write'=0
Attachments
nagios_PROD_3.5.1.cfg
production nagios.cfg
(43.94 KiB) Downloaded 482 times
nagios.cfg_TEST_4.3.1.cfg
test nagios.cfg
(46.85 KiB) Downloaded 381 times
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios 4.3.1 not accepting single quote '

Post by tgriep »

Do the name of the counters on the 3.5.1 server have double back slashes in them?
The single quote seems to work the same on both systems from the command line.
Normally, when you use a single quote, you do not have to use the extra escaping in the object names.
Be sure to check out our Knowledgebase for helpful articles and solutions!
padu_3891
Posts: 50
Joined: Thu Sep 05, 2013 10:12 pm

Re: Nagios 4.3.1 not accepting single quote '

Post by padu_3891 »

Yes . config files have double slashes . So you mean to say that its wrong config with 3.5.1 and it was wroking with wrong config .?
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios 4.3.1 not accepting single quote '

Post by tgriep »

I was just asking if the commands defined in the config files had double slashes or not.
Running the command from the command line with double slashes failed on the 3.5.1 system as well as the new one and I was just curious if the commands had the double slashes in them.
I didn't find anything in the change log for core 4.x.x that states the behavior change for the slashes in the commands but there could of been a change that is affecting the command definitions.
You may want to post a bug fix at the following link.
https://github.com/NagiosEnterprises/nagioscore/issues
Be sure to check out our Knowledgebase for helpful articles and solutions!
padu_3891
Posts: 50
Joined: Thu Sep 05, 2013 10:12 pm

Re: Nagios 4.3.1 not accepting single quote '

Post by padu_3891 »

just i would like to narrow down the issue .
Command line execution are same and fine in both the versions .

while giving configuration in services.cfg file where double slash and double dollor are used with single quote in 3.5.1

But in 4.3.1 we need to use double quote with double slash and double dollor instead of single quote .

since is a centos server , \\ while passing from services.cfg to check command (command line) automatically one slash will be removed .

my issue is why ' need to be replaced with " in services.cfg .
Locked