/build/static/layout/Breadcrumb_cap_w.png

K1000 - running a script only if targets are online

Running your K1-scripts periodically is a great feature for solving different task all over your to do list. If don't want the script engine to start if there is no target pc online & connected to your K1 here is something for you: 
Scenario:
You have a K1-Script which is running periodically to all your Ubuntu devices to check their updates. The script engine should only start if there are Ubuntu devices online & connected to your K1. 

What is the main function?
If you implement this solution the K1 will automatically Enable or Disable the script. The SQL task will have minor impact to the system performance than the script engine testing every device connection.

How?
You need to create two SQL-TicketRules which are running for example every 15 minutes:
11s4y5.png

Enable Rule:
a6OXBQ.png

Please change the highlighted parts with ID's of your environment

Select SQL:

SELECT * FROM (
SELECT COUNT(LABEL.ID)
FROM ((ORG1.MACHINE MACHINE
         INNER JOIN KBSYS.SMMP_CONNECTION SMMP_CONNECTION
            ON (MACHINE.KUID = SMMP_CONNECTION.KUID))
        INNER JOIN ORG1.MACHINE_LABEL_JT MACHINE_LABEL_JT
           ON (MACHINE_LABEL_JT.MACHINE_ID = MACHINE.ID))
       INNER JOIN ORG1.LABEL LABEL ON (LABEL.ID = MACHINE_LABEL_JT.LABEL_ID)
 WHERE (LABEL.ID = **YOURLABELIDHERE**) AND (SMMP_CONNECTION.CLIENT_CONNECTED = 1)
 ) as x
 WHERE `COUNT(LABEL.ID)` = 1

Run update Query:

UPDATE KBOT SET ENABLED = '1' WHERE ID = **YOURSCRIPTIDHERE**

Disable Rule:
9zK3RP.png
Please change the highlighted parts with ID's of your environment

Select SQL:
SELECT * FROM (
SELECT COUNT(LABEL.ID)
  FROM ((ORG1.MACHINE MACHINE
         INNER JOIN KBSYS.SMMP_CONNECTION SMMP_CONNECTION
            ON (MACHINE.KUID = SMMP_CONNECTION.KUID))
        INNER JOIN ORG1.MACHINE_LABEL_JT MACHINE_LABEL_JT
           ON (MACHINE_LABEL_JT.MACHINE_ID = MACHINE.ID))
       INNER JOIN ORG1.LABEL LABEL ON (LABEL.ID = MACHINE_LABEL_JT.LABEL_ID)
 WHERE (LABEL.ID = **YOURLABELIDHERE**) AND (SMMP_CONNECTION.CLIENT_CONNECTED = 1)
 ) as x
 WHERE `COUNT(LABEL.ID)` = 0

Run update Query:

UPDATE KBOT SET ENABLED = '1' WHERE ID = **YOURSCRIPTIDHERE**

**edit** 
Thanks to Steve: If you want it quicker you can create a label only for this if you are using the smartlabel wizard:



Comments

  • You can create a "device connected" smart label and apply it to any script also. I do this for my nightly shut down scripts. - SMal.tmcc 8 years ago
    • That's right. In this case the label is used for other stuff like reporting too and the customer won't create a label for each function. - Timokirch 8 years ago
    • Does that reduce overhead on the K1? - rockhead44 8 years ago
      • i didn't check the performance but i think that (depending on your environment) a single sqlquery will be much faster and reduces the load then triggering a script which will check each target. - Timokirch 8 years ago
This post is locked
 
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