Overview
Since 4.1 the KBOX has had a server-driven queue of tasks. We call this "Konductor". At any time you can track the status of all tasks for all machines on the troubleshooting page. You can find this at Settings\Support-->Troubleshooting tools-->Agent tasks -- if you have a 1200 start under the System Organization. The URL is at
http://kbox/systemui/konductor_tasks.php. The interpretation of the tasks is left as an exercise to you but the common tasks types are:
| task type |
description |
| inventory |
agent is checking in and doing an inventory |
| script update |
agent is updating it's scripts from KBOX |
| krash upload |
agent is uploading logs after any event |
| bootstrap |
newly provisioned machine is initializing |
| patch-ORGX-Y«Patch schedule #Y is running under ORGX* |
| kbot-ORGX-Z |
kbot (or script) #Z is running under ORGX* |
*on an 1100 Z will always be 1
Sometimes you will want the KBOX to alert you when certain tasks are running on the KBOX, particulary when they are running at an inappropriate time. This allows you as an administrator to take action on those items: to terminate the undesirable task; to giver you time to prevent it from happening again.
Our Example
For our purposes let's say that we have a shutdown script (that is an online kscript) that you deploy nightly as part of a power-savings effort. We are going to construct an alert that will notify you of an incomplete shutdown tasks that started at midnight and is still running at 7am in the morning. This will allow us to prevent any machines that may come online after 7am to remain up. In our example the name of the task must be
shutdown all machines.
For example, let's say that we have a shutdown script (ie kbot) that you want to run after hours and ONLY after hours. More specifically you have a script start at midnight every day. Konductor may not start that task right at midnight, but it will add that task to the list of tasks and try to process all outstanding tasks as quickly as possible. If you have:
- a box that is "too busy" to get through all outstandings tasks
- scheduled too many things
- scheduled a particularly complex or large task (e.g. deploy office 2007 to many machines)
- a problem on your kbox
- too many machines for your kbox
- too agressive a check-in interval
- other
It is possible that the shutdown task will not complete on all machines because of the reasons list above -- however, you do not want that task to run past 6am the following morning. I would still recommend creating logic in your shutdown scripts (or other tasks) that will prevent them from running at undesirable times.
The Alert
The built-in email alerts can report information about machines to you but will be triggered whenever a PC checks in to the KBOX -- which may not be the correct timing to suit your needs.
We could set up an alert to monitor that task. The two things we will use to do this are:
- SQL Query describing what you want to report on
- A ticket rule to schedule it
To modify the query requires some knowledge of the database schema. You can consult technical support for this or you can download the .schema files here and the MySQL query browser here
In our example the query looks like this:
SELECT
TYPE AS TASK,
K.STARTED TASK_START,
MACHINE.* ,
UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_TIME,
UNIX_TIMESTAMP(MACHINE.LAST_SYNC) as LAST_SYNC_SECONDS
FROM
MACHINE
JOIN KBSYS.KONDUCTOR_TASK K ON K.KUID=MACHINE.KUID
JOIN KBOT ON K.TYPE= CONCAT('kbot-org1-',KBOT.ID) and KBOT.NAME like '%shutdown all machines%'
WHERE
COMPLETED = '0000-00-00 00:00:00' /* this means incomplete and currently running*/
and TYPE LIKE '%kbot%' /* this means script */
and TIME(NOW())> '07:00:00' and HOUR(NOW())<18 /* this is the time of day I want the query to check */
To set this up in a ticket rule you create a new rule with the following items
| item |
content |
| Title |
This will be the subject that you want to appear in the email |
| Order |
Is not relevant in this case. 900 is fine |
| Notes |
This will be the first text that is displayed in the body of the email |
| Frequency |
This will be when the rule is run. You could set it to run at a specific time (e.g. Daily at 7am) or on a frequency. I suggest running it every 15 minutes and specifying a time for detection in the query -- see query above |
| Query |
See above (note: the view search results link will not work for this query ) |
| Email results to someone |
put in your email address |
| Results are tickets, add a comment to each one |
off |
| Send an email for each result row |
empty |
| Run an update query, using the results from the one above |
off |
Feel free to test this ticket rule with the run now button.
This rule will run every 15 minutes, but because of the this line and TIME(NOW())> '07:00:00' and HOUR(NOW())<18 the query will only return results and trigger an email within the time frame of 7:01 am and 5:59pm.
Take Action
All current tasks are listed at:
http://kbox/systemui/konductor_tasks.php?STATUS=CURRENT
In 4.3 you will be ble to delete tasks from the queue so you can use the results above to clear tasks that you do not want to run anymore. However, the root cause of the task running at an inappropriate time probably still exists and needs to be addressed.
In 4.1 / 4.2 or lower you will have to call technical support to terminate tasks.