https://bugs.contribs.org/show_bug.cgi?id=10493
Bug ID: 10493
Summary: Use of uninitialized value in concatenation line 99
and line 139
Classification: Contribs
Product: SME Contribs
Version: 9.2
Hardware: ---
OS: ---
Status: CONFIRMED
Severity: normal
Priority: P3
Component: smeserver-sysmon
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
Target Milestone: ---
Just noticed this in my logs on various boxes.
sadf used : Use of uninitialized value in addition (+) at /usr/sbin/sysmon line
99.
Use of uninitialized value in addition (+) at /usr/sbin/sysmon line 99.
Use of uninitialized value in concatenation (.) or string at /usr/sbin/sysmon
line 139.
Use of uninitialized value in concatenation (.) or string at /usr/sbin/sysmon
line 139.
Here is Line 99:
99 $datahash->{swptotal} = $datahash->{swpused} + $datahash->{swpfree};
So presumably one of the values of swpused or swpfree have not been correctly
obtained.
Line 139 runs an update that requires one of the above vars.
Here's where the array gets populated
65 my @sardata;
66 if ( -x '/usr/bin/sadf' ) { @sardata=`/usr/bin/sadf -- -qrbu -n DEV
/var/lib/rrd/sysmon.process 2> /dev/null`;print "sadf used : ";}
67 else { @sardata = `/usr/bin/sar -hqru -P ALL -n DEV -f
/var/lib/rrd/sysmon.process 2> /dev/null`; print "old systat : ";}
68 unlink("/var/lib/rrd/sysmon.process");
Essentially, from what I can see, if sadf is executable, it runs and passes the
options to sar to generate the file eg it passes these "-qrbu -n DEV"
If sadf is not executable it tries to run sar directly using these options
"-hqru -P ALL -n DEV"
It seems that the -S option for swap numbers (see man sar) is missing ?
I added S to the code like this:
if ( -x '/usr/bin/sadf' ) { @sardata=`/usr/bin/sadf -- -qrbuS -n DEV
/var/lib/rrd/sysmon.process 2> /dev/null`;print "sadf used : ";}
The uninitialised errors have disappeared and I just get this in the logs:
sadf used :
After waiting a little while I have now got swap level appearing in the graphs
(give it half an hour at least)
I'll work a patch for this - the 'print' lines in the log can probably be
dispensed with as well.
One other oddity - is this # correct or is it a typo?
if($#sardata > 0 && $sardata[0] =~
^
I haven't seen that before?
--
You are receiving this mail because:
You are the QA Contact for the bug._______________________________________________
Mail for each SME Contribs bug report
To unsubscribe, e-mail [email protected]
Searchable archive at https://lists.contribs.org/mailman/public/contribteam/