mkmrtg.shMRTG HTML Front-Endcopy, paste, run, done

Welcome To mkmrtg.sh

Hi! If your here it must mean your familiar with MRTG. The basis of this page is to help you with a front-end for MRTG. A quick over-view can be found to the right in the Who, What, Why, Where, How section.

Currently, mkmrtg.sh is up to Version 0.9Remember to check out the stuff on the right.Then click here to jump to the code. :)

------------------------------------------

Wednesday, September 10, 2008

I was thinking. Does my machine take to long to run through all the mrtg config files? (I graph 20+ at home and 100+ at work) I learned from a friend a while back that in shell scripting, you can improve over-all performance by making your tasks run one-after-the-other. So, if you have a LOT of stuff that runs at 1:00AM, instead of a lot crontab entries, you put all those entries into a script and let the crontab run the script you created.

If your not doing that, I suggest you do. Now, I wanted to make sure that this script is not running for more than 5 minutes. So, I created a little add-on to let me know everything is ok. :)

Friday, September 5, 2008

Well, we are to Version 0.9. I want to make sure Version 1.0 has as many bugs out of it as possible and I also want to make sure it is documented well enough. So, if you had to tweak the script or something isn't quite right, please let me know.

I am pleased to note that Version 0.9 has the addition of a notes section. Rather than have you dig through the script for where to put your notes I decided to have notes entered into their own file. Hopefully this will keep things simple.

The notes should be formatted as such:NODE1:This is my note.NODE2:This is another note.etc. etc. etc.

The notes will appear below all of the graphs.(Just a thought, I may in the future decide to make it optional for the top or bottom. This is so if you have a 48 port switch, you don't have to scroll all the way down.)

### CONFIG #### What Kind Of Image Output Does Your MRTG Setup Produce? PNG or GIF?pic="png"# Where Is Your MRTG Output Located?loc="/srv/www/htdocs/mrtg"# Where Are Your Notes?notes="/usr/local/bin/mkmrtg.sh.notes"

### USAGE ####` Place this script in /usr/local/bin (or /usr/bin)# chmod 700 mkmrtg.sh# ./mkmrtg.sh# Note: This script assumes your nodes are all in the same place.# Example:# /srv/www/htdocs/mrtg/# /srv/www/htdocs/mrtg/NODE1/# /srv/www/htdocs/mrtg/NODE2/# Then point your browser to the local machine (however you setup your Apache).

### RELEASE NOTES #### Yeah! mkmrtg.sh can now be run from anywhere on your system. My suggestion is to keep it in some place like "/usr/local/bin".# Depending on how you installed MRTG, you may have "gif" images instead of "png" images. If so, change "png" to "gif" at the top.# If your output from MRTG is not located in "/srv/www/htdocs/mrtg" then you need to change the location variable "loc" at the top to the place you pointed your MRTG output.# Please make sure there are NO "-" (dashes) in your interface identifyer! Example: "eth0-1" is NOT good. Use "eth0_1" instead. :)# NOTES Section For Your Devices. Be default it is located at /usr/local/bin/mkmrtg.sh.notes If this is not where you want your notes, change it. Notes should be added in the following syntax (making note that "folder name" should be the EXACT same as the folder name):# [folder name]:[notes]# Example= NODE1:Unable To Ping node1 as we are rejecting icmp so currently no data.

Thursday, August 28, 2008

### USAGE ####` Place this script in /usr/local/bin (or /usr/bin)# chmod 700 mkmrtg.sh# ./mkmrtg.sh# Note: This script assumes your nodes are all in the same place.# Example:# /srv/www/htdocs/mrtg/# /srv/www/htdocs/mrtg/NODE1/# /srv/www/htdocs/mrtg/NODE2/# Then point your browser to the local machine (however you setup your Apache).

### RELEASE NOTES #### Yeah! mkmrtg.sh can now be run from anywhere on your system. My suggestion is to keep it in some place like "/usr/local/bin".# Depending on how you installed MRTG, you may have "gif" images instead of "png" images. If so, change "png" to "gif" at the top.# If your output from MRTG is not located in "/srv/www/htdocs/mrtg" then you need to change the location variable "loc" at the top to the place you pointed your MRTG output.# Please make sure there are NO "-" (dashes) in your interface identifyer! Example: "eth0-1" is NOT good. Use "eth0_1" instead. :)

### RELEASE NOTES #### Yeah! mkmrtg.sh can now be run from anywhere on your system. My suggestion is to keep it in some place like "/usr/local/bin".# Depending on how you installed MRTG, you may have "gif" images instead of "png" images. If so, change "png" to "gif". Its only in one spot below.# If your output from MRTG is not located in "/srv/www/htdocs/mrtg" then you need to change the location variable "loc" below to the place you pointed your MRTG output.

### USAGE ####` Place this script in /usr/local/bin (or /usr/bin)# chmod 700 mkmrtg.sh# ./mkmrtg.sh# Note: This script assumes your nodes are all in the same place.# Example:# /srv/www/htdocs/mrtg/# /srv/www/htdocs/mrtg/NODE1/# /srv/www/htdocs/mrtg/NODE2/# /srv/www/htdocs/mrtg/NODE3/# NOTE: Please make sure there are NO "-" (dashes) in your interface identifyer! Example: "eth0-1" is NOT good. Use "eth0_1" instead. :)# Then point your browser to the local machine (however you setup your Apache).

Monday, August 25, 2008

### RELEASE NOTES #### Currently, as far as I know, this needs to br run from /srv/www/htdocs/mrtg.# Taking a quick look, I can see that I just need to update:# for h in `ls | fgrep -v "."`# to: for h in `ls $loc | fgrep -v "."`# With $loc being set prior to this line.# Depending on how you installed MRTG, you may have "gif" images instead of "png"# images. If so, change "png" to "gif". Its only in one spot below.

### USAGE #### Place this script in /srv/www/htdocs/mrtg# chmod 700 mkmrtg.sh# ./mkmrtg.sh# Note: This script assumes your nodes are all in the same place.# Example:# /srv/www/htdocs/mrtg/# /srv/www/htdocs/mrtg/NODE1/# /srv/www/htdocs/mrtg/NODE2/# /srv/www/htdocs/mrtg/NODE3/# Then point your browser to the local machine (however you setup your Apache).

Who, What, Why, Where, How

Who?My name is Joe. I write and accept contributions of mkmrtg.sh (credit via comment within mkmrtg.sh)

What?mkmrtg.sh is a front-end to MRTG. It is a simple way to create HTML files that contain all of the network (or non-network) nodes your monitoring. Want to see a pic? See this post: Screen-Shot

Why?I found that after the initial setup of MRTG, I spent a lot of time creating web pages to get a central view of the graphs being generated. This was especially true when setting up a 48-Port switch! So, by simply typing ./mkmrtg.sh it does the task in a matter of seconds. :) I also wanted to make sure that new users to MRTG have a simple way to get started.

Where?Anywhere. :) All you need to do is copy the script to your *nix box, run it and your set. :)

How?mkmrtg.sh is written in bash. It is destined to run on a *nix box (not w1nd0w$!). With the simple idea of 'copy, paste, run, done' you can have your front-end very quickly.1. Copy mkmrtg.sh to your *nix box2. vi mkmrtg.sh (to change settings to your environment)3. chmod 700 mkmrtg.sh4. ./mkmrtg.sh