monitoring-plugins icon indicating copy to clipboard operation
monitoring-plugins copied to clipboard

notify-host-mail Doesn't Work (Complains about missing arguments)

Open ctassell opened this issue 2 years ago • 1 comments

This issue respects the following points:

  • [X] This is a bug, not a question or a setup/configuration issue.
  • [X] This issue is not already reported on Github (I've searched it).
  • [X] I use the latest release of the Monitoring Plugins (https://github.com/Linuxfabrik/monitoring-plugins/releases).
  • [X] I agree to follow Monitoring Plugins's Code of Conduct.

Which variant of the Monitoring Plugins do you use?

  • [X] .rpm/.deb package from repo.linuxfabrik.ch
  • [ ] Compiled for Linux (.tar/.zip from download.linuxfabrik.ch)
  • [ ] Compiled for Windows (from download.linuxfabrik.ch)
  • [ ] Source Code from GitHub

Bug description

I'm trying to get the notifications working in Icinga2 (2.14) with Director (1.11) on Ubuntu 22.04 Jammy and plugin is reporting that I'm not sending all of the required arguments. This is when using the Linuxfabrik notification templates and the latest packages from the repos. Note that you can't currently install the linuxfabrik-notification-plugins package with apt because it contains some files that overlap with ones in the monitoring-plugins package, so I had to manually unpack it and move the files into the plugins folder.

Steps to reproduce - Plugin call

'/usr/lib64/nagios/plugins/notify-host-mail' '--hostaddress' '10.1.1.1' '--hostaddress6' '' '--hostdisplayname' 'My Box' '--hostname' 'MYBOX01' '--hostoutput' 'PING 10.1.1.1: 5 packets transmitted, 5 received, 0% packet loss, time 806ms. rtt min/avg/max/mdev = 4.344/4.625/4.953/0.229 ms' '--hoststate' 'UP' '--longdatetime' '2023-11-29 23:23:38 -0400' '--mail-port' '25' '--mail-sender' '[email protected]' '--mail-server' 'localhost' '--notificationauthorname' 'ctassell' '--notificationcomment' '5th' '--notificationtype' 'CUSTOM' '--perfdata' 'transmitted=5;;;0; received=5;;;0; duplicates=0;;;0; checksum_corrupted=0;;;0; errors=0;;;0; packet_loss=0%;;;0;100 time=806ms;;;0; rtt_min=4.344ms;;;0; rtt_avg=4.625ms;;;0; rtt_max=4.953ms;;;0; rtt_mdev=0.229ms;;;0;' '--shortdatetime' '2023-11-29 23:23:38'

Steps to reproduce - Data

You can run this command from the /usr/lib64/nagios/plugins folder and it will give you the error "notify-host-mail: error: the following arguments are required: --datetime, --host-displayname, --host-state, --mail-recipient" The command is what's coming out of the icinga2.log file when using the LinuxFabrik notification templates.

'/usr/lib64/nagios/plugins/notify-host-mail' '--hostaddress' '10.1.1.1' '--hostaddress6' '' '--hostdisplayname' 'My Box' '--hostname' 'MYBOX01' '--hostoutput' 'PING 10.1.1.1: 5 packets transmitted, 5 received, 0% packet loss, time 806ms. rtt min/avg/max/mdev = 4.344/4.625/4.953/0.229 ms' '--hoststate' 'UP' '--longdatetime' '2023-11-29 23:23:38 -0400' '--mail-port' '25' '--mail-sender' '[email protected]' '--mail-server' 'localhost' '--notificationauthorname' 'ctassell' '--notificationcomment' '5th' '--notificationtype' 'CUSTOM' '--perfdata' 'transmitted=5;;;0; received=5;;;0; duplicates=0;;;0; checksum_corrupted=0;;;0; errors=0;;;0; packet_loss=0%;;;0;100 time=806ms;;;0; rtt_min=4.344ms;;;0; rtt_avg=4.625ms;;;0; rtt_max=4.953ms;;;0; rtt_mdev=0.229ms;;;0;' '--shortdatetime' '2023-11-29 23:23:38'

Environment

Ubuntu 22.04 Jammy with the Linuxfabrik PPA deb https://repo.linuxfabrik.ch/monitoring-plugins/ubuntu/ jammy-release main

Plugin Version

v2023051201

Python version

Python 3.10.12

List of Python modules

Modules are fine, command runs, it's just not getting the right args from Icinga

Additional Information

No response

ctassell avatar Nov 30 '23 03:11 ctassell

Hi @ctassell thanks for the issue :) We are aware of the problem when trying to install both the notification and monitoring plugins package, I just opened an issue to track our progress: https://github.com/Linuxfabrik/monitoring-plugins/issues/726

As for the missing arguments, can you make sure that you are using this version of the template in the director? https://github.com/Linuxfabrik/monitoring-plugins/blob/2023051201/notification-plugins/notify-host-mail/icingaweb2-module-director/notify-host-mail.json

Also, did you set a mail recipient in the notification apply rule?

NavidSassan avatar Dec 01 '23 10:12 NavidSassan