Hi, I've recently been working on a project which focuses on gathering printer meter readings using snmp and placing this data into a mysql db. This all works fine. I do this every 5 minutes.
I've since installed MRTG and am wanting to graph the number of print jobs during this 5 minute period. I've created a PHP script which is set as the target in mrtg.cfg. The printer name can be passed to the script as a command line option which makes it particularly good in this sense. The script queries mysql and calculates the number of pages printed in the last 5 minutes. This data is then output in the form: 5 0 (Just the two lines) The 5 represents say, 5 pages in total and the 0 represents 0 b/w pages. I'll post my mrtg.cfg file below. # Global configuration WorkDir: /var/www/mrtg/printers MaxBytes[_]: 20000 Options[_]: gauge,growright Refresh: 300 Interval: 60 Factor[_]: 1 # E0_ColLaser MaxBytes[E0_ColLaser]: 1500 AbsMax[E0_ColLaser]: 3000 Options[E0_ColLaser]: growright, nopercent, noinfo, withzeroes, integer, perhour, unknaszero Step[E0_ColLaser]: 300 Target[E0_ColLaser]: `php /var/www/mrtg/scripts/get_meters_from_db.php E0_ColLaser` Title[E0_ColLaser]: Meters - E0_ColLaser PageTop[E0_ColLaser]: <h1>Meters - E0_ColLaser</h1> YLegend[E0_ColLaser]: Jobs in the past 5 minutes ShortLegend[E0_ColLaser]: Pages / 5 Mins LegendI[E0_ColLaser]: Total Prints / 5 Mins LegendO[E0_ColLaser]: Colour Prints / 5 Mins # E2_ColLaser MaxBytes[E2_ColLaser]: 1500 AbsMax[E2_ColLaser]: 3000 Options[E2_ColLaser]: growright, nopercent, noinfo, withzeroes, integer, perhour, unknaszero Step[E2_ColLaser]: 300 Target[E2_ColLaser]: `php /var/www/mrtg/scripts/get_meters_from_db.php E2_ColLaser` Title[E2_ColLaser]: Meters - E2_ColLaser PageTop[E2_ColLaser]: <h1>Meters - E2_ColLaser</h1> YLegend[E2_ColLaser]: Jobs in the past 5 minutes ShortLegend[E2_ColLaser]: Pages / 5 Mins LegendI[E2_ColLaser]: Total Prints / 5 Mins LegendO[E2_ColLaser]: Colour Prints / 5 Mins NB: My printers print at 25 pages per minute. I've used 25*60 to get a pages per hour figure and hopefully set the global interval at 60 minutes. The figures I'm getting are completely wrong. For example, I've printed at the most 2 or 3 pages and yet my graph shows the following values and the scale has a max value of 36? Total Prints / 5 Mins 35 Pages / 5 Mins 0 Pages / 5 Mins 0 Pages / 5 Mins Colour Prints / 5 Mins 11 Pages / 5 Mins 0 Pages / 5 Mins 0 Pages / 5 Mins Please, any assistance in understanding: 1) What output I need to provide from my script so that MRTG can use it as input data 2) Configure MRTG to simply graph the integer value for pages printed per 5 minute interval. Cheers, Chris
_______________________________________________ mrtg mailing list [email protected] https://lists.oetiker.ch/cgi-bin/listinfo/mrtg
