Linuxfabrik / monitoring-plugins

220+ check plugins for Icinga and other Nagios-compatible monitoring applications. Each plugin is a standalone command line tool (written in Python) that provides a specific type of check.
https://linuxfabrik.ch
The Unlicense
220 stars 51 forks source link

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

Open ctassell opened 12 months ago

ctassell commented 12 months ago

This issue respects the following points:

Which variant of the Monitoring Plugins do you use?

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' 'nagios@myhost.com' '--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' 'nagios@myhost.com' '--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

NavidSassan commented 12 months ago

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?