I've had a mssql query check running for the last two years without any issue. I updated the plugin this week (version 0.8.0) and since then it stopped working.
Here is the check
Code: Select all
./check_mssql -H somehost --username someusername --password "somepassword" --database Ctrack6 --port 1433 --query "IF+%28select+count%28distinct%28NodePropertyValue%29%29+FROM+LastMobilePositions+WITH+%28nolock%29+LEFT+OUTER+JOIN+NodePropertyValues+ON+LastMobilePositions.MobileNodeId+%3D+NodePropertyValues.NodeId+where+nodepropertyvalues.NodePropertyId%3D2+and+ReceivedTime+%3C+dateadd%28hh%2C-1%2Cgetdate%28%29%29+and+NodePropertyValue+not+like+%27%25old%25%27+and+NodePropertyValue+not+like+%27%25deinstalled%25%27+and+NodePropertyValue+not+like+%27%25de+installed%25%27%29+%3E+200+select+%27good%27%3B+ELSE+SELECT+%27bad%27%3B" --result "good" --decode --result good
Code: Select all
IF (select count(distinct(NodePropertyValue)) FROM LastMobilePositions WITH (nolock)
LEFT OUTER JOIN NodePropertyValues ON LastMobilePositions.MobileNodeId = NodePropertyValues.NodeId
where nodepropertyvalues.NodePropertyId=2 and ReceivedTime < dateadd(hh,-1,getdate())
and NodePropertyValue not like '%old%' and NodePropertyValue not like '%deinstalled%' and NodePropertyValue
not like '%de installed%') > 200 select 'good'; ELSE SELECT 'bad';Code: Select all
CRITICAL: Query expected "good" but got ""But if you run it from the commandline you get
Code: Select all
PHP Notice: Undefined variable: column_name in /usr/local/nagios/libexec/check_mssqlbackup on line 475
PHP Notice: Undefined variable: query_result in /usr/local/nagios/libexec/check_mssqlbackup on line 475
PHP Notice: Undefined variable: query_result in /usr/local/nagios/libexec/check_mssqlbackup on line 511
PHP Notice: Undefined variable: query_result in /usr/local/nagios/libexec/check_mssqlbackup on line 516
CRITICAL: Query expected "good" but got "".|query_duration=0.012408s;; ''=;Code: Select all
OK: Query results matched "good", query duration=0.017745 seconds.|query_duration=0.017745s;;