I couldn't compile the xmlrpc client from the xmlrpc-c source package, got all kinds of errors until I gave up. Another possibility was to write a client in PHP but it runs slow as hell; plus PHP on the Asus doesn't have xmlrpc libs and I'd have to use all kinds of third party libs and it gets really annoying.
So the hell with all the xmlrpc crap. I figured out what lighttpd expects to receive at the special "/RPC2" url you set up (see mancub's tutorial). Which is this:
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>d.multicall</methodName>
<params>
<param>
<value>
<string>main</string>
</value>
</param>
<param>
<value>
<string>d.get_down_total=</string>
</value>
</param>
<param>
<value>
<string>d.get_up_total=</string>
</value>
</param>
</params>
</methodCall>
To make use of it, you put it in a file, let's call it "post.txt" then you can simply use wget (ipkg install wget) like this:
Code:
wget -T10 -q --no-check-certificate --post-data=post.txt -O - http://localhost/RPC2
Replace localhost/RPC2 with the address you've set up your lighttpd with. -T10 means to timeout after 10 seconds. -q means to be quiet (no progress bar). --no-check-certificate is useful if your lighttpd uses SSL. --post-data tells wget where to get the stuff above. -O - means to output what it gets back on the console, so you can pipe it to something else, replace - with a file name if you like that better.
This is what wget should return if everything was set up properly:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
<param><value><array><data>
<value><array><data>
<value><i8>4271258199</i8></value>
<value><i8>1437056179</i8></value>
</data></array></value>
<value><array><data>
<value><i8>4271258199</i8></value>
<value><i8>1437056179</i8></value>
</data></array></value>
<value><array><data>
<value><i8>4271258199</i8></value>
<value><i8>1437056179</i8></value>
</data></array></value>
<value><array><data>
<value><i8>4271258199</i8></value>
<value><i8>1437056179</i8></value>
</data></array></value>
</data></array></value></param>
</params>
</methodResponse>
Obviously, the values will be different each time you do this. But you'll notice that all four value sets are identical, so you can use only the first set. I dunno why rtorrent does that but I had 4 torrents running so it may be that.
Don't worry, the values you get this way are good. I've checked against the overall WLAN transfer numbers and against the limits I've set in rtorrent, and they match.
So, all you need to do next is use shell commands to extract those two values from there, then you can use them with rrdtool or whatever.
If anybody has some cool sed or awk magic they can use to extract them, please tell us. For now, all I've been able to come up with is this:
Code:
wget bla bla bla |\
grep i8|sed 's/[^0-9]//g'|tr '[:space:]' ' '|awk '{print $1":"$2}'
This will print the numbers separated by colons, good to be sent directly to rrdtool. If you want something else adjust as needed.
What happens here: I select only the lines with "i8" on them, 'cause I know they have the numbers. Then I strip everything but the digits. Then I put everything on the same line. Then I extract the first and second things on the line.