Original Message:
Sent: Aug 05, 2024 06:43 AM
From: Aditya Simha S
Subject: Script for listing out jobs which are created but not used anymore
Hi Jared,
From the above query we are not able fetch data, we are getting error in the "convert" statement for the above query but once the convert statement is removed we are able to run the query. The error is "missing parenthesis" and also can you please modify the query to get owner details, host details(under which agent job is running) and region details.
Thanks
Original Message:
Sent: Jul 16, 2024 11:22 AM
From: Jared Kessans
Subject: Script for listing out jobs which are created but not used anymore
This query might be a good starting point for what you are requesting.
select OH_Client as "Client", OH_NAME as "Name", OH_Otype as "Object Type", convert(datetime, OH_CRDATE AT TIME ZONE 'UTC' AT TIME ZONE 'Eastern Standard Time') as "Object Creation Date",convert(datetime, OH_MODDATE AT TIME ZONE 'UTC' AT TIME ZONE 'Eastern Standard Time') as "Last Modification Date",isnull(CONVERT(VARCHAR(19),max(convert(datetime, AH_1.AH_TIMESTAMP1 AT TIME ZONE 'UTC' AT TIME ZONE 'Eastern Standard Time'))),CAST('No statistics' as CHAR)) "Last Execution Date"from OHleft outer join AH as AH_1 on OH.OH_IDNR = AH_1.AH_OH_IDNRwhere OH_DELETEFLAG = 0and OH_REFIDNR = 0and OH_CLIENT = 10--and (OH_Name like 'PROD%' or OH_Name like 'TEST%')and OH_OTYPE in ('CALL','EVNT','JOBF','JOBG','JOBS','JSCH','SCRI','JOBP')-- the GROUP BY for the output of the last activation in the resultsetgroup by OH_Client, OH_NAME, OH_Otype, OH_CRDATE, OH_MODDATE-- sort by activation timehaving max(AH_1.AH_TIMESTAMP1) < DATEADD(dd,-180,GETDATE()) or max(AH_1.AH_TIMESTAMP1) is nullorder by oh_name, max(AH_1.AH_TIMESTAMP1), OH_CRDATE
Original Message:
Sent: Jul 10, 2024 04:29 AM
From: Abhishek Nayak
Subject: Script for listing out jobs which are created but not used anymore
Hi Team,
I'm looking for a script that can extract job information from different clients. Specifically, I need details such as the client number, object name, type, creation date, and last usage date. For example, I want to filter jobs that were created approximately a year ago but haven't been used in the last 6 months. The output should include the job names along with the other specified details.
Is it possible to create and run such a script in Automic? for your understanding, I've set the time interval for job creation as 1 year from today's date and the last usage interval as 6 months from today.
If anyone knows of this, could you please provide me with the script?
Thank you,
Abhishek
192.168.100.1 192.168.1.1