#!/usr/bin/perl use POSIX; #======================================================== # CPU Usage script for mrtg # # File: cpuload.pl # Author: Chretien Jean-Luc | jeanluc.chretien@tice.ac-caen.fr # Version: 1.0 # # Date: 09/08/02 # Purpose: This script reports CPU usage for user # and system to mrtg, along with uptime # and the machine's hostname. # # Usage: ./cpuload.pl # # # Info: Designed on Debian Woody # # # [Note to User] # # If anyone has comments or suggestions, email me at # jean-luc.chretien@tice.ac-caen.fr and I'll try to # get back to you :) # # Modified by Bruno Bzeznik 2002/12/18: # I prefer to use output from uptime, the second entry gives # the average load of last 5 minutes, and it's more representative # as we run mrtg every 5 minutes. # ------------------------------------------------------------- # # Sample cfg: # # Target[machine]: `./cpuload.pl` # MaxBytes[machine]: 1000 # YTicsFactor[agios]: 0.1 # Options[machine]: gauge, nopercent # Unscaled[machine]: dwym # YLegend[machine]: % of CPU used # ShortLegend[machine]: % # LegendO[machine]: CPU System: # LegendI[machine]: CPU User: # Title[machine]: Machine name # PageTop[machine]:
System: | Machine name |