Monitor your server with Zabbix (pretty graphs included)
Saturday 01/17/2009 – Category: Uncategorized – No Comments
(...or, how MRTG is too much trouble to setup)

My server was having spiking load averages this past week and I had no idea was going on; my top output didn't have any processes that stood out and I didn't have any cron jobs running either. A friend suggested I use a monitoring tool like MRTG to keep track and graph my performance. After downloading and compiling I couldn't for the life of me figure out how to get MRTG fully working (following the guide here). I was able to get the free memory and TCP connection graphs working but had no luck with the CPU usage graph--the one I really wanted to see.
After a few hours I finally gave up on MRTG and started looking for other solutions: Cacti, Zenoss, Nagios...I eventually ended up choosing Zabbix because it looked more lightweight and less intimidating to setup...and most importantly it generated graphs of relevant data.
Some gotchas during the setup process:
- The install script installs the PHP admin interface into /etc/local/zabbix (or something like that), creates an apache conf file that aliases whatever you set your web dir to be, and tries to restart Apache. Since I'm using nginx this obviously didn't work so I ended up copying /etc/local/zabbix to a public web directory.
- It isn't completely apparent that you have to go to Administration > Installation to setup Zabbix for the first time
- Setup items to monitor under Configuration > Items
- Setup graphs under Configuration > Graphs
Remotely access your Mac with Screen Sharing (and other fun stuff!)
Saturday 01/17/2009 – Category: Uncategorized – No Comments
I've recently transitioned to using a separate machine work but wanted to be able to access my home lappy in case I needed anything. Here's how I got stuff working:
Set up Screen Sharing (from the helpful guide at Lifehacker)
- Make sure Screen Sharing and Remote Login are enabled in your Sharing preferences pane
- Configure your router to forward port 5900 and 22 to the IP of your local machine
- (Optional) Create a custom domain at dyndns.com to point to your IP
- From your other machine, create an SSH tunnel for the VNC connection: ssh -L 5900:127.0.0.1:5900 user@remote_machine_ip
- Still on your other machine, switch to Finder and select Go > Connect to Server and connect to vnc://localhost
- You should be connected!
Mount your remote filesystem with Macfuse and Macfusion
The built-in Screen Sharing app doesn't support drag-and-drop between windows so we'll have to set up an alternative for that. Macfuse and Macfusion enable you to mount a remote filesystem that shows up as just another volume on your system.
- Download and install Macfuse and Macfusion
- You should be able to easily setup a connection and mount your SSH filesystem through the Macfusion GUI.
Listen to your iTunes Library
I didn't really want to copy all my music to the other machine so I found an app called Simplify Media that lets you share your iTunes library over the internet. Make sure you have your library shared, install the client on both machines, and sign on with the same screenname. Your remote library should now show up under the Shared section of the sidebar.
Ending Notes
Your performance may vary depending on your internet connection on both sides. With Screen Sharing, I definitely wouldn't be able to be productive working on the remote machine due to the refresh lag but for quick and simple tasks (like retrieving a file from the Trash) it works well enough. Simplify Media works as advertised but can have some lag in streaming between tracks.
Combining AND and OR for complex expressions (SQL)
Thursday 01/8/2009 – Category: Uncategorized – No Comments
This is a pretty basic concept, but for some reason I forgot the power of parentheses:
To select people with first name equal to "Jason" and last name equal to "Tom" or "Ting":
SELECT * FROM people WHERE
first_name='Jason'
AND (last_name='Tom' OR last_name='Ting')
PHP strftime on Windows is stupid
Thursday 01/8/2009 – Category: Uncategorized – No Comments
Apparently %e, %T, %R and %D (there might be more) don't work on Windows because "not all conversion specifiers may be supported by your C library".
Workaround: You can add the # flag to force single digits and remove the leading zero without the space that %e will add.
Examples:
%#d for day of the month
%#I for the 12-hour clock hour
Visualize your music listening habits with LastGraph
Saturday 01/3/2009 – Category: Uncategorized – No Comments
Ok, so this requires that you have a Last.fm account with recorded data...if you don't, you can just admire my pretty graph.
LastGraph lets you create really cool stacked graph of your listening habits. Just stick in your Last.fm username and you can generate a timeline poster based on a certain timeframe.
LastGraph is inspired by Lee Byron's What have I been listening to? project. More information on stacked graphs and academic paper can be found on Lee Byron's site.
Recent Posts
- More Flickr Original Updates
(Sunday 01/23/2011 – Uncategorized – 13 Comments) - Flickr Original updates
(Saturday 08/7/2010 – Uncategorized – 19 Comments) - LED Light for iPhone 4
(Monday 06/28/2010 – Uncategorized – 65 Comments) - WWDC 2010: Worth Every Minute
(Monday 06/14/2010 – Uncategorized – No Comments)

