Making the most of your Netflix account by streaming video

Roku streaming media applianceI have been a long time Netflix user, and love the fact that I can rent movies through the mail and return them on my own schedule. Netflix now allows you to stream a number of movies to your desktop, though the streaming service requires that you are able to run Microsoft silverlight. This is pretty awesome, though I wanted a way to be able to watch movies on my high definition tv without having to involve a PC. After a bit of searching, I came across the Roku digital video player. These nifty little devices provide native integration with Netflix, and provide a remote control that allows you to find movies, start movies and pause movies all from the comfort of your favorite chair.

Now, I was extremely skeptical about these devices at first, but the glowing reviews on Amazon set me at ease and I decided to pick on up Here are the other reasons I purchased mine:

1. Each Roku comes with an HDMI port that can be hooked up to your receiver or digital tv

2. Roku devices support wireless (802.11G) as well as wired Ethernet connectivity

3. The Roku remote allows you to browse, start and pause movies from a distance

4. All of the available Netflix streaming movies are one click away (you have to pay for Netflix though)

5. The Roku is CRAZY easy to get up an operational

This review wouldn’t be complete without listing the downsides, which I have only found one. I have spent WAY TOO MANY HOURS watching documentaries and educational videos, which have precluded me from blogging about technology. The break has actually been kinda nice, and has allowed me learn about all kinds of stuff (history of American presidents, Rome, The Dark ages, various painters, finance related topics, etc.). If you don’t already have a device with native Netflix integration, then the Roku may be for you!

Configuring the Solaris FTP server to log extended data

I periodically use the stock Solaris FTP server on some of my servers, especially when I need to move tons of data around. Enabling the ftp service in Solaris is a snap:

$ svcadm enable network/ftp

The default ftp configuration leaves a lot to be desired, especially when you consider that nothing is logged. To configure the FTP daemon to log logins, transferred files and the commands sent to the server, you can enter the svccfg shell and add some additional options to the in.ftpd command line:

$ svccfg

svc:> select ftp

svc:/network/ftp> setprop inetd_start/exec=”/usr/sbin/in.ftpd -a -l -L -X -w”

svc:/network/ftp> listprop

The “-a” option will enable the use of the ftpaccess file, the “-l” option will log each FTP session, the “-L” option will log all commands sent to the server, the “-X” option will cause all file acesses to be logged to syslog, and the “-w” option will record the logins to the wtmpx file. Since most of this information is logged using the daemon facility and info log level, you will need to add a daemon.info entry to /etc/syslog.conf if you want the data to be logged to a file (or to a remote log server). To force the changes listed above to take effect, you will need to restart the inetd, system-log and ftp services:

$ svcadm restart inetd

$ svcadm restart network/ftp

$ svcadm restart system-log

Now each time an FTP transfer occurs, you will get entries similar to the following in the system log:

Nov 24 17:46:32 prefetch01 ftpd[9304]: [ID 716067 daemon.info] AUTH GSSAPI
Nov 24 17:46:32 prefetch01 ftpd[9304]: [ID 716067 daemon.info] AUTH KERBEROS_V4
Nov 24 17:46:32 prefetch01 ftpd[9304]: [ID 165209 daemon.info] USER prefetch
Nov 24 17:46:32 prefetch01 ftpd[9304]: [ID 125383 daemon.info] PASS password
Nov 24 17:46:32 prefetch01 ftpd[9304]: [ID 124999 daemon.info] FTP LOGIN FROM 1.2.3.4 [1.2.3.4], backup
Nov 24 17:46:32 prefetch01 ftpd[9304]: [ID 470890 daemon.info] SYST
Nov 24 17:48:42 prefetch01 ftpd[9304]: [ID 225560 daemon.info] QUIT
Nov 24 17:48:42 prefetch01 ftpd[9304]: [ID 528697 daemon.info] FTP session closed

While FTP isn’t to be relied on for 99% of what we do, it definitely still has its place.

Using Net-SNMP to monitor processes and execute Perl scripts by hitting a MIB

One really cool feature about net-snmp is that it can monitor processes on a system. If snmpd notices that a process is no longer running, you can specify a script to be executed which can correct the problem. Lets take a look at some examples found here

# At least one web server process must be running at all times

proc httpd

procfix httpd /etc/rc.d/init.d/httpd restart

# There should never be more than 10 mail processes running

# (more implies a probable mail storm, so shut down the mail system)

proc sendmail 10

procfix sendmail /etc/rc.d/init.d/sendmail stop

# There should be a single network management agent running

# (“There can be only one”)

proc snmpd 1 1

This can be an interesting use of Puppet, Chef, or CFengine, which are configuration management engines. Depending upon the type of host (webserver, mail server, etc.) you could set up and establish different types of snmpd.conf files for that environment. Granted, things like Solaris’ 10 SMF can automatically restart services, but this is a cool feature built into net-snmpd if you weren’t already aware that it was there! Secton 8 of the net-snmp README.Solaris file also has some other examples if you’re interested.

One other really cool feature about net-snmp is the ability to remotely execute Perl scripts by simply hitting a MIB. One example could be something like a “clean up disk space” script. Here’s an outtake from the README.Solaris file showing an example of the Perl script execution in action:

Net-SNMP may be compiled with Perl support by configuring like:

./configure -enable-embedded-perl …

Once you have compiled and installed net-snmp you can test the Perl capabilities of the final installation by doing the following:

Copy the perl_module.pl script found at

http://www.net-snmp.org/tutorial-5/toolkit/perl/index.html

to /usr/local/net-snmp and modify your /usr/local/share/snmp/snmpd.conf file to contain the entry:

perl do “/usr/local/net-snmp/perl_module.pl”;

then do:

/usr/local/bin/snmpwalk -v 2c -c whatever localhost .1.3.6.1.4.1.8072.999

It should return the following:

NET-SNMP-MIB::netSnmp.999.1.2.1 = STRING: “hello world”

Keeping up to date with opensolaris developments

If you are like me, you like to keep up with the latest Solaris happenings. For the latest putbacks into opensolaris, you can check out the genunix putback page:

Genunix putback log

To keep up with new ARC case submissions, you can keep an eye on the PSARC page:

PSARC page

If you would prefer to get e-mail notifications for putbacks and new PSARC cases, you can sign up on the opensolaris mailing list page.

Greping through binary data with zgrep and gzcat

I periodically need to look for a given string in one or more compressed log files. Taking the time (and resources) to decompress each file on the file system takes time, especially when I don’t plan to leave the file uncompressed. When these situations arise, I turn to my good friends gzcat and zgrep.

The zgrep utility allows you to look for a pattern in one or more compressed files. If you want to find the string “target port down” in a set of logs named sanlogs*.gz, you can do the following:

$ zgrep “target port down” sanlogs*.gz

If zgrep finds the string, it will print it. Alternatively, you can use the gzcat utility to decompress the contents of a file prior to sending it to another tool for processing:

$ gzcat services.gz | tail -2
# 48557-49150 Unassigned
# 49151 IANA Reserved

Both tools are incredibly useful, and should be in every SysAdmins tool bag.