|
The command uptime indicateshow long the system has been running. uptime gives a one line display of the following information. The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes. Example: uptime 16:00: 21 up 118 days, 16:17, 1 to use, load average: 0.88, 0.28, 0.19 This article treats the follow-up of the uptime with MRTG.
Initially, it will be necessary to put script below in the /etc/mrtg directory.
Script Name : uptime.pl Contents: #! /usr/bin/perl #Affichage of the uptime in a number of days for MRTG $uptime = `uptime `; $uptime =~ /up (. *?) day/; $up = int ($1); print “$up \ N”; print “$up \ N”; Once, /etc/mrtg/uptime.pl script set up, its rights are changed as follows: - chmod +x /etc/mrtg/uptime.pl
Check this script by : # /etc/mrtg/uptime.pl 118 118 Then, it will be necessary to update your /etc/mrtg.cfg configuration file, and this with the following contents: Target [localhost-uptime]: `/etc/mrtg/uptime.pl ` Suppress [localhost-uptime]: D Options [localhost-uptime]: gauge, noinfo, nopercent, growright, nobanner, noi [Localhost-uptime]: Uptime MaxBytes [localhost-uptime]: 9999999999 YLegend [localhost-uptime]: days ShortLegend [localhost-uptime]: days LegendO [localhost-uptime]: Uptime: Legend2 [localhost-uptime]: Uptime in days PageTop [localhost-uptime]: Follow-up of the uptime The construction of the new index page (the new synthesis web page) is done using indexmaker command. Here an example: - cp /var/www/mrtg/index.html /var/www/mrtg/index.html.old
- indexmaker --columns=1 --output /var/www/mrtg/index.html /etc/mrtg.cfg
|