IRC Notification difficulties

Hi everyone, I’m having difficulty getting notification to work via the IRC Bot. I have successfully authenticated and joined the bot to the IRC channel, and can query status and receive results correctly.

However, when I test IRC notifications or trigger an alert, I don’t receive anything from the bot.

Here is my config:

Enable IRC

$config[‘alert’][‘transports’][‘irc’] = true;
$config[‘irc_alert_chan’] = ‘#operators’;
$config[‘irc_debug’] = true;
$config[‘irc_host’] = “irc.company.com”;
$config[‘irc_port’] = “+7001”;
$config[‘irc_chan’] = “#operators password”;
$config[‘irc_pass’] = “ircpassword”;
$config[‘irc_auth’][‘admin’][] = “usernic1*”;
$config[‘irc_auth’][‘admin’][] = “usernic2*”;
$config[‘irc_auth’][‘admin’][] = “usernic3*”;

Can anyone suggest what I might be missing here?

thanks!

Did you enable the IRC Alert transport? Under global settings -> Alerting Settings

Yes, I did. When I click the Test Transport button in that section it goes from blue to red for a few seconds then back to blue, but nothing appears in the channel from the bot.

I see in log: 451 web 2017-06-09 23:11:01 Could not issue critical alert for rule ‘’ to
transport ‘irc’ NULL

Here’s a working example for us (latest stable release rather than master):

$config['irc_chan'][] = '#networks';
$config['irc_chan'][] = '#netalerts';
$config['irc_alert_chan'] = '#netalerts';
$config['irc_authtime'] = 666;
$config['irc_host'] = 'HOST';
$config['irc_nick'] = 'NICK';
$config['irc_pass'] = 'PASS';
$config['irc_port'] = '+8443';
$config['alert']['transports']['irc'] = true;
$config['irc_debug'] = false;
$config['irc_alert'] = true;

Thanks laf - tried your configuration. Still getting error message “Could not issue critical alert for rule ‘’ to transport ‘irc’”. I think I might be missing something else somewhere.

Does the file /opt/librenms/.ircbot.alert exist and is it owned by the right user?

The file exists, and it’s owned by the librenms user. It’s in /vol1/librenms instead of /opt. Is the path hardcoded?

No the path is taken from config.php if you have it set in there.

I’d suggest creating a rule that will trigger, like %devices.hostname = “localhost” and set the delay and interval to 1. Run ./alerts.php -d and see what the output is (might need to run it twice). Pastebin what you get back.

Lot of text in response to alerts.php -d:

DEBUG!
Start: Tue, 13 Jun 2017 11:29:44 -0400
ClearStaleAlerts():
SQL[SELECT alerts.id AS alert_id, devices.hostname AS hostname FROM alerts LEFT JOIN dev ices ON alerts.device_id=devices.device_id RIGHT JOIN alert_rules ON alerts.rule_id=alert_ru les.id WHERE alerts.state!=0 AND devices.hostname IS NULL]
RunFollowUp():
SQL[SELECT alerts.device_id, alerts.rule_id, alerts.state FROM alerts WHERE alerts.state != 2 && alerts
.state > 0 && alerts.open = 0]
RunAlerts():
SQL[SELECT alerts.device_id, alerts.rule_id, alerts.state FROM alerts WHERE alerts.state != 2 && alerts
.open = 1]
SQL[SELECT alert_log.id,alert_log.rule_id,alert_log.device_id,alert_log.state,alert_log.details,alert_l
og.time_logged,alert_rules.rule,alert_rules.severity,alert_rules.extra,alert_rules.name FROM alert_log,alert_
rules WHERE alert_log.rule_id = alert_rules.id && alert_log.device_id = ‘2’ && alert_log.rule_id = ‘9’ && ale
rt_rules.disabled = 0 ORDER BY alert_log.id DESC LIMIT 1]
SQL[SELECT device_group_id FROM device_group_device WHERE device_id=‘2’]
SQL[SELECT alert_rules.* FROM alert_rules LEFT JOIN alert_map ON alert_rules.id=alert_map.rule WHERE al
ert_rules.disabled = 0 && ( (alert_rules.device_id = -1 || alert_rules.device_id = ‘2’ ) || alert_map.target
= ‘2’ )]
SQL[SELECT alerts.alerted,devices.ignore,devices.disabled FROM alerts,devices WHERE alerts.device_id =
‘2’ && devices.device_id = alerts.device_id && alerts.rule_id = ‘9’]
SQL[SELECT alert_log.id,alert_log.rule_id,alert_log.device_id,alert_log.state,alert_log.details,alert_l
og.time_logged,alert_rules.rule,alert_rules.severity,alert_rules.extra,alert_rules.name FROM alert_log,alert_
rules WHERE alert_log.rule_id = alert_rules.id && alert_log.device_id = ‘3’ && alert_log.rule_id = ‘10’ && al
ert_rules.disabled = 0 ORDER BY alert_log.id DESC LIMIT 1]
SQL[SELECT device_group_id FROM device_group_device WHERE device_id=‘3’]
SQL[SELECT alert_rules.* FROM alert_rules LEFT JOIN alert_map ON alert_rules.id=alert_map.rule WHERE al
ert_rules.disabled = 0 && ( (alert_rules.device_id = -1 || alert_rules.device_id = ‘3’ ) || alert_map.target
= ‘3’ )]
SQL[SELECT alerts.alerted,devices.ignore,devices.disabled FROM alerts,devices WHERE alerts.device_id =
‘3’ && devices.device_id = alerts.device_id && alerts.rule_id = ‘10’]
SQL[SELECT alert_log.id,alert_log.rule_id,alert_log.device_id,alert_log.state,alert_log.details,alert_l
og.time_logged,alert_rules.rule,alert_rules.severity,alert_rules.extra,alert_rules.name FROM alert_log,alert_
rules WHERE alert_log.rule_id = alert_rules.id && alert_log.device_id = ‘5’ && alert_log.rule_id = ‘11’ && al
ert_rules.disabled = 0 ORDER BY alert_log.id DESC LIMIT 1]
SQL[SELECT device_group_id FROM device_group_device WHERE device_id=‘5’]
SQL[SELECT alert_rules.* FROM alert_rules LEFT JOIN alert_map ON alert_rules.id=alert_map.rule WHERE al
ert_rules.disabled = 0 && ( (alert_rules.device_id = -1 || alert_rules.device_id = ‘5’ ) || alert_map.target
= ‘5’ )]
SQL[SELECT alerts.alerted,devices.ignore,devices.disabled FROM alerts,devices WHERE alerts.device_id =
‘5’ && devices.device_id = alerts.device_id && alerts.rule_id = ‘11’]
SQL[SELECT alert_log.id,alert_log.rule_id,alert_log.device_id,alert_log.state,alert_log.details,alert_l
og.time_logged,alert_rules.rule,alert_rules.severity,alert_rules.extra,alert_rules.name FROM alert_log,alert_
rules WHERE alert_log.rule_id = alert_rules.id && alert_log.device_id = ‘1’ && alert_log.rule_id = ‘11’ && al
ert_rules.disabled = 0 ORDER BY alert_log.id DESC LIMIT 1]
SQL[SELECT device_group_id FROM device_group_device WHERE device_id=‘1’]
SQL[SELECT alert_rules.* FROM alert_rules LEFT JOIN alert_map ON alert_rules.id=alert_map.rule WHERE al
ert_rules.disabled = 0 && ( (alert_rules.device_id = -1 || alert_rules.device_id = ‘1’ ) || alert_map.target
= ‘1’ )]
SQL[SELECT alerts.alerted,devices.ignore,devices.disabled FROM alerts,devices WHERE alerts.device_id =
‘1’ && devices.device_id = alerts.device_id && alerts.rule_id = ‘11’]
SQL[SELECT alert_log.id,alert_log.rule_id,alert_log.device_id,alert_log.state,alert_log.details,alert_l
og.time_logged,alert_rules.rule,alert_rules.severity,alert_rules.extra,alert_rules.name FROM alert_log,alert_
rules WHERE alert_log.rule_id = alert_rules.id && alert_log.device_id = ‘4’ && alert_log.rule_id = ‘11’ && al
ert_rules.disabled = 0 ORDER BY alert_log.id DESC LIMIT 1]
SQL[SELECT device_group_id FROM device_group_device WHERE device_id=‘4’]
SQL[SELECT alert_rules.* FROM alert_rules LEFT JOIN alert_map ON alert_rules.id=alert_map.rule WHERE al
ert_rules.disabled = 0 && ( (alert_rules.device_id = -1 || alert_rules.device_id = ‘4’ ) || alert_map.target
= ‘4’ )]
SQL[SELECT alerts.alerted,devices.ignore,devices.disabled FROM alerts,devices WHERE alerts.device_id =
‘4’ && devices.device_id = alerts.device_id && alerts.rule_id = ‘11’]
RunAcks():
SQL[SELECT alerts.device_id, alerts.rule_id, alerts.state FROM alerts WHERE alerts.state = 2 && alerts.
open = 1]
End : Tue, 13 Jun 2017 11:29:44 -0400

I also added:

path

$config[‘install_dir’] = “/vol1/librenms”;

To the config.php - that wasn’t in there before.

And it just started working :-). I guess the install_dir directive was the fix! Thank you!

Hmm, that indicates that there is something wrong with the way the irc bot pulls in that particular setting…

I also made a symbolic link from /vol1/librenms to /opt/librenms, but not sure if that had anything to do with it.