- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2015 09:34 AM
Hello, friends!
I'm having a devil of a time trying to figure out how to do the following:
Trigger a (single) notification, ONLY if a (any) MID server is in DOWN state for 6 hours or more.
I figure I can create a notification that triggers when the server state changes and is down, but where to go from there? I've been searching the wiki, but couldn't find anything on how to tell the system to do something like...
Wait for 6 hours...
Then trigger the notification...
Except if the state changes to UP during those 6 hours...
Abort (do not send notification).
Has anyone got any ideas?
Thanks so much for any help you can provide. This has really bent my mind today. 😛
Solved! Go to Solution.
- Labels:
-
Analytics and Reports
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2015 08:27 PM
Hi, there's actually multiple ways of doing this:
There's a script include called MonitorMIDServer. That same script include has a function named: hasRecentActivity the one you could leverage to see if a MID server haven't have any recent activity for the last 6hours
You also have the option to monitor the events "mid_server.down" and event "mid_server.up" and based on the time of those trigger the respective notification.
Here goes the script include function hasRecentActivity that you could leverage as a basline for your code
/*
* Check if the given agent name has written to the ecc_queue more recently than the given time.
* This protects against marking an overloaded (but functioning) mid server as 'down' inappropriately.
*/
hasRecentActivity: function(agentName, time) {
var gr = new GlideRecord('ecc_queue');
gr.addQuery('sys_created_on', '>', time);
gr.addQuery('sys_created_on', '<=', gs.minutesAgo(0));
gr.addQuery('agent', 'mid.server.' + agentName);
gr.addQuery('queue', 'input');
gr.query();
if (gr.hasNext())
return true;
return false;
},
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2015 08:27 PM
Hi, there's actually multiple ways of doing this:
There's a script include called MonitorMIDServer. That same script include has a function named: hasRecentActivity the one you could leverage to see if a MID server haven't have any recent activity for the last 6hours
You also have the option to monitor the events "mid_server.down" and event "mid_server.up" and based on the time of those trigger the respective notification.
Here goes the script include function hasRecentActivity that you could leverage as a basline for your code
/*
* Check if the given agent name has written to the ecc_queue more recently than the given time.
* This protects against marking an overloaded (but functioning) mid server as 'down' inappropriately.
*/
hasRecentActivity: function(agentName, time) {
var gr = new GlideRecord('ecc_queue');
gr.addQuery('sys_created_on', '>', time);
gr.addQuery('sys_created_on', '<=', gs.minutesAgo(0));
gr.addQuery('agent', 'mid.server.' + agentName);
gr.addQuery('queue', 'input');
gr.query();
if (gr.hasNext())
return true;
return false;
},
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2015 09:36 AM
Berny, seriously, this isn't the first time you've correctly answered one of my questions, and you're amazing. Thank you so much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 02:17 PM
Hi,
Can you please give me the steps exactly what you have done to achieve this?
Thanks!
Regards,
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2016 02:22 PM
It's in the reply right above mine.