diff --git a/LibreNMS/IRCBot.php b/LibreNMS/IRCBot.php index dacd06caf1..cd33d773b0 100644 --- a/LibreNMS/IRCBot.php +++ b/LibreNMS/IRCBot.php @@ -259,11 +259,13 @@ class IRCBot if ($this->config['irc_alert_chan']) { foreach ($this->config['irc_alert_chan'] as $chan) { $this->ircRaw('PRIVMSG '.$chan.' :'.$severity.trim($alert['title'])); - foreach (explode("\n", $alert['msg']) as $line) { - // We don't need to repeat the title - $line = strip_tags($line); - if (trim($line) != trim($alert['title'])) { - $this->ircRaw('PRIVMSG '.$chan.' :'.$line); + if (!$this->config['irc_alert_short']) { // Only send the title if set to short + foreach (explode("\n", $alert['msg']) as $line) { + // We don't need to repeat the title + $line = strip_tags($line); + if (trim($line) != trim($alert['title'])) { + $this->ircRaw('PRIVMSG '.$chan.' :'.$line); + } } } } @@ -271,11 +273,13 @@ class IRCBot foreach ($this->authd as $nick => $data) { if ($data['expire'] >= time()) { $this->ircRaw('PRIVMSG '.$nick.' :'.$severity.trim($alert['title'])); - foreach (explode("\n", $alert['msg']) as $line) { - // We don't need to repeat the title - $line = strip_tags($line); - if (trim($line) != trim($alert['title'])) { - $this->ircRaw('PRIVMSG '.$nick.' :'.$line); + if (!$this->config['irc_alert_short']) { // Only send the title if set to short + foreach (explode("\n", $alert['msg']) as $line) { + // We don't need to repeat the title + $line = strip_tags($line); + if (trim($line) != trim($alert['title'])) { + $this->ircRaw('PRIVMSG '.$nick.' :'.$line); + } } } } diff --git a/doc/Extensions/IRC-Bot.md b/doc/Extensions/IRC-Bot.md index c437f2d47b..36d6172ca2 100644 --- a/doc/Extensions/IRC-Bot.md +++ b/doc/Extensions/IRC-Bot.md @@ -19,6 +19,7 @@ Option | Default-Value | Notes `$config['irc_alert']` | `false` | Optional; Enables Alerting-Socket. `EXPERIMENTAL` `$config['irc_alert_chan']` | `false` | Optional; Multiple channels can be defined as Array or delimited with `,`. `EXPERIMENTAL` `$config['irc_alert_utf8']` | `false` | Optional; Enables use of strikethrough in alerts via UTF-8 encoded characters. Might cause trouble for some clients. +`$config['irc_alert_short']` | `false` | Optional; Send a one line alert summary instead of multi-line detailed alert. `$config['irc_authtime']` | `3` | Optional; Defines how long in Hours an auth-session is valid. `$config['irc_chan']` | `##librenms` | Optional; Multiple channels can be defined as Array or delimited with `,`. Passwords are defined after a `space-character`. `$config['irc_debug']` | `false` | Optional; Enables debug output (Wall of text) diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 50a2906975..36dfb58eb8 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -599,6 +599,7 @@ $config['irc_authtime'] = 3; $config['irc_debug'] = false; $config['irc_alert'] = false; $config['irc_alert_utf8'] = false; +$config['irc_alert_short'] = false; $config['irc_ctcp'] = false; $config['irc_ctcp_version'] = "LibreNMS IRCbot. https://www.librenms.org/";