В файле конфигурации mrtg
LoadMIBs: /usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt
RouterUptime[localhost_2]: hrSystemUptime.0:public@localhostИз консоли
[admin@localhost:/etc/snmp]$ snmpget -v 2c -c public localhost hrSystemUptime.0
HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (2962479528) 342 days, 21:06:35.28При запуске mrtg возникает ошибка
Unknown SNMP var hrSystemUptime.0
at /usr/bin/mrtg line 657Строки кода mrtg
625 # Get the uptime and device name from the alternate location (community@host or
626 # (OID:community@host or OID) that may have been specified with the RouterUptime
627 # target keyword
628 if( defined $rcfg->{ routeruptime }{ $rou } ) {
629 my( $noid, $nloc ) = split( /:/, $rcfg->{ routeruptime }{ $rou }, 2 );
630 # If only location (community@host) was specified then
631 # move the location details into the right place
632 if( $noid =~ /@/ ) {
633 $nloc = $noid;
634 $noid = undef;
635 }
636 # If no OID (community@host) was specified use the hardcoded default
637 if( not $noid ) {
638 $noid = 'sysUptime';
639 }
640 # If no location (community@host) was specified use values from the
641 # unique target referred to in the monitored data calculation
642 if( not $nloc ){
643 if ($u >= 0) {
644 my $comm = $target->[ $u ]{ Community };
645 my $host = $target->[ $u ]{ Host };
646 my $opt = $target->[ $u ]{ SnmpOpt };
647 $nloc = "$comm\@$host$opt";
648 } else {
649 die "$NOW: ERROR: You must specify the location part of the RouterUptime oid for non unique targets! ($rou)\n";
650 }
651 }
652
653 $uploc = $nloc;
654 # Get the device uptime if $noid(OID) and $nloc (community@host) have been specified
655 # one way or the other
656 debug('base', "Fetching sysUptime and sysName from: $noid:$nloc");
657 ( $uptime, $name ) = snmpget( $uploc, $rcfg->{ snmpoptions }{ $rou }, $noid, 'sysName');
658 }
Указание OID не помогает.
В режиме отладки mrtg показывает эту ошибку, других подробностей о ней нет.
> Указание OID не помогает.
> В режиме отладки mrtg показывает эту ошибку, других подробностей о ней нет.Подробностей нет?
А перед эти что кажет?
Ведь:
> 656 debug('base', "Fetching sysUptime and sysName from: $noid:$nloc");
>> Указание OID не помогает.
>> В режиме отладки mrtg показывает эту ошибку, других подробностей о ней нет.
> Подробностей нет?
> А перед эти что кажет?
> Ведь:
>> 656 debug('base', "Fetching sysUptime and sysName from: $noid:$nloc");[07:52][admin@localhost:~]$ sudo LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/localhost/localhost.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
--base: Creating Lockfiles /var/lock/mrtg/mrtg_l,/var/lock/mrtg/mrtg_l_9900
--base: Reading Config File: /etc/mrtg/localhost/localhost.cfg
--base: Reading Interface Config cache
--base: Checking Config File
--base: Loading default Locale
--base: Starting main Loop
--base: Populate Target object by polling SNMP and external Datasources
--base: Act on Router/Target localhost_2
--base: Fetching sysUptime and sysName from: hrSystemUptime.0:public@localhost
Unknown SNMP var hrSystemUptime.0
at /usr/bin/mrtg line 657
--base: Get Current values: in:3228886536, out:1371449358, up:localhost.localdomain, name:undef, time:1695963145
--base: Create Graphics
--base: Check for Thresholds
--base: Check for Write HTML Pages
--base: Act on Router/Target localhost_3
--base: Get Current values: in:0, out:0, up:20:44:02, name:localhost.localdomain, time:1695963145
--base: Create Graphics
--base: Check for Thresholds
--base: Check for Write HTML Pages
--base: Exit main Loop
--base: Remove Lock Files
--base: Store Interface Config Cache
[07:52][adminmow@localhost:~]$