Hi,
I hope someone can tell me what I'm doing wrong here. I used MRTG a
long time ago, much older version (think it was something like 1.27?). I'm
setting it up again with the latest version, and it's gathering some SNMP data
just fine, so things have been working up to now.
I tried to add a script-based entry (output from a power meter) and
something's going wrong. The initial .log file gets created, but whenever new
data is added it simply overwrites the existing data and the old data is lost,
so there's only a single entry in the .log file at any given time. I can't
tell why this is happening, even the 'rateup' command being issued by MRTG
seems the same as another entry that is properly updating.
Anyway, here's the mrtg.cfg snippet:
Target[pwrmtr]: `/Users/Shared/mrtg/getpowerlog.sh`
Options[pwrmtr]: growright,noo,noinfo,nopercent
MaxBytes[pwrmtr]: 1000000000
YLegend[pwrmtr]: W
ShortLegend[pwrmtr]: W
LegendI[pwrmtr]: Power Consumption
Title[pwrmtr]: Total Power Consumption
PageTop[pwrmtr]: <H1>Total Power Consumption</H1>
The meter returns an ever-increasing value, it happens to be kWh with 3
decimals, so I've removed the decimal since I'm pretty sure MRTG can't handle
decimal values in the above configuration. It obviously means I can't use the
'gauge' option however. The script is currently returning the power value in
the first two lines, followed by two lines of "0", based on other script
pointers I found on the web. MRTG is clearly getting the actual power reading
as reflected in the logs below, it's just not *accumulating* the data as it
should.
I've been running this for over 24 hours now, and the .log file is
simply:
% grep -v "0 0 0 0" pwrmtr.log
1485457018 35206679 35206679
1485346800 43745 43745 58588 58588
1485346500 58588 58588 58588 58588
1485346200 14842 14935 58588 58588
1485345900 0 24 0 125
The MRTG log output (with debugging enabled) showed:
2017-01-26 10:56:59 -- --base: Act on Router/Target 127.0.0.1_8
2017-01-26 10:56:59 -- --base: Get Current values: in:2628726883,
out:2075306932, up:3 days, 19:52:16, name:redacted, time:1485457018
2017-01-26 10:56:59 -- --base: Create Graphics
2017-01-26 10:56:59 -- --log: /usr/local/bin/rateup /Users/Shared/mrtg/
127.0.0.1_8 1485457018 -Z u 2628726883 2075306932 125000000 c #00cc00 #0000ff
#006600 #ff00ff k 1000 i /Users/Shared/mrtg/127.0.0.1_8-day.png -125000000
-125000000 400 100 1 1 1 300 1 4 1 %Y-%m-%d %H:%M 0 i
/Users/Shared/mrtg/127.0.0.1_8-week.png -125000000 -125000000 400 100 1 1 1
1800 1 4 1 %Y-%m-%d %H:%M 0
2017-01-26 10:56:59 -- --base: Check for Thresholds
2017-01-26 10:56:59 -- --base: Check for Write HTML Pages
2017-01-26 10:56:59 -- --base: Act on Router/Target pwrmtr
2017-01-26 10:56:59 -- --base: Get Current values: in:35206679, out:35206679,
up:0, name:0, time:1485457018
2017-01-26 10:56:59 -- --base: Create Graphics
2017-01-26 10:56:59 -- --log: /usr/local/bin/rateup /Users/Shared/mrtg/ pwrmtr
1485457018 -Z u 35206679 35206679 1000000000 c #00cc00 #0000ff #006600 #ff00ff
-o l [W] k 1000 i /Users/Shared/mrtg/pwrmtr-day.png -1000000000 -1000000000 400
100 1 1 1 300 0 4 1 %Y-%m-%d %H:%M 0
2017-01-26 10:56:59 -- --base: Check for Thresholds
2017-01-26 10:56:59 -- --base: Check for Write HTML Pages
Nothing sticks out to me in the second 'rateup' command compared to the
previous one. But only the very first line in pwrmtr.log is changing, i.e.
checking again a little later showed:
% grep -v "0 0 0 0" pwrmtr.log
1485457918 35206865 35206865
1485346800 43745 43745 58588 58588
1485346500 58588 58588 58588 58588
1485346200 14842 14935 58588 58588
1485345900 0 24 0 125
Any pointers on how to fix this?
Thank you in advance. - Will
_______________________________________________
mrtg mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg