|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Graphs for ipmitool
|
|
Packit Service |
ed0f68 |
-------------------
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
This is a set of shell-scripts to quickly create a webpage with pretty graphs!
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Prerequisites are a webserver with cgi-bin support and RRDtool, a data
|
|
Packit Service |
ed0f68 |
collection and graphing utility you can get here:
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
First, decide on a directory where to store the RRDtool database files and make
|
|
Packit Service |
ed0f68 |
sure it exists. The user that will run the cronjob to collect updates must have
|
|
Packit Service |
ed0f68 |
write permissions in this dir.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Next, you'll need to edit some variables at the top of each script.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Common to all scripts:
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
hostname Override this if you are collecting data from a remote host,
|
|
Packit Service |
ed0f68 |
or if the $HOSTNAME variable is incorrect.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
ipmi_cmd Command line used to call ipmitool. Default is to collect
|
|
Packit Service |
ed0f68 |
data from the local server using OpenIPMI.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
If you want to collect data from a remote host, add the
|
|
Packit Service |
ed0f68 |
-I lan, -H, -U and -P options as necessary.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
BIG NOTE! I do not recommend using remote data collection since
|
|
Packit Service |
ed0f68 |
you'll have to store the password in the script. If you do,
|
|
Packit Service |
ed0f68 |
make sure unauthorized people can't read or execute the scripts
|
|
Packit Service |
ed0f68 |
or they'll be able to wreak havoc on your server.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
rrd_dir Enter the dir where to store the RRDtool database here.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Now you can get the data collection going. Run create_rrds.sh to create the
|
|
Packit Service |
ed0f68 |
RDDtool database, you'll find one .rrd file per sensor in the designated dir.
|
|
Packit Service |
ed0f68 |
Add a line to your crontab that executes collect_data.sh every 5 minutes.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Something like this:
|
|
Packit Service |
ed0f68 |
*/5 * * * * /usr/local/bin/collect_data.sh
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
If you are a Solaris user you'll have to write the more verbose:
|
|
Packit Service |
ed0f68 |
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/collect_data.sh
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Finally it's time to create the webpage, begin with editing some more variables
|
|
Packit Service |
ed0f68 |
in the create_webpage.sh and/or create_webpage_compact.sh scripts:
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
rrdcgi Full path to the rrdcgi executable.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
img_dir Directory to store the graph images. This path must be within
|
|
Packit Service |
ed0f68 |
the document root and writable by the web server user.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Example: /usr/local/apache2/htdocs/images/graphs
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
web_dir Relative path of the URL where the images will show up
|
|
Packit Service |
ed0f68 |
on the web server.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Example: With the img_dir path above the corresponding web_dir
|
|
Packit Service |
ed0f68 |
would be /images/graphs
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
graph_width Size of the graph area in pixels (excluding title, legends etc.)
|
|
Packit Service |
ed0f68 |
graph_height
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
graph_daily Decide which of daily, weekly and monthly graphs you want
|
|
Packit Service |
ed0f68 |
graph_weekly included on the page.
|
|
Packit Service |
ed0f68 |
graph_monthly
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Finally run the create webpage script and store the output as a cgi-script and
|
|
Packit Service |
ed0f68 |
don't forget to make it executable.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Example:
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
create_webpage.sh > /usr/local/apache2/cgi-bin/my_ipmi_graphs.cgi
|
|
Packit Service |
ed0f68 |
chmod 755 /usr/local/apache2/cgi-bin/my_ipmi_graphs.cgi
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Now you can surf to http://my.server.com/cgi-bin/my_ipmi_graphs.cgi and enjoy!
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
The difference between create_webpage.sh and create_webpage_compact.sh is that
|
|
Packit Service |
ed0f68 |
the first script displays sensor thresholds in the graphs. The second script
|
|
Packit Service |
ed0f68 |
collects all sensors that measure the same unit into the same graph thus
|
|
Packit Service |
ed0f68 |
producing a lot fewer graphs.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Note, RRDtool sometimes scales the graphs such that the sensor thresholds
|
|
Packit Service |
ed0f68 |
fall outside the visible area.
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
Happy graphing!
|
|
Packit Service |
ed0f68 |
|
|
Packit Service |
ed0f68 |
|