Uptime Smart Label Syntax
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?
0 Comments
[ + ] Show comments
Answers (1)
Answer Summary:
Please log in to answer
Posted by:
dugullett
11 years ago
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)
Comments:
-
I'm giving it a try now. So far it seems to be working. - GeekSoldier 11 years ago
-
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)") - rsm11 11 years ago-
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. - GeekSoldier 11 years ago
-
Do you have multiple ORGs? It also looks like you may have an extra ")" on the end. - dugullett 11 years ago