Bug 187118 - MRTG produces error when target is an external script.
MRTG produces error when target is an external script.
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: mrtg (Show other bugs)
5
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Miloslav Trmač
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-03-28 11:32 EST by Hans
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: 2.13.2-0.fc5.1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-03-31 09:13:33 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Hans 2006-03-28 11:32:41 EST
Description of problem:

When the target is an external perl script such as 

Target[SARATOGA_CPU]: `/mrtg/cpustat`

which used to work 100% under FC4 the output from mrtg execution now says 

Undefined subroutine &main::HASH called at (eval 12) line 1.
*** Restarting after 10 seconds in an attempt to recover from the error above

Version-Release number of selected component (if applicable):

mrtg-2.13.0-1.2.x86_64
perl-5.8.8-4.x86_64


How reproducible:

Occurs whenever an external script or binary is referenced


Expected results:

Used to run without any errors on FC4

Additional info:

N/A
Comment 1 Hans 2006-03-28 11:36:19 EST
Here is the cpustat script. When its run standalone it give the required output of 
  0
 56
 16:59
xxx.x.xx.com

#!/usr/bin/perl
 
@line = `/usr/bin/sar | /usr/bin/tail -n 2 | /usr/bin/head -n 1 | /bin/sed 's/\
\ */ /g'`;
 
@data = split(/ /, @line[0]);
if (@data[2] eq "") {
printf "0\n";
}else {
printf ("%3.0f\n", @data[2] + 0.5);
}
printf ("%3.0f\n", (@data[3])+(@data[2])+(@data[4]+0.5));
 
$uptime = `/usr/bin/uptime | sed 's/\ \ */ /g'`;
@uptime = split(/,/, $uptime);
@uptime = split(/up/, @uptime[0]);
$server = `/bin/uname -n`;
printf "@uptime[1]\n";
printf $server;
Comment 2 Miloslav Trmač 2006-03-28 15:45:59 EST
Works fine for me (i386, mrtg-2.13.0-1.2 and -2.13.2-1), please attach your exact
config file.

Also the output of

(LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file
/var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok --debug
cfg,dir,base,tarp,snpo,snpo2,coca,repo,fork,time,log)

(the command is a single line) could be useful.
Comment 3 Hans 2006-03-29 02:16:21 EST
thanks for that - the debug info helped me out a little. here it is (I blanked 
out the community string)

# LANG=C LC_ALL=C /usr/bin/mrtg /services/www/stats/mrtg/saratoga.cnf --lock-
file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok --debug 
cfg,dir,base,tarp,snpo,snpo2,coca,repo,fork,time,log 


--base: Creating Lockfiles /var/lock/mrtg/mrtg_l,/var/lock/mrtg/mrtg_l_4690
--base: Reading Config File: /services/www/stats/mrtg/saratoga.cnf
--cfg: /services/www/stats/mrtg/saratoga.cnf[1]: Refresh: 300
--cfg: /services/www/stats/mrtg/saratoga.cnf[2]: Interval: 5
--cfg: /services/www/stats/mrtg/saratoga.cnf[3]: RunasDaemon: No
--cfg: /services/www/stats/mrtg/saratoga.cnf[4]: Ysize[_]: 200
--cfg: /services/www/stats/mrtg/saratoga.cnf[5]: Xsize[_]: 600
--cfg: /services/www/stats/mrtg/saratoga.cnf[6]: Extension[_]: html
--cfg: /services/www/stats/mrtg/saratoga.cnf[7]: 
WorkDir: /services/www/sites/neo4/stats
--cfg: /services/www/stats/mrtg/saratoga.cnf[8]: 
--cfg: /services/www/stats/mrtg/saratoga.cnf[9]: Target[SARATOGA_INT0]: 
2:*******@192.168.0.100:
--cfg: /services/www/stats/mrtg/saratoga.cnf[10]: MaxBytes[SARATOGA_INT0]: 
1250000000
--cfg: /services/www/stats/mrtg/saratoga.cnf[11]: Title[SARATOGA_INT0]: 
Traffic Analysis - Web Server
--cfg: /services/www/stats/mrtg/saratoga.cnf[12]: PageTop[SARATOGA_INT0]: 
<font face='Arial' color='#FFFFFF' size='5'><B>Hosting Server Network 
Bandwidth</B></font></TD></TR>
--cfg: /services/www/stats/mrtg/saratoga.cnf[13]:   <TR VALIGN=CENTER><TD 
WIDTH=130>&nbsp;</TD><TD><FONT color='#DDDDDD'><BR><BR>
--cfg: /services/www/stats/mrtg/saratoga.cnf[14]:  
--cfg: /services/www/stats/mrtg/saratoga.cnf[15]: Target[SARATOGA_CPU]: 
`/services/www/stats/mrtg/cpustat`
--cfg: /services/www/stats/mrtg/saratoga.cnf[16]: Options[SARATOGA_CPU]: 
nopercent,growright,gauge
--cfg: /services/www/stats/mrtg/saratoga.cnf[17]: MaxBytes[SARATOGA_CPU]: 100
--cfg: /services/www/stats/mrtg/saratoga.cnf[18]: YLegend[SARATOGA_CPU]: % CPU
--cfg: /services/www/stats/mrtg/saratoga.cnf[19]: 
--cfg: /services/www/stats/mrtg/saratoga.cnf[20]: Unscaled[SARATOGA_CPU]: dw
--cfg: /services/www/stats/mrtg/saratoga.cnf[21]: ShortLegend[SARATOGA_CPU]: %
--cfg: /services/www/stats/mrtg/saratoga.cnf[22]: LegendI[SARATOGA_CPU]: User 
CPU:
--cfg: /services/www/stats/mrtg/saratoga.cnf[23]: LegendO[SARATOGA_CPU]: 
System CPU:
--cfg: /services/www/stats/mrtg/saratoga.cnf[24]: Legend1[SARATOGA_CPU]: 
&nbsp;User CPU Utilisation &nbsp;
--cfg: /services/www/stats/mrtg/saratoga.cnf[25]: Legend2[SARATOGA_CPU]: 
&nbsp;Total System CPU Utilisation&nbsp;
--cfg: /services/www/stats/mrtg/saratoga.cnf[26]: Title[SARATOGA_CPU]: CPU 
Utilisation
--cfg: /services/www/stats/mrtg/saratoga.cnf[27]: PageTop[SARATOGA_CPU]: <font 
face='Arial' color='#FFFFFF' size='5'><B>Hosting Server CPU 
Utilisation</B></font></TD></TR>
--cfg: /services/www/stats/mrtg/saratoga.cnf[28]:   <TR><TD 
WIDTH=130>&nbsp;</TD><TD><FONT color='#DDDDDD'><BR><BR>
--base: Reading Interface Config cache
--base: Checking Config File
snmpmapOID: hrSystemUptime => 1.3.6.1.2.1.25.1.1
--dir: ensure path IN:  '/services/www/sites/neo4/stats'
--dir: ensure path OUT: '/services/www/sites/neo4/stats/'
--dir: imagehtml = 
--tarp: Starting saratoga_int0 -> 2:*******@192.168.0.100:
--tarp: &targparser external done: '2:*******@192.168.0.100:'
--tarp: &targparser complex done: '2:*******@192.168.0.100:'
--tarp: New simple target [0] '2:*******@192.168.0.100:':
  Comu:  *******, Host: 192.168.0.100
  Opt:   :, IPv4: 1
  Conv:  
  OID:   ifInOctets, ifOutOctets
  IfSel: If, If
  Key:   2, 2
--tarp: &targparser simple done: ' $target->[0]{$mode} '
--tarp: &targparser returning: unique = 0
--tarp: Starting saratoga_cpu -> `/services/www/stats/mrtg/cpustat`
--tarp: New program target [1] '/services/www/stats/mrtg/cpustat'
--tarp: &targparser external done: ' $target->[1]{$mode} '
--tarp: &targparser complex done: ' $target->[1]{$mode} '
--tarp: &targparser simple done: ' $target->[1]{$mode} '
--tarp: &targparser returning: unique = 1
--base: Loading default Locale
--base: Starting main Loop
--time: loop start Wed Mar 29 08:14:18 2006
--base: Populate Target object by polling SNMP and external Datasources
--time: snmp read start Wed Mar 29 08:14:18 2006
--snpo: run snmpget from ifInOctets&ifOutOctets:*******@192.168.0.100
--snpo: simple If: .2
--snpo: simple If: .2
--snpo: SNMPGet from *******@192.168.0.100: -- 
ifInOctets.2,ifOutOctets.2,sysUptime,sysName
toOID: 1.3.6.1.2.1.2.2.1.10.2
toOID: 1.3.6.1.2.1.2.2.1.16.2
toOID: 1.3.6.1.2.1.1.3.0
toOID: 1.3.6.1.2.1.1.5.0
--snpo: SNMPfound -- '2944287105', '1798823959', '8:53:12', 'mail'
--snpo: run external /services/www/stats/mrtg/cpustat
--snpo: External result:9 out:16 uptime:8:54 name:mail
--time: target loop start Wed Mar 29 08:14:18 2006
--base: Act on Router/Target saratoga_int0
--base: Get Current values: in:2944287105, out:1798823959, up:8:53:12, 
name:mail, time:1143616458
--base: Create Graphics
--log: Called /usr/bin/rateup /services/www/sites/neo4/stats/ saratoga_int0 
1143616458 -Z u 2944287105 1798823959 1250000000 c #00cc00 #0000ff #006600 
#ff00ff k 1000 i /services/www/sites/neo4/stats/saratoga_int0-day.png -
1250000000 -1250000000 600 200 1 1 0 300 0 4 1 %Y-%m-%d %H:%M 0
--base: Check for Thresholds
--base: Check for Write HTML Pages
--base: Act on Router/Target saratoga_cpu
Undefined subroutine &main::HASH called at (eval 12) line 1.
*** Restarting after 10 seconds in an attempt to recover from the error above
ERROR: Bailout after SIG INT

Seems that the offensive line was 

RouterUptime[SARATOGA_CPU]: *******@192.168.0.100

when I remove it the config runs through fine. Was this command deprecated???? 
As you can see I can do a poll of that router in the config section above 
without any problems so it must be related to the "RouterUptime" command 
itself and not the router.

Can you also try adding a RouterUptime to your config and see if it complains.





Comment 4 Fedora Update System 2006-03-29 13:40:18 EST
mrtg-2.13.2-0.fc5.1 has been pushed for FC5, which should resolve this issue.  If these problems are still present in this version, then please make note of it in this bug report.
Comment 5 Miloslav Trmač 2006-03-29 17:08:19 EST
Please test 2.13.2-0.fc5.1 from the updates-testing repository.
Comment 6 Hans 2006-03-30 04:58:13 EST
That did the trick. Working perfectly now. Thanks for you help.

Hans
Comment 7 Fedora Update System 2006-03-30 16:22:32 EST
mrtg-2.13.2-0.fc5.1 has been pushed for FC5, which should resolve this issue.  If these problems are still present in this version, then please make note of it in this bug report.
Comment 8 Miloslav Trmač 2006-03-31 09:13:33 EST
Thanks for your report.

Note You need to log in before you can comment on or make changes to this bug.