Page 1 of 1

Special charector in Cluster resouce

Posted: Thu May 30, 2019 6:52 am
by bsivavani
Hi,

We are trying to monitor cluster service which is having special character & in the service PNOM Submission (Elexon & National Grid).

We are able to run the service from command line, but getting the below error when running from console.

The command (check_mscs_resource) returned an invalid return code: 255

From command Line
[root@XXXX ~]# /usr/local/nagios/libexec/check_nrpe -H XXXX -p 5666 -t 30 -c check_mscs_resource -a '"TESTPNOMMO TESTSubmission (ElexonWQ & Nationall Grid)" "XXXX"'
TESTPNOMMO TESTSubmission (ElexonWQ & Nationall Grid) is Online, Owner is XXXX - PNOM Submissionkk Elexonnh, ResoureType is Generic Service
[root@XXXX ~]#

Kindly advice if we can escape & symbol ?

Re: Special charector in Cluster resouce

Posted: Thu May 30, 2019 11:48 am
by cdienger
Have you tested the script on a resource that doesn't contain a & ?

The results seen on the command line are not the return code. To see the return code you should run "echo $?" right after running the check. I would also recommend running the command as nagios:

Code: Select all

su - naiogs
/usr/local/nagios/libexec/check_nrpe -H XXXX -p 5666 -t 30 -c check_mscs_resource -a '"TESTPNOMMO TESTSubmission (ElexonWQ & Nationall Grid)" "XXXX"'
echo $?

Re: Special charector in Cluster resouce

Posted: Thu May 30, 2019 12:13 pm
by SteveBeauchemin
Maybe this post will help. The ! character is special too.

https://support.nagios.com/forum/viewto ... 16&t=53995

Steve B

Re: Special charector in Cluster resouce

Posted: Thu May 30, 2019 12:48 pm
by cdienger
@bsivavani, let us know once you've had a chance to test the suggested options.

Re: Special charector in Cluster resouce

Posted: Fri May 31, 2019 4:42 am
by bsivavani
@cdienger - The script is working fine with the other services which doesn't have & symbol.
I tried running the service from command line with nagios user and it is working. The result of echo $? output is 0.
Issue is when we run from Nagios console.

@SteveBeauchemin - We have added & symbol in resource.cfg, but still & symbol is not resolving.

Kindly advice ?

Re: Special charector in Cluster resouce

Posted: Fri May 31, 2019 2:23 pm
by cdienger
I'm not able to reproduce - can you provide a copy of the check_mscs_resource plugin as well as a copy of the nsclient.log after reproducing the problem?

Re: Special charector in Cluster resouce

Posted: Mon Jun 03, 2019 6:27 am
by bsivavani
Please find attached requested files.

Re: Special charector in Cluster resouce

Posted: Mon Jun 03, 2019 2:50 pm
by cdienger
Let's also get the nsclient.ini and a screenshot of the plugin's settings as seen in the CCM.

Re: Special charector in Cluster resouce

Posted: Tue Jun 04, 2019 5:18 am
by bsivavani
Please close the request.

I am able to fix the issue after hard coding the resource name directly in script.

Re: Special charector in Cluster resouce

Posted: Tue Jun 04, 2019 8:01 am
by scottwilkerson
bsivavani wrote:Please close the request.

I am able to fix the issue after hard coding the resource name directly in script.
great!

Locking