This post describes the use of a python script to analyze the nature of the requests and alarms the technicians about frequently raised requests' category, and sub-category. This may help the technicians to proactively start their investigation in finding the underlying root cause, and take necessary precautionary measures to ensure that others are not affected further.
This script works with the 'custom schedules' feature released in ServiceDesk Plus version 9300.You can find more information about what custom schedules are in the link
here.
UseCase: A query is used to get the list of requests created from a specific category , sub-category and item.When the script triggers, it will invoke the report and fetch the category, subcategory, and item of the requests raised and email the details to the configured email address.
Execution steps:
1. Go to Reports--> New Query Report and run the below query and save this report with the name "Requests by Category" under any of the available report folders.
For MSSQL database:
select top 1 cd.categoryname 'category', scd.name 'subcategory', i.name 'item', count(wo.workorderid) 'count' from workorder wo left join workorderstates wos on wo.workorderid=wos.workorderid left join categorydefinition cd on wos.categoryid=cd.categoryid left join subcategorydefinition scd on wos.subcategoryid=scd.subcategoryid left join itemdefinition i on wos.itemid=i.itemid where wo.createdtime >= <from_today> and wo.createdtime <= <to_today> and wo.IS_CATALOG_TEMPLATE='0' group by cd.categoryname, scd.name, i.name order by 4 desc
For PgSQL database:
select cd.categoryname "category", scd.name "subcategory", i.name "item", count(wo.workorderid) "count" from workorder wo left join workorderstates wos on wo.workorderid=wos.workorderid left join categorydefinition cd on wos.categoryid=cd.categoryid left join subcategorydefinition scd on wos.subcategoryid=scd.subcategoryid left join itemdefinition i on wos.itemid=i.itemid where wo.createdtime >= <from_today> and wo.createdtime <= <to_today> and wo.IS_CATALOG_TEMPLATE='0' group by cd.categoryname, scd.name, i.name order by 4 desc limit 1
2. Download and place the script file in the ManageEngine/ServiceDesk/integration/custom_scripts folder.
3. Edit the scheduleNotify.py file and update your SMTP server details, mail server name, username and password.
4. Go to Admin--> Custom Schedules and set up the schedule as shown below.
Here's a sample of the email which the user will receive.
So do you still think firefighting IT issues going to help your IT? We are open to your suggestions or requirements for similar intelligent notifications that will yield great values to your IT team.
A short guide on setting up python is available
here.