Open creited opened 2 years ago
Interesting question. I currently don't think there's a way to achieve what your trying to do. The reason is you need access to the ip tables on the router doing the routing as the bare minimum.
The traffic is calculated by doing iptables -vnx which reads the current packet count in bytes and the clears the counter. This is dumped to std out.
I guess you can dump this to a file and then have a second router do processing for this file offloading the main router's CPU.
The issue with that solution is the main router will still use a lot of CPU sending files back and forth to the 2nd router.
Earlier versions did a grab every 10 seconds as a compromise to CPU load. Later versions moved to a cron job with a 1 min timer (maximum offered by cron) as a compromise as it massively improved CPU load to near 0.
If you want "real time" monitoring you can enable lighttpd mode when lighttpd mode is enabled (requires you run lighttpd on your main router) a network stats are saved permanently every 1 min. But if a user is currently actively viewing the network stats there lighttpd allows for router services to be run so the web page actually refreshes every 2seconds but only as long as the browser stays connected.
The latest version supports both modes of operation (non-lighttpd) mode for routers that have less ram it just piggybacks the http server off of DDWRT's configuration page server (very limited) and a lighttpd mode where it's on it's own URL and can run CGI scripts in the background to do queries in real time.
Hello,
this is not actually an issue, but a question.
Would it be possible to monitor one router with your script but run it on another router?
I have 02 identical routers on the same network, one is the main router and other just a wired/wireless extension.
I have set the script (older versions, before cron) to run every 02 seconds and I saw that as expected it used almost 50% of the CPU.
If I could "transfer this load" to a secondary router, but still monitor data from the main router, it would be awesome.
Since it is not SNMP based, I don't think it would be the same way as reading NVRAM values, but questioning anyway.
Thanks