I'm currently having difficulties in getting anything out of "Execute SQL Select Query" from a SQL view in sub-procedures.
I'd like to check when the machine was last rebooted - the [ksubscribers].[dbo].[vAgents_AgentStatus] view seems to show this information, but I get nothing whenever I put "vAgents_AgentStatus" in a sub-procedure.
On a similar note - how is everyone debugging/troubleshooting these scripts? There seems to be very little way of discovering why procedure steps are failing... (and by little, I mean even less than with Standard Agent Procedures).
Can you post the actual SQL Query line and I'll have a look tomorrow as some of my appointments seem to have been postponed :-)
I've found it very finicky re being case sensitive , and the online help has the wrong case used in some of the examples
For debugging you should be getting a message in your Info Centre Inbox , but you can also enable Application logging via the System menu
Something like this I presume ?
select reboottime from [ksubscribers].[dbo].[vAgents_AgentStatus] where Expr2 = '[$Machine$]' + '.' + '[$MachineGroup$]'
What I'm currently trying to use is:
SELECT rebootTime from vAgents_AgentStatus WHERE agentGuidStr=[$AgentGuid$]
The column headers are in the case that they appear in the DB.
So, do you think I should be using:
SELECT rebootTime from [ksubscribers].[dbo].[vAgents_AgentStatus] WHERE agentGuidStr=[$AgentGuid$]
This is what worked in the end:
I set the variable "lastReboot" to the results of the following query:
Then, I set the variable "dateDiff" with the results of this query that finds the difference between the date/time of the last reboot, and the date/time the ticket was created:
SET DATEFORMAT dmy; SELECT DATEDIFF(n, '[=lastReboot=]', '[$CreateDateTime$]')
A negative result means that the system has been rebooted more recently than the ticket was created - the "Reboot Required" ticket can therefore be closed.