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
Change computed0 to Custom Value
Re: Change computed0 to Custom Value
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:
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!
Re: Change computed0 to Custom Value
Perfect, Thanks for the info - SImple.
John
John
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Change computed0 to Custom Value
Glad to help.johnwcos wrote:Perfect, Thanks for the info - SImple.
John
Locking thread