1*c18ec02fSPetter Reinholdtsen 2*c18ec02fSPetter ReinholdtsenGraphs for ipmitool 3*c18ec02fSPetter Reinholdtsen------------------- 4*c18ec02fSPetter Reinholdtsen 5*c18ec02fSPetter ReinholdtsenThis is a set of shell-scripts to quickly create a webpage with pretty graphs! 6*c18ec02fSPetter Reinholdtsen 7*c18ec02fSPetter ReinholdtsenPrerequisites are a webserver with cgi-bin support and RRDtool, a data 8*c18ec02fSPetter Reinholdtsencollection and graphing utility you can get here: 9*c18ec02fSPetter Reinholdtsen 10*c18ec02fSPetter Reinholdtsenhttp://people.ee.ethz.ch/~oetiker/webtools/rrdtool/ 11*c18ec02fSPetter Reinholdtsen 12*c18ec02fSPetter Reinholdtsen 13*c18ec02fSPetter ReinholdtsenFirst, decide on a directory where to store the RRDtool database files and make 14*c18ec02fSPetter Reinholdtsensure it exists. The user that will run the cronjob to collect updates must have 15*c18ec02fSPetter Reinholdtsenwrite permissions in this dir. 16*c18ec02fSPetter Reinholdtsen 17*c18ec02fSPetter ReinholdtsenNext, you'll need to edit some variables at the top of each script. 18*c18ec02fSPetter Reinholdtsen 19*c18ec02fSPetter ReinholdtsenCommon to all scripts: 20*c18ec02fSPetter Reinholdtsen 21*c18ec02fSPetter Reinholdtsenhostname Override this if you are collecting data from a remote host, 22*c18ec02fSPetter Reinholdtsen or if the $HOSTNAME variable is incorrect. 23*c18ec02fSPetter Reinholdtsen 24*c18ec02fSPetter Reinholdtsenipmi_cmd Command line used to call ipmitool. Default is to collect 25*c18ec02fSPetter Reinholdtsen data from the local server using OpenIPMI. 26*c18ec02fSPetter Reinholdtsen 27*c18ec02fSPetter Reinholdtsen If you want to collect data from a remote host, add the 28*c18ec02fSPetter Reinholdtsen -I lan, -H, -U and -P options as necessary. 29*c18ec02fSPetter Reinholdtsen 30*c18ec02fSPetter Reinholdtsen BIG NOTE! I do not recommend using remote data collection since 31*c18ec02fSPetter Reinholdtsen you'll have to store the password in the script. If you do, 32*c18ec02fSPetter Reinholdtsen make sure unauthorized people can't read or execute the scripts 33*c18ec02fSPetter Reinholdtsen or they'll be able to wreak havoc on your server. 34*c18ec02fSPetter Reinholdtsen 35*c18ec02fSPetter Reinholdtsenrrd_dir Enter the dir where to store the RRDtool database here. 36*c18ec02fSPetter Reinholdtsen 37*c18ec02fSPetter Reinholdtsen 38*c18ec02fSPetter ReinholdtsenNow you can get the data collection going. Run create_rrds.sh to create the 39*c18ec02fSPetter ReinholdtsenRDDtool database, you'll find one .rrd file per sensor in the designated dir. 40*c18ec02fSPetter ReinholdtsenAdd a line to your crontab that executes collect_data.sh every 5 minutes. 41*c18ec02fSPetter Reinholdtsen 42*c18ec02fSPetter ReinholdtsenSomething like this: 43*c18ec02fSPetter Reinholdtsen*/5 * * * * /usr/local/bin/collect_data.sh 44*c18ec02fSPetter Reinholdtsen 45*c18ec02fSPetter ReinholdtsenIf you are a Solaris user you'll have to write the more verbose: 46*c18ec02fSPetter Reinholdtsen0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/collect_data.sh 47*c18ec02fSPetter Reinholdtsen 48*c18ec02fSPetter Reinholdtsen 49*c18ec02fSPetter ReinholdtsenFinally it's time to create the webpage, begin with editing some more variables 50*c18ec02fSPetter Reinholdtsenin the create_webpage.sh and/or create_webpage_compact.sh scripts: 51*c18ec02fSPetter Reinholdtsen 52*c18ec02fSPetter Reinholdtsenrrdcgi Full path to the rrdcgi executable. 53*c18ec02fSPetter Reinholdtsen 54*c18ec02fSPetter Reinholdtsenimg_dir Directory to store the graph images. This path must be within 55*c18ec02fSPetter Reinholdtsen the document root and writable by the web server user. 56*c18ec02fSPetter Reinholdtsen 57*c18ec02fSPetter Reinholdtsen Example: /usr/local/apache2/htdocs/images/graphs 58*c18ec02fSPetter Reinholdtsen 59*c18ec02fSPetter Reinholdtsenweb_dir Relative path of the URL where the images will show up 60*c18ec02fSPetter Reinholdtsen on the web server. 61*c18ec02fSPetter Reinholdtsen 62*c18ec02fSPetter Reinholdtsen Example: With the img_dir path above the corresponding web_dir 63*c18ec02fSPetter Reinholdtsen would be /images/graphs 64*c18ec02fSPetter Reinholdtsen 65*c18ec02fSPetter Reinholdtsengraph_width Size of the graph area in pixels (excluding title, legends etc.) 66*c18ec02fSPetter Reinholdtsengraph_height 67*c18ec02fSPetter Reinholdtsen 68*c18ec02fSPetter Reinholdtsengraph_daily Decide which of daily, weekly and monthly graphs you want 69*c18ec02fSPetter Reinholdtsengraph_weekly included on the page. 70*c18ec02fSPetter Reinholdtsengraph_monthly 71*c18ec02fSPetter Reinholdtsen 72*c18ec02fSPetter Reinholdtsen 73*c18ec02fSPetter ReinholdtsenFinally run the create webpage script and store the output as a cgi-script and 74*c18ec02fSPetter Reinholdtsendon't forget to make it executable. 75*c18ec02fSPetter Reinholdtsen 76*c18ec02fSPetter ReinholdtsenExample: 77*c18ec02fSPetter Reinholdtsen 78*c18ec02fSPetter Reinholdtsencreate_webpage.sh > /usr/local/apache2/cgi-bin/my_ipmi_graphs.cgi 79*c18ec02fSPetter Reinholdtsenchmod 755 /usr/local/apache2/cgi-bin/my_ipmi_graphs.cgi 80*c18ec02fSPetter Reinholdtsen 81*c18ec02fSPetter ReinholdtsenNow you can surf to http://my.server.com/cgi-bin/my_ipmi_graphs.cgi and enjoy! 82*c18ec02fSPetter Reinholdtsen 83*c18ec02fSPetter Reinholdtsen 84*c18ec02fSPetter ReinholdtsenThe difference between create_webpage.sh and create_webpage_compact.sh is that 85*c18ec02fSPetter Reinholdtsenthe first script displays sensor thresholds in the graphs. The second script 86*c18ec02fSPetter Reinholdtsencollects all sensors that measure the same unit into the same graph thus 87*c18ec02fSPetter Reinholdtsenproducing a lot fewer graphs. 88*c18ec02fSPetter Reinholdtsen 89*c18ec02fSPetter ReinholdtsenNote, RRDtool sometimes scales the graphs such that the sensor thresholds 90*c18ec02fSPetter Reinholdtsenfall outside the visible area. 91*c18ec02fSPetter Reinholdtsen 92*c18ec02fSPetter Reinholdtsen 93*c18ec02fSPetter ReinholdtsenHappy graphing! 94*c18ec02fSPetter Reinholdtsen 95*c18ec02fSPetter Reinholdtsen 96