Monitor a WD ShareSpace using XYMon on any remote network

Do you happen to be a systems support guy who needs a method of getting the basic stats of a WD ShareSpace into your XYmon or MAG monitor? If you are like me then you are a systems admin responsible for many different networks spread across the Internet. You then may have deployed a few NAS systems including the WD ShareSpace that runs a version of BusyBox Linux. This is good news because WD provides access to the shell over SSH if you enable it via the web admin (advanced section). So now go enable SSH access and then puttythe system using the username “root” and a password of “welc0me”  where the 0 in welc0me is a zero.

With shell access we can do many things, one of which is getting the stats from the system.  Currently we have only 1 method to get the stats to XYmon but we are exploring some custom XYmon client binaries we can distribute in future versions of this article.  That may make this article a mute point so check back every so often for updates.

Today we have to do monitoring in 2 parts,

#1 Have a script on WD ShareSpace running on a regular intervals, that executes  the basic commands to produce the files we need to stat the system in XYmon.

#2 Have a Windows system grab the stat files from WD ShareSpace and process them before sending them on to the XYMon server.

First script is the WD Sharespace script which is a very simple shell script that does nothing more then cat to several text files ( meminfo, df, du, uptime and load) and saves them to a share on the WD ShareSpace called Public. You can modify the script to place files on any share you want. The script should then be executed with the following command while SSHed in to the WD ShareSpace

The first time you run the script you will need to make it executible. To do so type:

chmod 0755 ./Report.sh

The to run the shell script type:

Report.sh &

This will place the script in the background as a process and release your shell so you can logout without stopping the script. The script will run then sleep for 5 minutes then run again replacing files with updated files every 5 minutes until you stop it(which should be never).  You will need to change the permissions on the files the first time you run script so that the report files are world readable. To do this use the following command.

chmod 0777 ./*report.txt

We now have stat files on a share that we want to “FTP” off. The key word here is FTP so we will want to allow anonymous FTP to the WD ShareSpace. Login to the web admin of the WD ShareSpace and enable FTP on the device. This allows the Perl script we use next to grab the stat files, process them and then send them on to the XYmon sever via a proxy connection.

WDShareSpace Scripts

The next step is to setup the Windows system to proxy the stats to the remote XYMon server. I normally use one of the Windows server we monitor via XYMon but if this is the only thing you monitor then a windows desktop can be used as well. Either way you will need a Active State Perl set up on a Windows box to be the proxy.

Today the script is Perl, tomorrow it could be a Powershell or some other language suitable for Windows but for today it’s Perl. Perl is not native to Windows so you will need to add it’s language to Windows by the way of Active State Perl for Windows. To install ASP go to Active State Perl.  Install Perl and make sure you select to place Perl in the PATH variables with in Windows during install process. Now download our Perl script and place it in  a directory on your Windows server.

You should edit the script variables so that it reflects your setups, (Share to look for files in, the name of the WDShareSpace as seen on XYMon server ).  The run the Windows Scheduler and create a new daily schedule to run the perl script “WdShareSpace.pl”. After creating the daily schedule go back in and edit the schedule and select the advanced section. Find the “run every” and set it to 5 minutes and the in the “run for” place in 24 for 24 hours a day. This will get the script running every 5 minutes which is the same schedule as the shell script running on the NAS so you will get updates every 5 minutes.

So to summarize:

We have 2 scripts (Report.sh and WDSharespace.pl) Report.sh runs on the NAS and after permissions are changed it is executed with the (&) symbol after it so it drops to the background and keeps running when you close the ssh window. This script creates a set of report text files in the same directory as the script. The WDShareSpace.pl runs on Windows with Active State Perl installed and it has several varibles in script that need to be edited to point it to the NAS and XYMon servers and it is scheduled to run inside of Windows Scheduler(AT) on a 5 minute interval.

If all is successful you should get some thing like the following in your XYmon server if you configured the BBHOST for the WDShareSpace HOST.

Disk view:

XYMON External Test Script for APC NetBotz Environment Monitor

So you got a APC environment monitor (NetBotz) and you want XYMON / Hobbit / BB to monitor and alert if your tempature is rising? Funny me too.

I spent several hours trying to get a VB script to built to do this and I am just not a big fan of VB. So being a Perl plucker I desided to write one in Perl and share it with

So you got a APC environment monitor (NetBotz) and you want XYMON / Hobbit / BB to monitor and alert if your tempature is rising? Funny me too.

I spent several hours trying to get a VB script to built to do this and I am just not a big fan of VB. So being a Perl plucker I desided to write one in Perl and share it with everyone.   

Here is what it does:

The script  queries via SNMP the OID for the tempature sensors current state and then create a XYMON file and place it in the tmp folder where XYmon(BBWin) resides  so that the XYMON(BBWin) service can pick it up and transmit the information to the BBDisplay.

Prereqs are: Windows host, BBWin, ActiveState Perl 5 installed on windows, snmpget.exe application located at http://www.snmpsoft.com/freetools/snmpget.html
Place SNMPGET.EXE in an area that is seen by Windows PATH.

Add to BBWin.cfg under the <Externals> area of XML:

<load value=”C:\Perl\bin\perl.exe netbotz.pl” timer=”5m” />

and copy this script to the BBWin/Bin directory. Every 5 minutes you should see a “NetBotz” file created in BBWin/tmp and shortly afterwards BBwin will remove file once data is sent. On your BBDisplay you should get a new column called [NetBotz] and when you select the “Dot” it will display the current temp.

You may need to play with the OID # for your install of Netbotz as mine had 8 ports (OID’s) for tempature monitors but we only used 1 port so I am only monitoring that OID.

OID’s are

1.3.6.1.4.1.318.1.1.10.4.2.3.1.5.0.1

through

1.3.6.1.4.1.318.1.1.10.4.2.3.1.5.0.14

So adjust the last digits (1-14) for your sensor location on Netbotz.

Download -> Netbotz Perl script

Enjoy Shannon, aka Cubert

New VBScript created for BBWin External testing for www.AlertOnFailure.com

I’ve created 2 new VB scripts to use with AOF and BBWin’s External test functions. These scripts were tested on BBwin 0.12 and AOF Beta and work great!

[RePing] Ping multiple internal host addresses

Provides the ability to ping multiple host behind a firewall or other device, Great is you need to test to see if a Wireless AP is up or if a network printer is

I’ve created 2 new VB scripts to use with AOF and BBWin’s External test functions. These scripts were tested on BBwin 0.12 and AOF Beta and work great!

[RePing] Ping multiple internal host addresses

Provides the ability to ping multiple host behind a firewall or other device, Great is you need to test to see if a Wireless AP is up or if a network printer is available. There are many systems that do not run a agent that you can ping to see if they are up and running. This all gets reported back to the AOF servers and placed as a “System Dot” called “RePing”. If a host fails to will change status. You can use this to get remote notifications of failures by placing a alert notification rule to the test.

See Script file

[Wares] List All Installed Software on AOF server (BBDisplay)

Wares.vbs is a visual basics script used to upload a list of installed software on a windows host.  In version one we are sending just the data, no status changes are happening. Version 2 will have the ability to alert if apps are added or removed.

See VB Script

These were developed to be used with www.alertonfailures.com  free system monitoring and management services but the scripts will work just fine with any XYmon server or BBDisplay server.