Page 1 of 1

Set stopped services as a WARNING

Posted: Tue Dec 19, 2017 12:58 pm
by moweryd
I have a specific service that I would like to report as a warning when stopped, rather than critical. Based on some research, it looked like I was not able to achieve this using check_nt. I'm trying check_nrpe with the following command:

Code: Select all

check_nrpe -H $HOSTADDRESS$ -t 30 -c check_service -a 'service=xagt' "warn=state = 'stopped'" crit=none'
The output returned is 'OUTPUT: Failed to validate filter see log for details'.

Any thoughts?

Re: Set stopped services as a WARNING

Posted: Tue Dec 19, 2017 1:08 pm
by dwhitfield
What version of NSClient are you running? It looks like it might be related to https://github.com/mickem/nscp/issues/130

Spoiler Alert: if you are hitting this bug, then upgrading to .4.4 should resolve it.

Can you post the nsclient.log for review?

Re: Set stopped services as a WARNING

Posted: Tue Dec 19, 2017 1:16 pm
by moweryd
Thanks for the quick reply. I'm running 0.4.3.141. Log file attached.

Re: Set stopped services as a WARNING

Posted: Tue Dec 19, 2017 1:31 pm
by dwhitfield
What timezone are you in? I just want to understand this log file better.

You may need to allow nasty_meta_characters in your nsclient.ini. Can you post that for review? If you make the change, make sure you restart NSClient after doing so.

Also, I would suggest upgrading to .4.4: http://www.nsclient.org/download/0.4.4/#0.4.4.23

Re: Set stopped services as a WARNING

Posted: Tue Dec 19, 2017 1:38 pm
by moweryd
I am US eastern. I believe I've added an exception for nasty_meta_characters. I've upgraded to 0.4.4.23 and I'm receiving the same error. .ini file attached.

Re: Set stopped services as a WARNING

Posted: Tue Dec 19, 2017 2:14 pm
by npolovenko
@moweryd, Can you find the following section:

Code: Select all

[/settings/NRPE/server]

allow nasty characters=true

allow arguments=1]
And replace it with:

Code: Select all

insecure = true
allow arguments = true
allow nasty characters = true
After that, you'll need to restart the NSClient service.

Also, your command:

Code: Select all

check_nrpe -H $HOSTADDRESS$ -t 30 -c check_service -a 'service=xagt' "warn=state = 'stopped'" crit=none'
Is missing an opening single qoute before crit. So the command should look like this:

Code: Select all

check_nrpe -H $HOSTADDRESS$ -t 30 -c check_service -a 'service=xagt' "warn=state = 'stopped'" 'crit=none'

Re: Set stopped services as a WARNING

Posted: Thu Dec 21, 2017 10:24 am
by moweryd
I made the change to the ini file and restarted the service. I made the adjustment to the check as you indicated but I'm having issues. Do I need to add in an ARG4 and split up the code for ARG3?

Re: Set stopped services as a WARNING

Posted: Thu Dec 21, 2017 11:41 am
by npolovenko
@moweryd, NRPE has always had problems recognizing quotes within quotes. A quick way around your problem would be to create a new command in CCM. If you define the command as on my screenshot you'd just pass the check name in ARG1 and a service name in ARG2.
example.png
Let me know if you think that would work for you.

Re: Set stopped services as a WARNING

Posted: Fri Dec 22, 2017 9:40 am
by moweryd
Thank you for the help! That did the trick. I'll create new commands like this for any future checks like this.

Re: Set stopped services as a WARNING

Posted: Fri Dec 22, 2017 10:05 am
by npolovenko
@moweryd, Not a problem!