Feb 162014
 

Part 4 of 4 – Part 1Part 2Part 3

Now that you’ve got all your logs flying through logstash into elasticsearch, how to remove old records that are no longer doing anything but consuming space and ram for the index?

These are all functions of elasticsearch. Deleting is pretty easy, as is closing an index.
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-delete-index.html
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-open-close.html

The awesome people working on elasticsearch already have the solution! It’s called curator.
https://github.com/elasticsearch/curator
https://logstash.jira.com/browse/LOGSTASH-211

I like the idea of being able to let a cron job kick off the cleanup so I don’t forget.

To install, we’ll have to instal pip.

sudo apt-get install python-pip

Then use pip to install elasticsearch-curator

pip install elasticsearch-curator

When making a cron job, I always use full paths

which curator
/usr/local/bin/curator

edit the crontab. Any user should have access so I’ll run this under my user.

crontab -e

Add the following line to run curator at 20 minutes past midnight (system time) and connect to the elasticsearch node on 127.0.0.1 and delete all indexes older than 120 days and close all indexes older than 90 days.

20 0 * * * /usr/local/bin/curator --host 127.0.0.1 -d 120 -c 90

If you prefer an alternative, here’s one written in perl.
https://github.com/bloonix/logstash-delete-index

Mar 142012
 

This is just a quick and dirty script to delete MythTV recordings that had been previously transcoded and moved to the stream directory, but have since been autoexpired out of MythTV. This is an issue because trying to pull data outta the MythTV recording database about a recording that has been deleted causes an error because the entry isn’t there anymore. All it does is loop through each file in the stream directory and if it doesn’t exist in /var/lib/mythtv/recordings/ it gets deleted.

Contents of:
/usr/local/bin/mythexpire.pl Continue reading »

Mar 142012
 

Since I’m already transcoding the recordings to h.264, might as well make them easily accessible to my iPhone or Boxee Box or Miro. Since the filenames are more likely to be seen, might as well make them more human readable. The biggest advantage to this renaming a season of a recorded show for archiving using filebot. If you want to get fancy, could use tversity to stream the rss feed to a playstation 3 or an xbox 360, but I still think the Roku is the easiest frontend for previously transcoded material.

Disclaimer: I’ve removed a few things specific to my oddball setup so I can’t guarantee I didn’t break anything.

Contents of:
/usr/local/bin/itunesfeed.pl Continue reading »

Mar 142012
 

Before I forget, here’s my MythTV UserJob1:
/usr/local/bin/mythipodcom.sh %DIR% %FILE%

This script runs on a MythTV recording to remove commercials and transcode to h.264 video that I’ve tested and will play on Android (Motorola Droid), iPhone (iPhone 4), Roku DVP (Original Roku Netflix Player), Boxee Box, and in Miro on Windows.

The contents of
/usr/local/bin/mythipodcom.sh Continue reading »

Mar 142012
 

Once the files have been created, will need to create an XML file the brightscript program on the Roku DVP can parse to display show data. This bit of perl reads the stream directory, sorts by file creation date, picks out the .mp4 files, uses the MythTV bindings to pull out show data, smashes it into some XML and writes it to a file.

Contents of:
/usr/local/bin/feed.pl Continue reading »

Mar 142012
 

This is a lot of the rest of the important configuration changes. I’ve added the bandwidth module (more info available in my previous post: Apache 2 bandwidth control) and enabled port 8080 as well since Cox Communications blocks traffic on 80 and 443. Continue reading »

Mar 062012
 

As soon as I knew they existed, I got a Hexbug Spider. I wish these things existed when I was little. It is COOL!

Now that I’m older and can buy toys for myself, I can do more interesting things with my toys. The Hexbug is IR controlled, like a tv remote control. I have a Microsoft MCE IR blaster connected to a Mythbuntu linux box. LIRC is pretty easy to configure.

Of course this is just a substitute remote control. It isn’t as awesome as what EMGRobotics is doing with the hexbug spider. The biggest advantage of a computer remote control is scripting moves!

DANCE HEXBUG DANCE!

Continue reading »

Nov 202011
 

http://www.mythtv.org/wiki/Database_Backup_and_Restore

One of my first experiences with mythtv was restoring a recording and a dump of the MySQL database before I could buy my own tuner card. It was cool to see recordings populated and get a feel for the UI, but it was ultimately pretty pointless. Anyhoo, I bork’d my mythbuntu setup and needed to migrate my previous recordings to another installation. Come to find out, this has gotten so much simpler than ever before! Continue reading »

Nov 122011
 

http://ip-webcam.appspot.com/

http://dorgem.sourceforge.net/

http://www.splitcamera.com/

The cameras I’m using were like $10 at walmart and are so crappy they don’t have a website. I can’t recommend using these.

Difficulty: the driver for these cameras is so cheap that it will cause windows to bluescreen if you plug two of them into the same computer.

Please, I beg you, find yourself something better, like a 2.0 MP autofocus webcam by rocketfish, like $15 on eBay.

I had recently installed mythbuntu in virtualbox on my laptop so I could test my video transcode scripts. It already had apache installed and configured, so i just installed imagemagick and created a symbolic link to my web dir.

raging@mythrage:~/pictemp$ ls
cam1.jpg cam2.jpg cam.sh montage.jpg pic

raging@mythrage:~/pictemp$ cat cam.sh
#!/bin/sh
# Loop forever
while :
do
# grab jpeg frames from dorgem
wget -O cam1.jpg http://192.168.1.5:8083
wget -O cam2.jpg http://192.168.1.6:8082
# cameras are mounted sideways. rotate left 90 degrees
convert cam1.jpg -rotate -90 cam1.jpg
convert cam2.jpg -rotate -90 cam2.jpg
# I’m still not sure about montage, but this seems to be working
montage cam1.jpg cam2.jpg -geometry +4+4 montage.jpg
done # Start over

sudo ln -s /home/raging/pictemp/ /var/www/pic

The mythbuntu VM was at 192.168.1.4, so I set the source of the ipcam to http://192.167.1.4/pic/montage.jpg and had it detect dimensions. I launched splitcam and skype. I have 2 accounts, so i signed in to different accounts and called myself, seeing video in stereo!

If this got any more ghetto, I might be on http://www.afrotechmods.com/