23 Jan 2024 10:52 AM - last edited on 24 Jan 2024 11:32 AM by Michal_Gebacki
Hi,
Is it possible to get the last updated date for an Alerting Profile or Problems Integration and display it in Dynatrace dashboard?
We need to monitor who and when of the alerting profile modification under a particular management zone in that dashboard
Solved! Go to Solution.
23 Jan 2024 12:07 PM - edited 23 Jan 2024 12:07 PM
Hi,
You can revision history here:
But I think adding that information to a dashboard is not possible.
Best regards
01 Feb 2024 12:43 PM
yes was looking same in Dashboard.
Seems we can have the DT API for this:
https://{environmentid}.live.dynatrace.com/api/v2/settings/objects?schemaIds=builtin%3Aalerting.profile&scopes=environment&fields=modified%2CmodifiedBy&pageSize=500
If not Dashboard, is it possible to use a Workflow and run the API to get that data?
01 Feb 2024 02:16 PM
Hi,
I would say yes since you can execute JavaScript code, you can create your custom script.
Best regards
23 Feb 2024 02:39 PM
I was able to achieve this with a Javascript running in Workflow.
On the first task, I ran a HTTP Request on Settings API to collect all Alerting Profiles data.
Followed by the code to check if there was any Alerting Profiles not edited in last 32 days:
// optional import of sdk modules
import { execution } from '@dynatrace-sdk/automation-utils';
export default async function ({ execution_id }) {
// your code goes here
// e.g. get the current execution
const ex = await execution(execution_id);
const result = await ex.result("http_request_1");
const userList = [];
console.log('Automated script execution on behalf of', ex.trigger);
console.log('Total Configured: ',result.json.totalCount)
const curDate = new Date();
const oldDate = new Date();
oldDate.setDate(oldDate.getDate() - 32);
console.log(curDate.getTime());
console.log(oldDate.getTime());
for (var item of result.json.items){
if(item.modified < oldDate.getTime())
{
console.debug("Old for" + item.value.name +" Author:"+ item.author )
const curData = {"AP Name":item.value.name, "Author":item.author};
userList.push(curData);
}
//console.debug(JSON.stringify(item.value.filters)+" "+JSON.stringify(item.value.filters).length + "<br />");
}
//const userStr = userList.toString();
return JSON.stringify(userList);
}
HTH