Posting To ‘Public’ In Google Plus

Posted in Review on October 29th, 2011 by skylercall – 2 Comments

After a long wait of being left out, Google Apps users were finally granted access to Google Plus this week. Imagine my excitement when I heard the news. I have been looking forward to trying out Google’s attempt at dividing conversations into interest groups known as Circles; something they have pushed since the launch of Google Plus. See the embedded video from YouTube if this is news to you.

Unfortunately, I quickly found that many people are posting primarily to the public and not effectively using Circles. I might follow you for a specific reason and don’t want my time used up sorting though the mess of “status updates” and silly posts to get to what I came for. If you are easily offended, do not read the graphic to the right.

I look forward to Google Plus improving as individuals explore its features and find their place in this new community.

* Form pictured was created using JotForm.com


Restore Trends After Renaming Host in Nagios

Posted in How To on August 10th, 2011 by skylercall – Be the first to comment

Renaming a host in Nagios (changing the value of ‘host_name’ inside a .cfg file) breaks the connection to all previous trends for that host and all its services. Nagios keeps all the information about when a host or service is up or down in a separate log file for each day. The log file for today is found at /usr/local/nagios/var/nagios.log while the logs for all previous days are in /usr/local/nagios/var/archives/ named nagios-[MM]-[DD]-[YYYY]-00.log.

When you change the host name in your configuration file you must replace all instances of the old host name with the new one in all the log files. To do this you will run the following commands:

sed -i ‘s/[old host name];/[new host name];/g’ /usr/local/nagios/var/nagios.log
sed -i ‘s/[old host name];/[new host name];/g’ /usr/local/nagios/var/archives/*.log

Example for renaming ‘host_name’ from web-server-1 to web-server-2:
sed -i ‘s/web-server-1;/web-server-2;/g’ /usr/local/nagios/var/nagios.log
sed -i ‘s/web-server-1;/web-server-2;/g’ /usr/local/nagios/var/archives/*.log

Below is a Perl script I wrote that makes this easy and quick:

#!/usr/bin/perl
use warnings;
use strict;

##  This Perl script, written by Skyler Call, prompts the user for the old and new
##  host names and corrects all the Nagios log files; thus keeping all the history
##  from the old host name

# Prompt user to input the old and new host names
my ($oldHostName, $newHostName);
print “Old Host Name: “;
chomp($oldHostName = <STDIN>);
print “New Host Name: “;
chomp($newHostName = <STDIN>);

# Rename host name from old to new in all log files
my $todaysLog = `sed -i “s/$oldHostName;/$newHostName;/g” /usr/local/nagios/var/nagios.log`;
print $todaysLog;
my $pastLogs = `sed -i “s/$oldHostName;/$newHostName;/g” /usr/local/nagios/var/archives/*.log`;
print $pastLogs;

# Alert user that renaming is complete
print “The old host name, $oldHostName, has been replaced with the new host name, $newHostName, in all Nagios log files\n”;


Motion JPEG Support on Android

Posted in Review on November 4th, 2010 by skylercall – Be the first to comment

Since as early as February 18, 2008 Android users have been complaining about the lack of M-JPEG support in the built-in browser. Despite the complaints and the lengthy wait, little or nothing has been done to fix it.

On October 7, 2010 Mozilla announced the beta release of Firefox for Android. Just as I had done months earlier with Opera’s mobile browser, after downloading and installing Firefox on my phone, I went straight to one of the many IP cameras I manage to check for M-JPEG support. To my surprise, it worked!

It makes me very happy that someone has finally made it a priority to bring M-JPEG support to Android. iPhone users have had this since possibly its first release. Thank you Mozilla for making this work. I’ll give you a shot as my primary mobile browser.

Download Mozilla Firefox 4 Beta for Android at http://www.mozilla.com/m/beta.

Backup Linux Server To Amazon S3

Posted in How To on October 29th, 2010 by skylercall – Be the first to comment

I manage a few Linux web servers. Some are for personal use, others for my employer; some I have physical access to, others I don’t. Despite wishes and even prayers, hardware can and will fail. Data centers can have service outages. It is important to keep an up-to-date, external copy of all your data in a secure place for that day when something really bad happens. Below I describe how I use Amazon S3 and s3cmd to keep my servers backed up.

Amazon S3

Imagine the data infrastructure obstacles Amazon had to overcome to build the largest online shopping center. Most of us do not have the resources to build and maintain such a reliable and expandable system as they have developed for their own use. Thankfully, for a relatively small fee, Amazon provides use of their infrastructure under the name Amazon Web Services:

“[With Amazon Web Services] you can take advantage of Amazon.com’s global computing infrastructure, that is the backbone of Amazon.com’s multi-billion retail business and transactional enterprise whose scalable, reliable, and secure distributed computing infrastructure has been honed for over a decade.

Using Amazon Web Services, an e-commerce web site can weather unforeseen demand with ease; a pharmaceutical company can “rent” computing power to execute large-scale simulations; a media company can serve unlimited videos, music, and more; and an enterprise can deploy bandwidth-consuming services and training to its mobile workforce.” – taken from http://aws.amazon.com/what-is-aws/

The Amazon Web Services product we are taking advantage of as the location of our backup storage is S3 (Simple Storage Service). Create an account and then use the Management Console to create a bucket (container for your storage). You can create as many buckets as you like but the bucket names must be globally unique. I use a specific prefix for all my buckets (such as my initials) and create a bucket for each piece of hardware I want to backup.

The important information you will need to configure your backup tool is your Access Key ID and Secret Access Key. They are found under Account > Security Credentials. Do not allow anyone else to have access to these two keys because with them anyone can access your data stored in S3 and begin racking up a large bill if they like.

s3cmd

s3cmd is a free Linux command line tool for uploading and downloading data to and from your Amazon S3 account.

Download and install s3tools manually or do what I did and add their package repository to your package manager for a much easier install.

After installing s3cmd configure it by running the following command:
# s3cmd --configure
Enter your Access Key ID and Secret Access Key discussed earlier and use the default settings for the rest of the options unless you know otherwise.

If you haven’t already created a bucket you can do that now with s3cmd:
# s3cmd mb s3://unique-bucket-name
List your current buckets to make sure you successfully created one:
# s3cmd ls
2010-10-30 02:15 s3://your-bucket-name

You can now upload, list, and download content:
# s3cmd put somefile.txt s3://your-bucket-name/somefile.txt
somefile.txt -> s3://your-bucket-name/somefile.txt [1 of 1]
17835 of 17835 100% in 0s 35.79 kB/s done
# s3cmd ls s3://your-bucket-name
2010-10-30 02:20 17835 s3://your-bucket-name/somefile.txt
# s3cmd get s3://your-bucket-name/somefile.txt somefile-2.txt
s3://your-bucket-name/somefile.txt -> somefile-2.txt [1 of 1]
17835 of 17835 100% in 0s 39.77 kB/s done

A much better and more advanced method of backing up your data is to use ‘sync’ instead of ‘put’ or ‘get’. Read more about how I use sync in the next section.

Automate backup with a shell script and cron job

Below is a sample of the shell script I wrote to backup one of my servers:
#!/bin/sh
# Syncronize /root with S3
s3cmd sync --recursive /root/ s3://my-bucket-name/root/
# Syncronize /home with S3
s3cmd sync --recursive /home/ s3://my-bucket-name/home/
# Syncronize crontabs with S3
s3cmd sync /var/spool/cron/ s3://my-bucket-name/cron/
# Syncronize /var/www/vhosts with S3
s3cmd sync --exclude 'mydomain.com/some-directory/*.jpg' --recursive /var/www/vhosts/ s3://my-bucket-name/vhosts/
# Syncronize MySQL databases with S3
mysqldump -u root --password=mysqlpassword --all-databases --result-file=/root/all-databases.sql
s3cmd put /root/all-databases.sql s3://my-bucket-name/mysql/
rm -f /root/all-databases.sql

I use ‘s3cmd sync –recursive /root/ s3://my-bucket-name/root/’ and ‘s3cmd sync –recursive /home/ s3://my-bucket-name/home/’ to synchronize all data in the local /root and /home directories including their subdirectories with S3. I use ‘sync’ instead of ‘put’ because I do not always know exactly what files are stored in these folders. I want everything backed up, including any new files created in the future.

With ‘s3cmd sync /var/spool/cron/ s3://my-bucket-name/cron/’ I omit ‘–recursive’ because I do not care about any subdirectories (there aren’t any).

With “s3cmd sync –exclude ‘mydomain.com/some-directory/*.jpg’ –recursive /var/www/vhosts/ s3://my-bucket-name/vhosts/” I synchronize /var/www/vhosts but exclude all jpg files inside a particular directory because they are replaced very frequently by new versions and are unimportant to me once they are a few minutes old.

Using mysqldump I export all databases to a text file that can be easily used to recreate them if needed. I upload the newly created file using ‘s3cmd put /root/hold-for-S3/all-databases s3://my-bucket-name/mysql/’.

To read more about sync and its options such as ‘–dry-run’, ‘–skip-existing’, and ‘–delete-removed’ read http://s3tools.org/s3cmd-sync.

Create a cron job to execute your shell script as often as you like. Now you can be less worried about losing all your important data.

Monitor Non-Standard Ports in Nagios

Posted in How To on August 25th, 2010 by skylercall – Be the first to comment

I have been playing with Nagios over the last couple days. Aside from the steep learning curve I am quite happy with it. The largest frustration I encountered, however, is that no where in their official documentation does it say anything about monitoring services that are on non-standard ports. After searching for a solution I finally came across a few people talking about defining a custom command like this:

define command{
 command_name check_customport
 command_line /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p [PORT]
}

Using this method required extra definitions in my configuration files and even then my services were reported as working when in fact they were not (although, I may have just figured out why).

There is a much simpler way! I was sure there must be a native command for altering which port Nagios checks. Finally, I found it buried in their wiki:

define service{
 use generic-service
 host_name remotehost
 service_description HTTP
 check_command check_http!-p [PORT]
}

It is as simple as appending “!-p [Your Custom Port Goes Here]” to the check_command! My Nagios definitions just got a lot simpler.

Windows 7 Helps Me Be More Productive

Posted in Review on June 18th, 2010 by skylercall – 1 Comment

Forgive me if this is all old news to you. I skipped over Windows Vista so I am not aware if these features are new as of Windows 7 or just new since Windows XP. Also, I am running Windows 7 Professional 64-Bit. Some of these features may not be available in Home or Home Premium editions.

Sticky Notes

With Windows XP, throughout the day, I would accumulate many instances of Notepad; each with different notes taken from phone calls, assignments given to me by others in the office, or just little tasks that I did not want to forget. Having so many instances of Notepad open all at once would clutter up the taskbar and also the Alt+Tab window making it more confusing and time-consuming to navigate from one window to another. When it came time to restart my computer for whatever reason I first had to go through all the Notepad instances and save them to my desktop. If my computer ever shutdown unexpectedly due to a crash or power-loss I lost all my unsaved notes from that day.

After installing Windows 7 on my new computer I was quite happy to see a program called Sticky Notes. Sticky Notes solves all the problems I had experienced previously by using Notepad to log all of my notes. The individual notes even grow automatically as I type more and more text in them. If they get too big for my liking I can then make them smaller again and a scrollbar appears. You can also change the color of each note if you wish. The only feature I miss is the ability to change the font size. Sometimes only two words fit on one line before the next gets pushed down which isn’t aesthetically pleasing.

Full Date Displayed in Taskbar

This may sound like something unimportant but I am horrible at keeping track of the current date. I am always amazed when others can easily predict what day of the week some future date will fall on. In Windows XP, unless you make your taskbar at least twice as tall as the default size or move it over to one of the left or right side of your monitor you can only see the time. To see the date you have to hover your mouse over and wait for the tooltip to pop up showing the date (which oddly doesn’t always work) or you have to double click on the clock to open up the Date and Time Properties window which comes with its own problems. Have you ever spent a moment browsing the calendar and then accidentally clicked OK instead of Cancel? The system date changes!

Now with Windows 7 I can see the full date without moving my mouse. If I want to browse the calendar I click it an up pops a non-destructive, read-only calendar! If I absolutely want to change my system date (which I’ve never wanted to do before but I suppose is necessary for computers that don’t have access to the internet for an NTP server) I first have to click ‘Change date and time settings…’.

Pin Programs to Taskbar

Access to my favorite and most-used programs is now only one mouse click away thanks to the ‘Pin this program to taskbar’ feature. Now if only Microsoft would allow me to pin a folder to it without using a silly hack!

And finally, I am allowed to reorder the position of the open applications shown in the taskbar! Yay!

Better Navigation in Windows Explorer

This one is a bit difficult for me to explain. When I first started navigating in Windows Explorer I panicked when I couldn’t find the Up button to jump to the parent folder (Yes, I know. There is a Back button but back isn’t always up!) but then I found something better. There is an ant trail at the top where you can click on any parent folder. Even better is that each parent folder has an arrow next to it that when clicked drops down to give you access to any of its sub folders. This makes moving around much quicker.

Configure Schedule in Disk Defragmenter

Keeping my hard drives fragment-free, optimized for speed and efficiency, is now easier with Windows 7. Back in Windows XP I had to setup a custom Scheduled Task to run Disk Defragmenter on a schedule. Now, setting up the same schedule is easily done using the native Configure Schedule tool within Disk Defragmenter. Click ‘Configure Schedule’, set the frequency, the time of day, and you are done!

Snipping Tool

How do you think I got all the nice screenshots for this post? Capturing part of the screen used to mean taking a screenshot, pasting it in Microsoft Paint, saving it, opening the saved image in Adobe Photoshop, cropping it, and saving the final image! That is a lot of steps. So many, that I often avoided providing a screenshot.

Now, with Windows 7 I have Snipping Tool! Snipping Tool allows me to draw a box around an area of the screen and click save. It is that easy! If you don’t want to draw a rectangle you can use the other snip types, Free-form Snip, Window Snip, and Full-screen Snip. After capturing an image you can draw on it or use a highlighter before saving it. My only complaint is that I haven’t found a way to get a shot of something that requires control of the mouse to display such as tooltips, drop-down meus, and right-click menus. I also couldn’t figure out how to get a snip of the tool itself to show you here. Yes, I could open up Paint and then Photoshop but who does that anymore!

East Bay Studios Meetup Group – November Event

Posted in Photography on November 14th, 2009 by skylercall – Be the first to comment

This month we met to take photos of models at Pete‘s new studio. It gave me a real chance to try out my Westcott Umbrella and recently purchased Canon EOS 7D. Below are some of the photos I took during the event. To view the rest please visit the full set on Flickr.

CallStudios-0190

CallStudios-0236

CallStudios-0276

CallStudios-0304

CallStudios-0340

CallStudios-0372

CallStudios-0380