Windows top Resource - Using Eventhandler - Notification

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
inas.labib
Posts: 170
Joined: Tue Sep 11, 2012 3:48 am

Windows top Resource - Using Eventhandler - Notification

Post by inas.labib »

Hi ,

We need to get the Top CPU and Memory consuming processes of Windows servers whenever the memory or cpu crosses the threshold level.
We have created Powershell script and added that with event handler. This works fine whenever the service gets into "Critical" and it sends us separate mail notification with the top resource details .
But we need to have the output of powershell script in the main nagios xi alert notification itself. Kindly assist.

Eventhandler script :

#!/bin/bash
SERVICEDISPLAYNAME=$2
SERVICESTATE=$3
SERVICESTATETYPE=$4
HOSTNAME=$5
DATE=$6
TIME=$7
SERVICENOTES=$8
SERVICEPERFDATA=$9

if [[ "$SERVICESTATE" == "CRITICAL" && "$SERVICESTATETYPE" == HARD ]]; then
/usr/local/nagios/libexec/check_nrpe -H $HOSTNAME -t 120 -p 5666 -c check_top >> /tmp/.event_handler_test_output.txt
mail -s event_handler_output_test [email protected] < /tmp/.event_handler_test_output.txt
exit 0
else
exit 0
fi



Powershell script :

check_top

Eventhandler command :

Name : event_handler_test
Command line : $USER1$/event_handler_test.sh $SERVICEDISPLAYNAME$ $SERVICESTATE$ $SERVICESTATETYPE$ $HOSTNAME$ $DATE$ $TIME$ $SERVICENOTES$ $SERVICEPERFDATA$
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Windows top Resource - Using Eventhandler - Notification

Post by Box293 »

inas.labib wrote:But we need to have the output of powershell script in the main nagios xi alert notification itself. Kindly assist.
That's not possible, the alert uses the information from the service status. The event handler is an additional process that is separate to the notification process.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked