If someone would do MRTG on Centos, here is short how-to
1. don't forget to install rpmforge assets (to install additional snmpv3 perl libs)
2. configure mikrotik
/snmp community add addresses=0.0.0.0/0 authentication-password=12345678 authentication-protocol=MD5 encryption-password=87654321 encryption-protocol=DES name=cactiuser read-access=yes security=private write-access=no
/snmp set contact=contact enabled=yes engine-id="" location=location trap-community=cactiuser trap-generators="" trap-target="" trap-version=3
3. install apps
yum install net-snmp net-snmp-utils mrtg httpd
4. fix 'usmStatsNotInTimeWindows' in /usr/share/perl5/vendor_perl/Net/SNMP.pm
--- Net/SNMP.pm.orig 2014-12-04 12:46:17.736487353 +0300
+++ Net/SNMP.pm 2014-12-04 12:28:05.582495561 +0300
@@ -2541,8 +2541,9 @@ sub _discovery_synchronization_cb
# counter in the varBindList..." If another error is returned, we
# assume that the synchronization has failed.
- if (($this->{_security}->discovered) &&
- ($this->{_error} =~ /usmStatsNotInTimeWindows/))
+ # if (($this->{_security}->discovered) &&
+ # ($this->{_error} =~ /usmStatsNotInTimeWindows/))
+ if ($this->{_security}->discovered)
{
$this->_error_clear;
@@ -2559,7 +2560,8 @@ sub _discovery_synchronization_cb
# If we received the usmStatsNotInTimeWindows report or no error, but
# we are still not synchronized, provide a generic error message.
- if ((!$this->{_error}) || ($this->{_error} =~ /usmStatsNotInTimeWindows/)) {
+ # if ((!$this->{_error}) || ($this->{_error} =~ /usmStatsNotInTimeWindows/)) {
+ if (!$this->{_error}) {
$this->_error_clear;
$this->_error('Time synchronization failed during discovery');
}
5. fix access in /etc/httpd/conf.d/mrtg.conf
<Location /mrtg>
Order deny,allow
Deny from all
Allow from 192.168.0.0/24
Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
</Location>
6. add cron task (every 5 min)
*/1 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
7. generate index (once!)
/usr/bin/indexmaker --output /var/www/mrtg/index.html /etc/mrtg/mrtg.cfg
8. generate proper mrtg.cfg
cfgmaker --global 'Workdir: /var/www/mrtg' --global 'Options[_]: bits, growright' --output /etc/mrtg/mrtg.cfg --enablesnmpv3 --username=cactiuser --authprotocol=md5 --privprotocol=des --authpassword=12345678 --privpassword=87654321 --ifref=descr --contextengineid=80003a8c04 --snmp-options=:::::3 192.168.0.1
if you add interfaces repeat steps 7 and 8 after:
ps. change passwords on your own, contextengineid selected according to wiki