Cacti / plugin_monitor

Monitor Plugin for Cacti
GNU General Public License v2.0
36 stars 39 forks source link

Monitor plugin - email notification issue #177

Open MSS970 opened 1 month ago

MSS970 commented 1 month ago

Describe the bug Introduction: Monitor plugin sends emails to email lists. if the email list contains multiple email addresses separated by comma, the following bug occurs.

Monitor plugin sends emails to email list (which contains multiple email addresses separated by comma) based on the following cases/events:

  1. Device Reboot Notification Individual emails are generated and sent to each email address separately, the email would look like it has been sent to one email only. This is undesirable behavior because it does NOT: a) Provide the information to the recipients about who receives the email as well. b) Allow automatic assignment of the ITSM incidents when the email is sent to the email list that contains ITSM email address and the support engineer email address, as the email is received by the ITSM without the email address of the support engineer, it is not possible to automatically assign the incident to concerned engineer.

  2. Device Error: device is down One email is generated and sent to all email addresses included in the email list, the email would look like it has been sent to one email only. This is desirable behavior because it will: a) Provide the information to the recipients about who receives the email as well. b) Provide more control when the email is sent to the email list that contains ITSM email address and the support engineer based on which the ITSM automatically categorizes and assigns the incident to required support engineer. c) Unified behavior when sending the email notification

  3. Device Notice: device returned from DOWN state Same behavior and objectives of the above case (point 2)

Expected behavior One email is generated and sent to all email addresses included in the email list, the email would look like it has been sent to one email only. This is desirable behavior because it will: a) Provide the information to the recipients about who receives the email as well. b) Provide more control when the email is sent to the email list that contains ITSM email address and the support engineer based on which the ITSM automatically categorizes and assigns the incident to required support engineer. c) Unified behavior when sending the email notification

Screenshots Attached

Plugin:

Device-Reboot-Notification-Undesired-Behavior Device-Error-Notification-Desired-Behavior Device-Notice-Notification-Desired-Behavior

MSS970 commented 1 month ago

Hello, In addition to the above, I'd like to add the following:

For the 1st case "Device Reboot Notification", the email subject does not contain the name of the device (which is undesired behavior) as opposed to the 2nd and 3rd cases, the device name is shown (which is desired behavior).

Appreciate your continuous support. Regards,

MSS970 commented 1 month ago

Dear Support Team, Can you please look into the above reported issues. Regards, MSS

TheWitness commented 1 month ago

Everyone is pretty busy. Have you attempted a fix yourself? We are glad to accept pull requests.

MSS970 commented 1 month ago

Dear Adam, Please could support by identifying which .php file and file location and I will attempt to resolve it and update you. Much apprecaited. Regards, MSS

MSS970 commented 1 month ago

I mean which .php file is responsible to collect the notification list and which .php is responsible to construct and send the email so that I will review and update.

TheWitness commented 1 month ago

First, in setup.php you will find a settings array. Look at the image below. You should borrow this setting from tholds includes/settings.php and put it in monitor can call is "Send All Notifications as Single Email"

image

Then, grep for "mailer" in the monitor director:

grep -r mailer *

That will tell you where the Emailing is going on.

image

Checkbox values will have either '' or 'on'. If read_config_option('blah') == 'on' that means the setting is checked.

MSS970 commented 1 month ago

Dear Adam, I have completed modification of 2 files (setup.php and poller_monitor.php). The modification adds the option to send notification emails separately or one email to notification lists.

Regards, MSS

MSS970 commented 1 month ago

I have modified these files online using github.dev as well as the though a new pull request.

Let me know if these are good to be published.

You may close this incident.

Appreciate your help and support.

TheWitness commented 1 month ago

If if you could create a pull request will be able to review it. Appreciate your work thank you.

MSS970 commented 1 month ago

I created a pull request and submitted the changes in it.

https://github.com/mohabuhtig/plugin_monitor

Appreciate if you can review it.