Script auditing: I want to find out which K1000 scripts are no longer being used
We have over 400 scripts in our K1000, and I would like to be able to run an audit of some sort to determine which scripts are no longer being used so I can remove them. I found in Settings > History > Reporting > Objects than I can perform an advanced search for "Run Now" to get a list of scripts that have been run but I think the results only show those that were manually run, not scheduled. Without having to open each script individually, how can I find out which scripts are also scheduled to run automatically?
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
chucksteel
8 years ago
I came up with this query:
SELECT KBOT.ID, KBOT.NAME, KBOT.MODIFIED, MAX(LOG.TIMESTAMP) as "Latest Start",
CONCAT_WS(" ", CRON.MINUTES, CRON.HOURS, CRON.DAYS_OF_MONTH, CRON.MONTHS, CRON.DAYS_OF_WEEK) as "Cron Schedule",
GROUP_CONCAT(MACHINE.NAME) as "Machines"
FROM KBOT
LEFT JOIN KBOT_LOG_LATEST LOG on LOG.KBOT_ID = KBOT.ID
LEFT JOIN KBOT_CRON_SCHEDULE CRON on CRON.KBOT_ID = KBOT.ID
LEFT JOIN MACHINE on MACHINE.ID = LOG.MACHINE_ID
GROUP BY KBOT.ID
This should return the following information for every script:
ID
Name
Last Modified Date
Latest start time according to the KBOT_LOG_LATEST table
Cron Schedule (if there is one)
The machines the script has run on according to the KBOT_LOG_LATEST table.
Comments:
-
Thanks but I'm not a SQL/database guy. Where do I run this query at? - kcorrie 8 years ago
-
Reporting, Choose Action, New (SQL). Paste the query into the SQL box and fill out the other fields as necessary. After saving the report it will be available to run in the list of reports. - chucksteel 8 years ago
-
this worked out great, I just started as an IT intern on friday and just started working with the KACE box - JimmySparrow 7 years ago
-
Welcome to the community! - chucksteel 7 years ago
-
Did the trick for me, thank you! - dragonfligh 6 years ago