/build/static/layout/Breadcrumb_cap_w.png

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:
Posted by: dugullett 11 years ago
Red Belt
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)

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
      • 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? - rsm11 11 years ago
      • You have an extra space in between "DATE_SUB (NOW()". It should read "DATE_SUB(NOW()". - dugullett 11 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ