diff --git a/LibreNMS/Alert/Transport/Irc.php b/LibreNMS/Alert/Transport/Irc.php index 63b9bd1606..09d1374a85 100644 --- a/LibreNMS/Alert/Transport/Irc.php +++ b/LibreNMS/Alert/Transport/Irc.php @@ -37,7 +37,12 @@ class Irc extends Transport public function contactIrc($obj, $opts) { - $f = Config::get('install_dir') . '/.ircbot.alert'; + $container_dir = '/data'; + if (file_exists($container_dir) and posix_getpwuid(fileowner($container_dir))['name'] == 'librenms') { + $f = $container_dir . '/.ircbot.alert'; + } else { + $f = Config::get('install_dir') . '/.ircbot.alert'; + } if (file_exists($f) && filetype($f) == 'fifo') { $f = fopen($f, 'w+'); $r = fwrite($f, json_encode($obj) . "\n"); diff --git a/LibreNMS/IRCBot.php b/LibreNMS/IRCBot.php index e8355e8815..5e0c1fdc72 100644 --- a/LibreNMS/IRCBot.php +++ b/LibreNMS/IRCBot.php @@ -218,7 +218,12 @@ class IRCBot private function connectAlert() { - $f = $this->config['install_dir'] . '/.ircbot.alert'; + $container_dir = '/data'; + if (file_exists($container_dir) and posix_getpwuid(fileowner($container_dir))['name'] == 'librenms') { + $f = $container_dir . '/.ircbot.alert'; + } else { + $f = $this->config['install_dir'] . '/.ircbot.alert'; + } if ((file_exists($f) && filetype($f) != 'fifo' && ! unlink($f)) || (! file_exists($f) && ! shell_exec("mkfifo $f && echo 1"))) { $this->log('Error - Cannot create Alert-File');