Change computed0 to Custom Value

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
johnwcos
Posts: 3
Joined: Mon Mar 18, 2019 4:46 pm

Change computed0 to Custom Value

Post by johnwcos »

Hi All,

I am using the mssql plugin to generate a database query to return a single value, it is working fine. I would like to know how to customise the returned field name so it does not display as computed0 - which does not mean much. Can it be changed to a custom value such as "# Widgets" ?

/usr/local/nagios/libexec/check_mssql -H 192.168.0.226 --username "x" --password "y" --database COSDB --port 1433 --query "Select x from dbo.table" --result "Expected Result" --decode --warning 100000 --critical 250000 --querywarning 100000 --querycritical 250000 --result "Expected Result"
OK: Query duration=1.508998 seconds. Query result=68256|query_duration=1.508998s;100000;250000 'computed0'=68256;100000;250000
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Change computed0 to Custom Value

Post by lmiltchev »

If you changed the column name, it *should* work. Looking at the plugin, it seems like it is grabbing the column name from the query you are running so if you use 'AS' in the mssql query (SELECT x AS columname) and the column header changes it should change the name of computed0.

Example:

Code: Select all

/usr/local/nagios/libexec/check_mssql -H 192.168.0.226 --username "x" --password "y" --database COSDB --port 1433 --query "SELECT COUNT(*) AS '# Widgets' FROM dbo.table" -result "Expected Result" --decode --warning 100000 --critical 250000 --querywarning 100000 --querycritical 250000 --result "Expected Result"
Be sure to check out our Knowledgebase for helpful articles and solutions!
johnwcos
Posts: 3
Joined: Mon Mar 18, 2019 4:46 pm

Re: Change computed0 to Custom Value

Post by johnwcos »

Perfect, Thanks for the info - SImple.


John
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Change computed0 to Custom Value

Post by scottwilkerson »

johnwcos wrote:Perfect, Thanks for the info - SImple.


John
Glad to help.

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked