Hi,
1775 61 71152 155536 384.50 6936 7 chrome
472 41 303780 339616 297.50 17964 7 Teams
1171 51 154248 163676 271.63 19380 7 Teams
5439 159 326088 492980 206.36 12192 7 OUTLOOK
658 54 52732 71552 153.45 4644 7 atmgr
This is the output for one of our service(top 5 CPU processes). while we are sending email alerts from Nagios, it is not showing additional info in the email body instead it is showing blank space.
command which we are using in Nagios for email alert: notify_service_xi_contact
/usr/bin/php /usr/local/nagiosxi/scripts/contact_notification_handler.php --contactemail="$CONTACTEMAIL$" --subject="** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$ $SERVICEDESC$ is $SERVICESTATE$ **" --message="*****Nagios Monitor XI Alert*****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$"
Please suggest any solution for additional info in email alert.
Thanks in advance.
Additional info in the Email alert
Re: Additional info in the Email alert
Hello @lanxessinfy
Thanks for reaching out, we want to see what the format looks like when you apply the email; please run the following:
To view the results:
Want to see that the format looks correct. Let's take a look at your System Profile too.
To send us your system profile.
Perry
Thanks for reaching out, we want to see what the format looks like when you apply the email; please run the following:
Code: Select all
/usr/bin/php /usr/local/nagiosxi/scripts/contact_notification_handler.php --contactemail="root@localhost" --subject="reportly" --message="*****Nagios Monitor XI Alert*****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$"Code: Select all
cat /var/mail/root | grep -E 'reportly' -A 40 -B 10 --color=always | less -SRTo send us your system profile.
- Login to the Nagios XI GUI using a web browser.
- Click the "Admin" > "System Profile" Menu
- Click the "Download Profile" button
- Save the profile.zip file and share in a private message or upload it to the post/ticket
Perry
-
lanxessinfy
- Posts: 68
- Joined: Tue Nov 24, 2020 5:55 am
Re: Additional info in the Email alert
Hi @Perry,
below is the output:
we are getting blank space in the email body like this for additional information :
For other services it is good : we have one question : is it possible to send below service output(top 5 cpu usage processes) as an attachment through mail alert from nagios ?
1775 61 71152 155536 384.50 6936 7 chrome
472 41 303780 339616 297.50 17964 7 Teams
1171 51 154248 163676 271.63 19380 7 Teams
5439 159 326088 492980 206.36 12192 7 OUTLOOK
658 54 52732 71552 153.45 4644 7 atmgr
Thanks
below is the output:
we are getting blank space in the email body like this for additional information :
For other services it is good : we have one question : is it possible to send below service output(top 5 cpu usage processes) as an attachment through mail alert from nagios ?
1775 61 71152 155536 384.50 6936 7 chrome
472 41 303780 339616 297.50 17964 7 Teams
1171 51 154248 163676 271.63 19380 7 Teams
5439 159 326088 492980 206.36 12192 7 OUTLOOK
658 54 52732 71552 153.45 4644 7 atmgr
Thanks
You do not have the required permissions to view the files attached to this post.
Re: Additional info in the Email alert
Hello @lanxessinfy
There is not a setting to attach files to email within Nagios out of the box, but found an external web source that provided a workaround to using mutt.
Thanks,
Perry
There is not a setting to attach files to email within Nagios out of the box, but found an external web source that provided a workaround to using mutt.
Thanks,
Perry
-
lanxessinfy
- Posts: 68
- Joined: Tue Nov 24, 2020 5:55 am
Re: Additional info in the Email alert
Hi @Perry,
The given link is for reports but we want Nagios service alert as an attachment to email alert.
is it possible to do ?
Thanks
The given link is for reports but we want Nagios service alert as an attachment to email alert.
is it possible to do ?
Thanks
Re: Additional info in the Email alert
Hello @lanxessinfy
You could take that script that sends an email with an attachment, by creating an event handler for the service alert. When the event is triggered it will run the said script.
Thanks,
Perry
You could take that script that sends an email with an attachment, by creating an event handler for the service alert. When the event is triggered it will run the said script.
Thanks,
Perry
-
lanxessinfy
- Posts: 68
- Joined: Tue Nov 24, 2020 5:55 am
Re: Additional info in the Email alert
Hello @Perry,
We are not good with writing script, can you please help us with script ?
Or
Do we need to change output variables(n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$") in the below command so that the entire output message will get in email body under additional info:
/usr/bin/php /usr/local/nagiosxi/scripts/contact_notification_handler.php --contactemail="$CONTACTEMAIL$" --subject="** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$ $SERVICEDESC$ is $SERVICESTATE$ **" --message="*****Nagios Monitor XI Alert*****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$"
output message is like:
1775 61 71152 155536 384.50 6936 7 chrome
472 41 303780 339616 297.50 17964 7 Teams
1171 51 154248 163676 271.63 19380 7 Teams
5439 159 326088 492980 206.36 12192 7 OUTLOOK
658 54 52732 71552 153.45 4644 7 atmgr
Thanks !
We are not good with writing script, can you please help us with script ?
Or
Do we need to change output variables(n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$") in the below command so that the entire output message will get in email body under additional info:
/usr/bin/php /usr/local/nagiosxi/scripts/contact_notification_handler.php --contactemail="$CONTACTEMAIL$" --subject="** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$ $SERVICEDESC$ is $SERVICESTATE$ **" --message="*****Nagios Monitor XI Alert*****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$"
output message is like:
1775 61 71152 155536 384.50 6936 7 chrome
472 41 303780 339616 297.50 17964 7 Teams
1171 51 154248 163676 271.63 19380 7 Teams
5439 159 326088 492980 206.36 12192 7 OUTLOOK
658 54 52732 71552 153.45 4644 7 atmgr
Thanks !
Re: Additional info in the Email alert
I labbed this up and it's working with what you had originally.
Please send me a copy of your profile, you can download it from Admin > System Profile by clicking the Download Profile button.
Is the plugin currently outputting that information? Please run the check command from the command line and send the full output (including the check command) of it so we can see everything that is returned.
Please send me a copy of your profile, you can download it from Admin > System Profile by clicking the Download Profile button.
Is the plugin currently outputting that information? Please run the check command from the command line and send the full output (including the check command) of it so we can see everything that is returned.