It's published under the GNU General Public License which means you can do most things you want with this software as long as you do not claim you created the software and don't sell it.
So I tough it would be fun to run this on my unRAID server, so here is how I did.
Setting up a HTTP server
unRAID has a build in HTTP server, but its used for the web interface to manage the unRAID server, lets leave that as it is (we don't want it connected to the internet for example)
Instead we gonna be using the webserver packadge made by BubbaQ.
If tested this installation
- Download the BubbaQ unraidweb packadge from here (or use the packadge from the unRAID forum)
- Copy the packadge to your unRAID server in: \\tower\flash\extra
- Log in to your unRAID server using putty
- Create a directory where your website files can go: mkdir -p /mnt/user/SERVER/WWW_ROOT/
- Run the command to install the packadge: installpkg /boot/extra/unraidweb-0.1.05-i386-bubba.tgz
The output should look something like this:
unRAID emhttp is running on port 80
Starting Lighttpd
************************************************************
* unRAID-Web has been started.
*
* To access it, put this address
* in your browser: http://x.x.x.x:89
************************************************************
Package unraidweb-0.1.05-i386-bubba.tgz installed.
- Test the webinterface, by going to http://x.x.x.x:89 it should look something like this:
- Now we can set our 'wwwroot' directory, set it to: /mnt/user/SERVER/WWW_ROOT/
And change the port to 81. (the config page will stay on port 89) - During my setup the webserver did not come available on port 81 but stayed only on 89, after some checking I found that in my lighttpd.conf.include did not change; the port and also the wwwroot directory were not saved in there.
So I changed them manually, open lighttpd.conf.include from \\tower\flash\custom\lighttpd
And add the following lines:
- $SERVER["socket"] == "0.0.0.0:81" {
- server.document-root = "/mnt/user/SERVER/WWW_ROOT/"
- dir-listing.activate = "enable"
- }
- Now restart your lighttpd server, from the commandline run: /boot/custom/lighttpd/lighttpdctrl restart
- If you now open your browser and go to http://tower:81 it will show the directory listing of your WWW_ROOT directory.
Installing MRTG
Installing MRTG is not 'just' MRTG, you need a bunch of packages to generate the images, add compression, etc.
If added them in a nice complete package, but you can also get the files yourself from the Slackware repository.Installing MRTG is not 'just' MRTG, you need a bunch of packages to generate the images, add compression, etc.
(Be warned there are a lot of dependency's for MRTG and I used a bunch of different versions because of compatibility issues between the gd, libpng, perl & mrtg packages.)
- Get the following packadge: mrtg and dependencies.7z
- Extract it to your server's 'extra' directory
- Install the packages from the command line:
installpkg /boot/extra/fontconfig-2.8.0-i486-1.txz
installpkg /boot/extra/freetype-2.4.4-i486-1.txz
installpkg /boot/extra/gd-2.0.35-i486-3.txz
installpkg /boot/extra/libjpeg-6b-i486-5.txz
installpkg /boot/extra/libpng-1.4.5-i486-1.txz
installpkg /boot/extra/libX11-1.4.3-i486-2.txz
installpkg /boot/extra/libXau-1.0.6-i486-1.txz
installpkg /boot/extra/libxcb-1.7-i486-1.txz
installpkg /boot/extra/libXdmcp-1.1.0-i486-1.txz
installpkg /boot/extra/libXpm-3.5.9-i486-1.txz
installpkg /boot/extra/mrtg-2.16.1-i486-1vic.tgz
installpkg /boot/extra/perl-5.10.0-i486-1.tgz
installpkg /boot/extra/zlib-1.2.5-i486-4.txz
- You can test your mrtg installation by running: mrtg
The output should look like this:
-----------------------------------------------------------------------
ERROR: Mrtg will most likely not work properly when the environment
variable LANG is set to UTF-8. Please run mrtg in an environment
where this is not the case. Try the following command to start:
env LANG=C /usr/bin/mrtg
-----------------------------------------------------------------------
Configuring the router
Now we must configure the router and enable SNMP
- Log in to your router, if you use DD-WRT like I do, go to the services tab and scroll down to the SNMP tab.
Set the radio button to 'Enable' and fill in the information to identify the router. - Click 'Apply settings' and thats it.
Create MRTG configuration files
To let the stats now what to monitor and how to present it, we need some configuration files.
- Create a directory to store your configuration files: mkdir -p /boot/config/mrtg/
- Create a config file for your router: cfgmaker --output=/boot/config/mrtg/<name>.cfg public@x.x.x.x
Make sure to replace <name>.cfg to something you can identify your router by and x.x.x.x with its IP-adres. - Now we have to edit the file to set its workdir and specific configuration, open your created config file (\\tower\flash\config\mrtg\) and add the following lines to it:
WorkDir: /mnt/user/SERVER/WWW_ROOT/mrtg/<name>/
RunAsDaemon: Yes
Interval: 5
This will set the MRTG 'WorkDir' (here it will store its html & images files) and set it to query the router every 5 minutes for its current load.
There are a lot of options you can set to make it look and run like you want, just take a look at the MRTG configuration reference.
Basic configuration for a WRT54GS router |
Running MRTG
- To run MRTG run the following command: env LANG=C mrtg /boot/config/mrtg/<name>.cfg --lock-file=/tmp/mrtg_<name>.cfg
- When you run the command it should say: Daemonizing MRTG ...
- Add the lines to start mrtg to your 'go' script to make sure they run on a server reboot.
- Now you should be able to see some stats, open your browser and go to http://tower:81/mrtg/<name>
If directory listing is still enabled you should see a directory with html,png,log and old files
- Click on a html file and it should look something like this:
If there is no 'green' line yet, its probably because there is no data to monitor yet, just check it in a few hours.
That is pretty much it, there are a lot of sites about monitoring all kinds of things, from fan speed & cpu temperature to UPS status or even outside temprature.
No comments:
Post a Comment