check_nt with special character (#)

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dicenl
Posts: 15
Joined: Fri Mar 18, 2016 7:13 am

check_nt with special character (#)

Post by dicenl »

We are using check_nt to check Dynamics active sessions and open connections. But the problem is that microsoft decided that it was a good idea to use # in the performance counter names. Is there a way i can escape these # characters? When i use the check on the command line it returns a valid number, but when i confiugre it in nagios xi i get a 0

$USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v COUNTER -l "\\Microsoft Dynamics NAV(nst90test)\# Active sessions
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_nt with special character (#)

Post by tgriep »

One thing to try is to use single quotes around the counter name and remove any escaping so when Nagios runs the check, it will use literal value between the single quotes without it trying to escape it further and that should work for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dicenl
Posts: 15
Joined: Fri Mar 18, 2016 7:13 am

Re: check_nt with special character (#)

Post by dicenl »

Ok tnx!! I will try as you suggested. Sounds good!
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_nt with special character (#)

Post by tgriep »

Let us know how it works out for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dicenl
Posts: 15
Joined: Fri Mar 18, 2016 7:13 am

Re: check_nt with special character (#)

Post by dicenl »

sorry for the extreme late reply but the customer i have to fix this for didnt invite me back until now.

I just tried again. The single quote works, but only if i create a custom check for the command. So i create a command with the following line:

$USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v COUNTER -l '\Microsoft Dynamics NAV(nst90testmobosp)\# Active sessions'

When i do a test command from within the webinterface, i get a result of 7 with is correct. But when i let nagios check it for itself like a normal check it returns 0.

EDIT:
By the way, when i execute the command from the command line it also returns the correct value
dicenl
Posts: 15
Joined: Fri Mar 18, 2016 7:13 am

Re: check_nt with special character (#)

Post by dicenl »

Hold on. Just updated Nagios XI to the latest version. Restarted the check, and i now have a correct value. I will check if al is working now and report back :D
dicenl
Posts: 15
Joined: Fri Mar 18, 2016 7:13 am

Re: check_nt with special character (#)

Post by dicenl »

The update to 5.4.4 (from 5.2) fixed this issue. I have now working commands in Nagios XI. The command now just contains:

$USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v COUNTER -l $ARG1$

And $ARG1$ =
'\Microsoft Dynamics NAV(nst90testmobspa)\# Active sessions'

And it doesnt seem to matter if you use single or dubble quotes.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_nt with special character (#)

Post by tgriep »

There was a bug fix in XI 5.4.3 for the Test Check button so that probably solved your issue.
If you don't have any other questions, shall I close and mark the post as solved?
Be sure to check out our Knowledgebase for helpful articles and solutions!
dicenl
Posts: 15
Joined: Fri Mar 18, 2016 7:13 am

Re: check_nt with special character (#)

Post by dicenl »

Yes, it can be marked as solved! Works like a charm now.
Locked