Sending an email alert in the plugin

Hello,
I made a plugin to monitor resource like CPU and MEMORY usage on two of our servers, the plugin check if there is a high CPU or MEMORY usage and if it is the script is gonna display a WARNING or CRITICAL in icingaweb2 and in addition send an email (using sendmail )to the specific user to kill the process, when i execute the script manually with any user i see the WARNING or CRITICAL message and i get the email notification to kill the process, but when i integrate the plugin to icinga2 i see only the WARNING or CRITICAL message in icingaweb2 but no email is send, i tried to execute the plugin as root in icinga2 but it’s doesn’t change anything.

Can someone help please !

Thanks,

the environment of the icinga2 user is restricted. try it with running the script as the icinga2 user.

I would rather try to use Icinga’s way of notification for sending the e-mail. I think you could build a notification script that parses the detail output and use this information for determining which user to send to.

This way you have far more information about who was notified about what and if it worked out the way you wanted it.

2 Likes

Hi and thank you al for the replies,

I used a script running every 5 seconds calling the icinga2 plugins.

Regards,