I'm trying to create a smart label to capture any workstation, non-server, that has an uptime of over 24 hours. This smart label will feed into a script that will reboot them overnight to apply patches, software, and etc. The problem is that the Uptime portion of the smart label doesn't seem to take any of the values I try to put in... Ideas?

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

0

Will this work for you? If not paste your current label and I'll modify it.

select MACHINE.*, C.CLIENT_CONNECTED, UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_TIME,

UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_SECONDS

from ORG1.MACHINE

LEFT JOIN KBSYS.KUID_ORGANIZATION O ON O.KUID=MACHINE.KUID LEFT JOIN KBSYS.SMMP_CONNECTION C ON C.KUID = MACHINE.KUID AND O.ORGANIZATION_ID = 1

where (  MACHINE.OS_NAME NOT like 'SERVER') AND MACHINE.LAST_REBOOT < DATE_SUB(NOW(), INTERVAL 24 HOUR)
Answered 03/14/2013 by: dugullett
Red Belt

  • I'm giving it a try now. So far it seems to be working.
  • When I tried that I get the following error:

    mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 9] in EXECUTE( "select MACHINE.*, C.CLIENT_CONNECTED, UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_TIME, UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_SECONDS from ORG1.MACHINE LEFT JOIN KBSYS.KUID_ORGANIZATION O ON O.KUID=MACHINE.KUID LEFT JOIN KBSYS.SMMP_CONNECTION C ON C.KUID = MACHINE.KUID AND O.ORGANIZATION_ID = 1 where ( MACHINE.OS_NAME NOT like 'SERVER') AND MACHINE.LAST_REBOOT < DATE_SUB (NOW(), INTERVAL 24 HOUR)")
    • If you're running 5.5 you may want to watch out for new syntax. With the new label functionality there may be some changes. If it isn't in the documentation contact support to make sure it hasn't changed.
    • Do you have multiple ORGs? It also looks like you may have an extra ")" on the end.
      • No we only have one org. When I check the SQL query in the label it doesn't have the extra ). I'm thinking that has something to do with the error itself maybe?
      • You have an extra space in between "DATE_SUB (NOW()". It should read "DATE_SUB(NOW()".
Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share