Monitoring solution at the router level

Currently I have a simple script which redirects ping output to some text file.
I then can import and chart this data.

Obvious disadvantage is the script runs on a PC, which have to be on all the time.
So it would be ideal to run this monitoring on the router.

I'm currently running Tomato (stock) on a WRT54G
I have a NAS to which I could define a CIFS for storing logs
Tomato scheduler doesn't fit - lowest schedule you can set is 1 minute
Maybe some sort of daemon, but here my (limited) knowledge ends.

Sounds like a common thing, and I dont want to reinvent anything. Do you have any idea on how I could do it?