Lets do some MRTG-graphs!
Since I somewhat felt in a hacky mood at work today I decided to learn something new about MySQL and some php. It’s not like I don’t know some about those from before, but since I am by all means a sysadmin, and not a developer/coder my heart trully lies within the systems themself.
After poking around the net for a while I found a few tips and tricks on how to create all sorts of graphs with MRTG if you had the apropriate SNMP-MIB. Well, acording to my brain there is no SNMP-MIB for the number of aterms running at my workstation. That triggered me to create a shellscript that through grep,cut,wc and ps creates a nice little number that needs to be put into MySQL. I’m not quite sure why I wanted it to be in a MySQL-db, as it’s just one row in the db, with that single number in it, but heey.. :p
After creating a shellscript that successfully counted the number of running aterms, parsing them into a mysql-sentence and running that on the remote databaseserver it was time to head over to the php and perl-scripts. MRTG runs mostly as a daemon, reading data from a configfile. The configfile in this particular setup is a file containing a php-script that is executed and reads out the number from the MySQL-db. Thus I present to all you – The number of aterms @earthquake.
And just remember folks.. you saw it here first (even tho there’s someone at Uninett that has a similar ting)