Features Tech

Pandora unix agent running on ipod touch :)

February 3, 2010

Pandora unix agent running on ipod touch :)

A bored developer is something very dangerous… you never know what it will happen…

This weekend I was quite bored and somehow I thought it was interesting to try to run Pandora Unix Agent on my iPod Touch. It’s a jailbroken 1st generation device, so I connected to the Ipod with SSH, and with apt installed the perl binaries from http://coredev.nl/ (there are instructions there to use this

Ipod Touch Agent on Pandora FMS console
Ipod Touch Agent on Pandora FMS console (click to enlarge)

repository).

Once I’ve perl working on /usr/local/bin/perl It was just a matter of updating the first line of the scripts to point to the current location of perl to make it work… wooow the perl agent is soooo easy to port :)

The of course most of the modules didn’t work as is… so I made some testing modules (check at the end of the post) to show how it was working.

And now In my testing server there is an ipod-touch agent :)

I start / stop it manually, I actually don’t want to have it running as a daemon as most of the time i don’t have access to the console to see the actual data.

In case anyone is interested on monitoring Darwin, here are the modules I’ve used:

module_begin
module_name proctotal
module_type generic_data
module_exec ps -A | wc -l
module_description Total number of processes
module_end

module_begin
module_name sshDaemon
module_type generic_proc
module_exec ps -Af | grep sshd | grep -v "grep" | wc -l
module_description SSH Server daemon status
module_end

module_begin
module_name loadavg1m
module_type generic_data
module_exec sysctl vm.loadavg | grep -o '[0-9]\+\.[0-9]\+*' | head -1
module_description Average process in CPU (Last minute)
module_end

module_begin
module_name freemem
module_type generic_data
module_exec top -l 1 | grep PhysMem | grep -o '[0-9]\+\.\?[0-9]\+*' | tail -1
module_description Free memory
module_end

module_begin
module_name userCPU
module_type generic_data
module_exec top -l 1 | grep "CPU usage" | grep -o '[0-9]\+\.\?[0-9]\+*' |tail -3 | head -1
module_description User CPU Usage
module_end

module_begin
module_name sysCPU
module_type generic_data
module_exec top -l 1 | grep "CPU usage" | grep -o '[0-9]\+\.\?[0-9]\+*' |tail -2 | head -1
module_description Sys CPU Usage
module_end

module_begin
module_name TCPPacketsSent
module_type generic_data_inc
module_exec netstat -s -p tcp | grep "packets sent" | grep -o '[0-9]\+'
module_description TCP Packets Sent
module_end

module_begin
module_name TCPPacketsReceived
module_type generic_data_inc
module_exec netstat -s -p tcp | grep "packets received" | grep -o '[0-9]\+'
module_description TCP Packets Received
module_end


Written by:



One comment
  1. I would say a bored developer is creative rather than dangerous and you are a live example of it. As we can see you did a great job and very helpful invention. It's good to see the modules so we also can try to use it with our ipod. So when will you be bore again?? So we can get something new again.. :-)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.