Open atc0005 opened 2 years ago
Note: Have example use the same directory as the value for log_file
from nagios.cfg
.
For example:
# LOG FILE
# This is the main log file where service and host events are logged
# for historical purposes. This should be the first option specified
# in the config file!!!
log_file=/var/log/nagios3/nagios.log
In our case, /var/log/nagios3/send2teams.log
should be the fully-qualified log file path used in the example(s). Specifying /tmp/send2teams.log
may not work for Nagios' purposes unless SELinux or AppArmor policy changes are applied to permit that access.
Snippet used for debugging/troubleshooting work on #225:
f, err := os.OpenFile("/var/log/nagios3/send2teams.log",
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Println(err)
}
defer f.Close()
log.SetOutput(f)
Needs work:
f.Close()
The fixed path/filename would be replaced with a user-specified value and sanitized where possible.
This could be useful for troubleshooting messages delivered by another tool such as Nagios Core that (afaik) doesn't capture output from executed notification commands.