View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 10 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Tue Jun 05, 2007 2:54 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
I find myself always looking to customize/improve my KnoppMyth box and it got me wondering what others may have done to trick out their box(en). What kind of things have you done? I have not done too much. I added TorrentFlux and made some tweaks to existing and created new scripts for rrdtool. TorrentFlux is pretty basic. I don't really use it except to seed R5F1 and get the occasional distro or app.

Here's what I did for rrdtool... First, I added HD temp monitoring for a second hard drive. I also added a script to monitor my master backend UPS. It uses NUT to monitor is vital stats and this is my script:
Code:
#!/usr/bin/perl
#
#  rrd_Ups.pl
#       Ups data collection routine for KnoppMyth
#
########################################################################
# Configuration:
my $dbf = 'Ups';
my $configfile = '/etc/rrd.config';
########################################################################
use RRDs;

if (! -d "/myth") { $configfile = "./D_rrd.config"; }   # DEBUG
do $configfile;

sub create {
    #   $_[0] = filename
    if (! -e "$log/$_[0].rrd") {
        print "Create db for $_[0] => $log/$_[0].rrd\n";
        RRDs::create( "$log/$_[0].rrd", "-s 300",
            "DS:runtime:GAUGE:600:0:U",
            "DS:charge:GAUGE:600:0:U",
            "DS:load:GAUGE:600:0:U",
            "RRA:AVERAGE:0.5:1:576",
            "RRA:AVERAGE:0.5:6:672",
            "RRA:AVERAGE:0.5:24:732",
            "RRA:AVERAGE:0.5:144:1460");
        $ERROR = RRDs::error;
        print "Error: RRDs::create failed for '$_[0]' : $ERROR\n" if $ERROR;
    }
}

my ($runtime, $charge, $load, $model, $status);

sub gather {
        my @line = `$CMD $name$host`;
        $val_a_1 = $line[0];
        my @val_a_2 = split( /:/, $val_a_1 );
        $charge = $val_a_2[1];
        $charge =~ s/[\n ]//g;
        $val_b_1 = $line[3];
        my @val_b_2 = split( /:/, $val_b_1 );
        $runtime = $val_b_2[1]/60;
        $runtime =~ s/[\n ]//g;
        $val_c_1 = $line[20];
        my @val_c_2 = split( /:/, $val_c_1 );
        $load = $val_c_2[1];
        $load =~ s/[\n ]//g;
        $val_d_1 = $line[22];
        my @val_d_2 = split( /:/, $val_d_1 );
        $model = $val_d_2[1];
        $model =~ s/[\n ]//g;
        $val_e_1 = $line[23];
        my @val_e_2 = split( /:/, $val_e_1 );
        $status = $val_e_2[1];
        $status =~ s/[\n ]//g;
        print "$dbf: $name Battery Charge = $charge (%)\n";
        print "$dbf: $name Battery Runtime = $runtime minutes\n";
        print "$dbf: $name UPS Load = $load (%)\n";
        print "$dbf: $name UPS Model = $model\n";
        print "$dbf: $name UPS Status = $status\n";
}

sub update {
    #   $_[0] = filename
    RRDs::update( "$log/$_[0].rrd", "-t",
        "runtime:charge:load",
        "N:$runtime:$charge:$load");
    $ERROR = RRDs::error;
    print "Error: RRDs::update for '$_[0]' : $ERROR\n" if $ERROR;
}

sub graph {
    #   $_[0] = time interval (ie: day...)
    #   $_[1] = filename suffix.
    RRDs::graph( "$png/$dbf-$_[1].png", "-s -1$_[0]", "-aPNG",
        "-w $Gwd", "-h $Ght", "-E", "-l 20", "-M",
        "--color", "SHADEA$color",
        "--color", "SHADEB$color",
        "--color", "BACK$color",
        "-t UPS Statistics ($name $model / Status: $status) :: $_[0]",
        "DEF:runtime=$log/$dbf.rrd:runtime:AVERAGE",
        "LINE3:runtime$color_runtime:Battery Runtime (min)\\:",
        "GPRINT:runtime:MIN:Minimum\\: % 5.1lf",
        "GPRINT:runtime:MAX:Maximum\\: % 5.1lf",
        "GPRINT:runtime:AVERAGE:Average\\: % 5.1lf",
        "GPRINT:runtime:LAST:Current\\: % 5.1lf \\j",
        "DEF:charge=$log/$dbf.rrd:charge:AVERAGE",
        "LINE3:charge$color_charge:Battery Charge (%)\\:    ",
        "GPRINT:charge:MIN:Minimum\\: % 5.1lf",
        "GPRINT:charge:MAX:Maximum\\: % 5.1lf",
        "GPRINT:charge:AVERAGE:Average\\: % 5.1lf",
        "GPRINT:charge:LAST:Current\\: % 5.1lf \\j",
        "DEF:load=$log/$dbf.rrd:load:AVERAGE",
        "LINE3:load$color_load:UPS Load (%)\\:         ",
        "GPRINT:load:MIN:Minimum\\: % 5.1lf",
        "GPRINT:load:MAX:Maximum\\: % 5.1lf",
        "GPRINT:load:AVERAGE:Average\\: % 5.1lf",
        "GPRINT:load:LAST:Current\\: % 5.1lf \\j");
    $ERROR = RRDs::error;
    print "Error: RRDs::graph failed for '$_[0]' : $ERROR\n" if $ERROR;
}
########################################################################
create "$dbf";
gather;
update "$dbf";
graph 'day',   'Daily';
graph 'week',  'Weekly';
graph 'month', 'Monthly';
graph 'year',  'Yearly';
########################################################################
# End


And the associated /etc/rrd.config
Code:
#  rrd_Ups.pl configuration     # NUT UPS driver stats
#-----------------------------------------------------------------------
$name = 'dynex';                # name of the UPS
$host = '@localhost';           # Host the UPS is connected to
$CMD = '/bin/upsc';             # Command to get UPS stats
$color_charge = '#FF0000';      # Red
$color_runtime = '#00FF00';     # Green
$color_load = '#FF00FF';        # Magenta (mixed red with blue)
#=======================================================================


What works with your NUT monitored UPS depends on what the UPS is capable of. If you have NUT installed, run the following as root:
Code:
 # /bin/upsc upsname@host
Substitute your UPS name and host. Then, around line 258 of /usr/local/bin/rrd_Configure.sh add a line like this:
Code:
    Ups         "UPS Statistics"                on \
and then execute /usr/local/bin/rrd_Configure.sh
I don't know if this works with UPS' that run on ApcUpsd, but I imagine there's a way, but I don't know it.

Ok, now it's your turn! :D

_________________
Mike
My Hardware Profile


Last edited by mihanson on Tue Jun 05, 2007 3:30 pm, edited 1 time in total.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 05, 2007 3:29 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
Oh, and I don't mean to limit this to just software. If you've done any cool physical things to your box, let us know!

_________________
Mike
My Hardware Profile


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 05, 2007 10:37 pm 
Offline
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location: Warwick, RI
Hi,

Glad to see some one else that uses the KM box for "other" things besides tv :) Actually real time tv is probably my least used feature but the record time shift is nice so I do get to enjoy a special here and there.

On my main family box, things are fairly tame. R5C7 (is a rock) on a Dell Gx1 600mhz, 384 mem 300gig drive. I have it working in the background as a ftp server feeding my son's weather web pages also. Of course since it has to handle the files I strip out some data and feed that to a Betabrite display on com 1. Com2 is reserved currently for my modem (dial in / out)

Using an old version of saytime, I have it give me time cues during parts of the day if the music isn't playing. apt-get install saytime is the only recent version I can locate but I think it stinks. Find the original as is much better.

I have it record a couple webstreams of old radio shows every Saturday and Garrison Kiellor on Sunday which over writes the previous week recording. That way sometime during the week I get to listen to it without any monkey business doing a scan.
part of my cron:
# Catch The Hour of Wolf 5 AM Saturdays
2 5 * * sat sh /home/mythtv/RSS/catchthewolf

# Catch Car Talk 10AM Saturdays
2 10 * * sat sh /home/mythtv/RSS/catchct

# Catch prairie home companion 11AM sundays
2 11 * * sun sh /home/mythtv/RSS/catchphc

I was going to set it as a print server also but the days are too short and I still have to work to eat :).

I have my work laptop do triple boot, win2k, ubuntu, and just upgraded to F1 so I am covered :) If you put Fiesty Fawn on besure to disable the file checking in the fstab or it will try to check the myth partitions. No harm but marks them bad and you can't read after a check. So simply make them 0 0.

If I could ever figure out wireless in KM I would not need ubuntu. I do printing with cups (very handy to print to pdf), synaptic I make a sudo, draw with dia, work on serial stuff with gtkterm, file work is with gedit, firefox (iceweasle), mozilla-thunderbird (icedove) a bunch of the old simple games, load in bubbles (is not installed) ekiga viop (still learning voip) xmms so I can listen to tunes while I work / play. Add ftp so one can get / put stuff. Setserial, mgetty, ntpdate and a few minor tools.That covers most of it except openoffice also. You can't load openoffice in the last versions :( There is an issue with a man page like that is going to break anything.

I have a "few" other KM boxes doing duty outside of the pvr world but it is a Debian box so why not make it work. Because they are located in remote areas (highly visible by about 200,000 people each day) I have to use dialup to keep the clock in tune and report back to me a status :) Like having the kids check in every so often just to know they are ok.

There is more, motion doing securty work since last Halloween and my list still goes on. My menus are TOTALLY non standard as they have to acommadate the extra apps. Oh, yes XM Radio for a friend as he has an XM account, I have the menus but can't play them but his kids love it.

KM on Debian is probably the best thing since Quick Basic and sliced bread, at least for me :) If I ever obtain any compensation I have a couple folks who will share..

That's my two cents worth.
Mike


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 1:20 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
mjl wrote:
I have it record a couple webstreams of old radio shows every Saturday and Garrison Kiellor on Sunday which over writes the previous week recording. That way sometime during the week I get to listen to it without any monkey business doing a scan.
part of my cron:
# Catch The Hour of Wolf 5 AM Saturdays
2 5 * * sat sh /home/mythtv/RSS/catchthewolf

# Catch Car Talk 10AM Saturdays
2 10 * * sat sh /home/mythtv/RSS/catchct

# Catch prairie home companion 11AM sundays
2 11 * * sun sh /home/mythtv/RSS/catchphc


I'd like to know more about how you accomplish recording a stream and listening later. I understand how the cron part works, but can you provide more detail otherwise? You definately have a busy KM box... :shock:

_________________
Mike
My Hardware Profile


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 1:36 pm 
Offline
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location: Warwick, RI
Hi,

A search of Garrison shows:
http://mysettopbox.tv/phpBB2/viewtopic. ... 61643b8159

Details are not difficult if I can make it work :)
Mike


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 5:17 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
mjl wrote:
A search of Garrison shows:
http://mysettopbox.tv/phpBB2/viewtopic. ... 61643b8159

Details are not difficult if I can make it work :)


Hmmm... I guess this is not exactly what I'm looking for. I'm looking to take a live audio stream and save it as a file (mp3, ogg, flac, whatever). I did a little research and I should be able to do it with VLC. KM comes with VLC installed, so I just need to work out the details and experiment.

_________________
Mike
My Hardware Profile


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 6:50 am 
Offline
Joined: Mon Nov 28, 2005 10:44 am
Posts: 137
Location: Austin, TX
You should be able to use streamtuned (by the same guy as mythstream). There's some (sparse) info here:
http://home.kabelfoon.nl/~moongies/streamtuned.html

I haven't tried it yet, but was going when I have time...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 7:15 am 
Offline
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location: Groton, MA
I origially had my mythbox doing multiple duty by adding other LAMP apps WebCalendar and Coppermine (photo album). This setup work great until I wanted to upgrade Mythtv and found out from the wife that WebCalender have become a 'Mission Critical' app at my house.

In the past month, i have setup a separate webserver on a cheap ($30) ebay dell. The new dell now runs, WebCalendar, Coppermine, several webpages, privoxy (proxy server). This box is exposed to the Internet and forwards 'mythweb' requests to the mythbox.

Mythbox is currently in the process of getting a fresh R5F1 install.

Try not to let add-ons become mythtv-version anchor.

_________________
R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 7:43 am 
Offline
Joined: Sun Jun 12, 2005 10:55 pm
Posts: 3161
Location: Warwick, RI
Hi,

I can't post all the code because it is copywrited by the magazine and I don't wish to step on toes. If you go to the link at LJ mag, you can download the scripts that are outline in his article.

http://linuxjournal.com/article/8402
which will let you obtain the files.
ftp.ssc.com/pub/lj/listings/issue137/8171.tgz

What I can offer is the "tweaks" that I did to grab parts of the streams and save them to my /myth/music as an .mp3 via a cron task.

A search through the LJ archives should bring up the actual article. If I find my notes on the article, I will share.

I did not implement the rrs feed part as I had no need for that feature.

This is interesting also: http://www.linuxjournal.com/issue/140
Mike


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 7:55 am 
Offline
Joined: Tue Jun 14, 2005 6:34 am
Posts: 116
Location: Indiana
One of my first mods was building my Myth frontend out of an old Vectrex system (a dead one :( ) and a via epia. It's still a work in progress, but I was able to get the joystick to work with menu navigation. I still plan on adding a slot loading drive to clean up the front and get some Vectrex roms loaded for playing the old games. :D

I'm planning my HD frontend now and thinking about the Odyssey^2 system in my basement. Using the membrane keyboard on that unit would be slick. :wink:

_________________
Backend R5E50
P4 1.3 - 384MB, 250GB HD, HD5000AV, PVR150 non MCE
Frontend R5E50
EPIA M1000 - 512MB, 40GB HD, Streamzap
KnoppMyth Folding Team Stats


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 103 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu