Go to All Forums

Allow a single JSON message block to create multiple alerts from a custom plugin

I have been writing custom plugins to monitor log files and report is certain jobs have failed.  I can write a custom plugin to generate a message that might contain 3 job failures that it has detected during the polling interval that would look something like this:

(not real JSON, pseudo JSON):
 
{
msg0: "JOBXXX has failed UUID = xxxxx"
msg1: "JOBYYY has failed UUID = yyyyy"
msg2: "JOBZZZ has failed UUID = zzzzz"
}

 

At present, we get one call raised to our ticketing system though the API call that contains each of the messages in a single case.

Would really like to be able to have an option where each line is parsed separately and generates an individual call to the API that creates cases in our ticketing system.

If each of the three failures needs to go to a different team member, it's difficult to manage when all 3 are recorded on a single case.

Like (1) Reply
Replies (1)

Hi Stephen, 

Please confirm whether you maintain the job status. If so, you can use it to create child data for raising alerts. Below is an example of the JSON format for generating a child tabular view:
 {
 "plugin_version": 1,
 "heartbeat_required": true,
 "job count": 3,
 "Active jobs": 3,
 "Job_Details": [
 {
 "name": "job1",
 "cpu": 13.25,
 "memory": 32767,
 "status": 1
 },
 {
 "name": "job2",
 "cpu": 16.0,
 "memory": 32767,
 "status": 1
 },
 {
 "name": "job3",
 "cpu": 19.25,
 "memory": 32767,
 "status": 0
 }
 ]
}
 
Here Job_Details contains an array inside which the child data is shown. Each json inside the array is considered one child. The name is a required parameter and should contain a string value which is a identifier. It should not change and remain unique. The other metrics should only be numeric and metric names should not contain special characters like space, but "_" is allowed. And status value can be 0(down) or 1(up) to show the child's status.
 
Additionally, at least one or two metrics should be present outside normal numerical or string metrics for plugin registration.

Let us know if this method works for you.

The Site24x7 team.
Like (0) Reply

Was this post helpful?