Re: Nagios not cleaning up old switch configs from mrtg?
Posted: Wed Feb 09, 2022 12:10 pm
Confirmed. And, the incoming emails are at 5 minute intervals as well.pbroste wrote: Thanks for following up, want to verify the cron job is going off without issue. We see that every 5 minutes the following cron is run:
find /etc/cron* -type f -exec grep -Eri "mrtg" -A 2 -B 2 {} \;
*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lib/mrtg/mrtg.lock --confcache-file /var/lib/mrtg/mrtg.ok --user=nagios --group=nagios
[root@nagios ~]# find /etc/cron* -type f -exec grep -Eri "mrtg" -A 2 -B 2 {} \;
*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lib/mrtg/mrtg.lock --confcache-file /var/lib/mrtg/mrtg.ok --user=nagios --group=nagios
Ran this, but didn't get any actual logs out of it.pbroste wrote: Want to verify the cron status:Code: Select all
systemctl status crond
[root@nagios ~]# systemctl status crond
● crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-01-29 13:20:33 CST; 1 weeks 3 days ago
Main PID: 671 (crond)
CGroup: /system.slice/crond.service
└─671 /usr/sbin/crond -n
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
Gave VERY long output that looked like it processed through the various .cfg files, including some HTML-type output. I tried to pipe it out to a file, or even just to "less", but it still forced all the output to console immediately.pbroste wrote: Manual run through to verify:Quick look at the logs that pop-up for any interesting messages:Code: Select all
LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lib/mrtg/mrtg.lock --confcache-file /var/lib/mrtg/mrtg.ok --user=nagios --group=nagios --debug="cfg,snpo" --check
Code: Select all
LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lib/mrtg/mrtg.lock --confcache-file /var/lib/mrtg/mrtg.ok --user=nagios --group=nagios --debug="cfg,snpo" --check
It isn't too long.pbroste wrote: Send over the copy of your mrtg.cfg:Code: Select all
/etc/mrtg/mrtg.cfg
[root@nagios ~]# cat /etc/mrtg/mrtg.cfg
######################################################################
# Multi Router Traffic Grapher -- Example Configuration File
######################################################################
# This file is for use with mrtg-2.0
#
# Note:
#
# * Keywords must start at the begin of a line.
#
# * Lines which follow a keyword line which do start
# with a blank are appended to the keyword line
#
# * Empty Lines are ignored
#
# * Lines starting with a # sign are comments.
# Where should the logfiles, and webpages be created?
# Minimal mrtg.cfg
#--------------------
HtmlDir: /var/www/mrtg
ImageDir: /var/www/mrtg
LogFormat: rrdtool
LogDir: /var/lib/mrtg
ThreshDir: /var/lib/mrtg
WorkDir: /var/lib/mrtg
Forks: 4
EnableSnmpV3: yes
Include: conf.d/*.cfg
EnableSNMPv3: yes
[root@nagios ~]#