I have a check which returns numbers but I would like to format the number to an integer.
I'm not sure what I need to pass to the command to get the right formatting for integer output:
$USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v COUNTER -l "\\Server\\Errors Logon","Since last reboot","logon errors"
Is there documentation somewhere that shows the string formatting options? (%.2f etc)
Can somebody guide me to what I need to change in my check to get the correct formatting of the data output so I get integer output?
Check Output Data Format
Re: Check Output Data Format
If this won't meet your needs you'll need to use another plugin as it requires a floating point per the help section:
COUNTER =
Check any performance counter of Windows NT/2000.
Request a -l parameters with the following syntax:
-l "\\<performance object>\\counter","<description>
The <description> parameter is optional and is given to a printf
output command which requires a float parameter.
If <description> does not include "%%", it is used as a label.
Some examples:
"Paging file usage is %%.2f %%%%"
"%%.f %%%% paging file used."
So really it's a printf formatting thing:
https://alvinalexander.com/programming/ ... heat-sheet
Are you just trying to remove the perdata float value (.000000) or what specifically are you trying to do?
Code: Select all
/usr/local/nagios/libexec/check_nt -H X.X.X.X -s 'secret' -p 12489 -v COUNTER -l "\\Server\\Errors Logon"Check any performance counter of Windows NT/2000.
Request a -l parameters with the following syntax:
-l "\\<performance object>\\counter","<description>
The <description> parameter is optional and is given to a printf
output command which requires a float parameter.
If <description> does not include "%%", it is used as a label.
Some examples:
"Paging file usage is %%.2f %%%%"
"%%.f %%%% paging file used."
So really it's a printf formatting thing:
https://alvinalexander.com/programming/ ... heat-sheet
Are you just trying to remove the perdata float value (.000000) or what specifically are you trying to do?
-
nicholashadaway
- Posts: 31
- Joined: Thu Sep 05, 2019 1:03 pm
Re: Check Output Data Format
That clarifies it nicely. It is printf formatting ...
So, in order to get an integer I use "%d"
Thank you for your guidance.
So, in order to get an integer I use "%d"
Thank you for your guidance.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Check Output Data Format
Correctnicholashadaway wrote:That clarifies it nicely. It is printf formatting ...
So, in order to get an integer I use "%d"
Thank you for your guidance.