Monitor bubba and downloads on your SoundBridge.
Posted: 17 Dec 2007, 19:19
This how to will show you how to use a SoundBridge M1001 to display statistics about hard drive usage, temperature and downloads.


Disclaimer
First of all, lets start with the boring stuff. This software is distributed as is, WITHOUT ANY WARRANT of any kind. You use it on your own risk. I accept no liability should your hair catch fire, girlfriend get pregnant or leave you, or any other issue you may encounter directly or indirectly due to your (miss|ab)*use of these instructions. I'm no Linux or Security expert so there may be security issues. This is software we're talking about and there will probably be bugs (maybe it is me, but I have so far never released any software that is free from bugs on the first try). The program is very naive and may lack proper error handling. If you do spot any bugs or security issues, please let me know. I'm eager to learn and will do my best to fix the problems.
Prerequisits
Still with me??? Ok, here goes nothing??!?. My bubba have packages from the Debian repositories that aren't part of Excitos repositories. Due to earlier installs, there may be dependancies that I don't know of. If you find a dependancy I haven't mentioned, let me know.
Here's what I know you need to install:
I'm not very good at writing instructions. Writing them in another language surely doesn't help, so you may have to read between the lines here and there. There are plenty of good instructions on how to do some of the tasks mentioned here, just search the forum or the internet.
Now, log in as root, install hddtemp, following johannes instructions, and while you're at it, throw in
Two dependencies solved, one to go. To download and unpack my files (note where you're putting theme, I put mine in "/home/johan/scripts/BubbaMon"), type:
X.Y (in BubbaMon-X.Y) is the version number you wrote down earlier.
Examine the settings at the top of BubbaMon.pl and change them to fit your needs. Pay special attention to the "use lib ..." part, it is important that you update the path here to the folder you installed the files to.
Output from the cronjob will be captured to a file named BubbaMon.log (or what ever you name it). If you don't see anything on the SoundBridge display when you expect to, examine this file. Note that it'll be overwritten on each run. First you may have to change access rights so www-data (we will run the script as this user) can write to this file. Type
Change the paths to where your files are stored (you need this path later on when editing the crontab).
We need to communicate with the file transfer daemon over a message queue. In order to read/write on this queue, we need proper rights. Root and www-data both have read/write access, but we don't want to run the script as root, so we enter the cron job in www-datas cron table. Type
This will start nano, to let you enter the cronjob. Type
Save and exit. You will of course have to change the path to where you saved the perl script, where you put the log file, and also change [USERNAME] to the user name you want. The first part (*/10) means this command will execute every ten minutes. Shouldn't be to difficult to figure out what to change if you want it to run every 5 minutes instead
A word of warning though, I don't know what will happen if time is too short so that two jobs overlap, but I do know there's nothing stopping them from doing so. Bad things are bound to happen, so keep it at a safe level. I suggest you only have one or two downloads active while testing, so that you can have a smaller interval (say 2 or maybe even 1 minute) without risking an overlap. Just remember to increase this interval before starting a lot of downloads.
Crontab allows you to have even more complex rules, like only running this script during day time. Search the internet for more info on crontab.
There you have it, I think that's all there is to it. You should be able to monitor your downloads on the SoundBridge.
Have fun.... Let me know what you think of it, what could be better, features for the future......
Best regards,
Johan


Disclaimer
First of all, lets start with the boring stuff. This software is distributed as is, WITHOUT ANY WARRANT of any kind. You use it on your own risk. I accept no liability should your hair catch fire, girlfriend get pregnant or leave you, or any other issue you may encounter directly or indirectly due to your (miss|ab)*use of these instructions. I'm no Linux or Security expert so there may be security issues. This is software we're talking about and there will probably be bugs (maybe it is me, but I have so far never released any software that is free from bugs on the first try). The program is very naive and may lack proper error handling. If you do spot any bugs or security issues, please let me know. I'm eager to learn and will do my best to fix the problems.
Prerequisits
Still with me??? Ok, here goes nothing??!?. My bubba have packages from the Debian repositories that aren't part of Excitos repositories. Due to earlier installs, there may be dependancies that I don't know of. If you find a dependancy I haven't mentioned, let me know.
Here's what I know you need to install:
- hddtemp. johannes has made a howto http://www.excito.org/forum/viewtopic.php?t=417. You need to run it as a deamon because the program will connect to the TCP/IP port.
Net::Telnet (package is named "libnet-telnet-perl").
My files Visit http://medlem.spray.se/sixfeetfive/temp/ (not much to see yet) and write down (or copy link) the version number of the latest version (but don't download it just yet, we will use wget later). I haven't had any time writing proper instructions so there isn't much to see in this tar file.
I'm not very good at writing instructions. Writing them in another language surely doesn't help, so you may have to read between the lines here and there. There are plenty of good instructions on how to do some of the tasks mentioned here, just search the forum or the internet.
Now, log in as root, install hddtemp, following johannes instructions, and while you're at it, throw in
Code: Select all
apt-get install libnet-telnet-perl
Code: Select all
wget http://medlem.spray.se/sixfeetfive/temp/BubbaMon-X.Y.tgz
tar xzf BubbaMon-X.Y.tgz
mkdir -p /home/johan/scripts/BubbaMon
mv BubbaMon-X.Y/* /home/johan/scripts/BubbaMon
nano /home/johan/scripts/BubbaMon/BubbaMon.pl
Examine the settings at the top of BubbaMon.pl and change them to fit your needs. Pay special attention to the "use lib ..." part, it is important that you update the path here to the folder you installed the files to.
Output from the cronjob will be captured to a file named BubbaMon.log (or what ever you name it). If you don't see anything on the SoundBridge display when you expect to, examine this file. Note that it'll be overwritten on each run. First you may have to change access rights so www-data (we will run the script as this user) can write to this file. Type
Code: Select all
touch /home/johan/scripts/BubbaMon/BubbaMon.log
chmod o+rw /home/johan/scripts/BubbaMon/BubbaMon.log
We need to communicate with the file transfer daemon over a message queue. In order to read/write on this queue, we need proper rights. Root and www-data both have read/write access, but we don't want to run the script as root, so we enter the cron job in www-datas cron table. Type
Code: Select all
crontab -e -u www-data
Code: Select all
*/10 * * * * /usr/bin/perl /home/johan/scripts/BubbaMon/BubbaMon.pl [USERNAME] &>/home/johan/scripts/BubbaMon/BubbaMon.log

Crontab allows you to have even more complex rules, like only running this script during day time. Search the internet for more info on crontab.
There you have it, I think that's all there is to it. You should be able to monitor your downloads on the SoundBridge.
Have fun.... Let me know what you think of it, what could be better, features for the future......
Best regards,
Johan