Page 1 of 1
check_nt with special character (#)
Posted: Tue Nov 15, 2016 4:07 am
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
Re: check_nt with special character (#)
Posted: Tue Nov 15, 2016 11:30 am
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.
Re: check_nt with special character (#)
Posted: Wed Nov 16, 2016 9:05 am
by dicenl
Ok tnx!! I will try as you suggested. Sounds good!
Re: check_nt with special character (#)
Posted: Wed Nov 16, 2016 10:05 am
by tgriep
Let us know how it works out for you.
Re: check_nt with special character (#)
Posted: Wed May 24, 2017 2:43 am
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
Re: check_nt with special character (#)
Posted: Wed May 24, 2017 3:28 am
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

Re: check_nt with special character (#)
Posted: Wed May 24, 2017 3:53 am
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.
Re: check_nt with special character (#)
Posted: Wed May 24, 2017 9:44 am
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?
Re: check_nt with special character (#)
Posted: Tue May 30, 2017 7:49 am
by dicenl
Yes, it can be marked as solved! Works like a charm now.