PowerShell Ping Test

Posted by gygon on Wednesday, November 16th, 2011

Used this little script the other day for a basic network test to an access point I was testing. It just pings the device every 10 seconds (or whatever you set it at) and only outputs when there is an error and the time it occurred. Made for an easy way to leave this running over […]

continue reading

Using PowerShell to monitor a web server

Posted by gygon on Monday, November 14th, 2011

A couple years ago I posted about a PowerShell script that would read in a web page. I used that to setup a basic web site test to go through a list of web sites/servers and make sure they were up and running and email an alert if they were down or the size of […]

continue reading

Monitoring the Event Log with PowerShell

Posted by gygon on Saturday, March 21st, 2009

One of my goals with learning more about PowerShell is to be able to monitor the event logs on servers and notify me via email when certain events happen. The system I’m looking to monitor are not part of a domain, are in remote locations on isolated networks. Some of the main things I’m looking […]

continue reading

Setup MRTG on Ubuntu

Posted by gygon on Tuesday, May 5th, 2009

I have an old system that is running Ubuntu on it for the main purpose of running MRTG. Once it was setup the only time I ever connect to it (other than viewing the stats pages) is when I need to add additional devices to be monitored. Because I don’t do this often I always have to look up the steps to do this so figured I would make my life easier and document it here so it’s easier to find any maybe will help someone else as well.

Connect to the box either through the console or via SSH and run the following commands to add device to be polled by MRTG:

sudo cfgmaker –global ‘WorkDir:/var/www/mrtg’ –global ‘Options[_]: bits,growright’ –output /etc/mrtg.cfg public@

The above will poll the device ( using “public” for SNMP and create a config file called mrtg.cfg in the /etc/ folder. If needed, edit the config file to make any changes.

In order to have MRTG run every five minutes, edit crontab to add the new config file. I have mine setup to space out various config files on alternating 5 minute blocks:

sudo crontab -e

With the file open, add the following line, modified as needed:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg.cfg -logging /var/log/mrtg.log

Note the above is one line. Last but not least you probably want to create a nice index page for the newly created polling results. to do this run:

sudo indexmaker -output /var/www/mrtg/mrtg.htm /etc/mrtg.cfg

I’m sure there are better ways to do this rather than running everything under full privileges but since this system is on a private network and is only accessed internally, I really wasn’t too concerned with anyone trying to do something to it. Plus the system is so old I think my mobile phone has more processing power on it so I’d feel sorry if anyone wasted their time trying to get into it! :-)

Posted in: Tech, WebDev.

Comments are closed.