I wrote a new KVM plugin for Ohai which gives a ton of important information about KVM guests, which is stored in the node attributes for the host. This makes it easy to find out which guests are currently on a host and other information about the guest, such as: cpu allocation, memory usage, persistence, autostart, etc.
One of the things you can do once you have this plugin installed and running on the host is have the guest perform a search to find it’s host and then save that information somewhere on the guest. This is very convenient if you’re on a kvm guest and you want to know right away what it’s host is.
In you Chef code, just use something like this to find the current guest’s host:
parent_host = search(:node, "virtualization_kvm_guests:#{node[:hostname]}").first |
This plugin uses the same naming scheme for listing guests as my Linux VServer Ohai plugin, so it’s easy to search for the host of a guest, regardless of virtualization type. I often find myself using knife to search for the host of a guest using this:
knife search node "virtualization_*_guests:<myguestname>" |
I think of this as a poor man’s KVM management system.
PagerDuty is awesome. We have a pretty complicated follow the sun rotation split into 3 time periods per day and 2 teams on opposite sides of the world. It would be a real PITA to manage this without PagerDuty. It’s super easy to integrate Nagios with PagerDuty. If you haven’t done it already, you can find the instructions here. The problem with PagerDuty’s Nagios integration is that their guide says it requires the enable_environment_macros variable to be enabled. The problem is this is a HUGE performance killer for Nagios.
It turns out it’s super easy to use the Nagios integration without enable_environment_macros being enabled. Simply change your notify-service-by-pagerduty and notify-host-by-pagerduty notification commands to the following:
define command {
command_name notify-service-by-pagerduty
command_line /usr/local/bin/pagerduty_nagios.pl enqueue -f pd_nagios_object=service -f NOTIFICATIONTYPE="$NOTIFICATIONTYPE$" -f HOSTNAME="$HOSTNAME$" -f SERVICEDESC="$SERVICEDESC$" -f SERVICESTATE="$SERVICESTATE$" -f CONTACTPAGER="$CONTACTPAGER$"
}
define command {
command_name notify-host-by-pagerduty
command_line /usr/local/bin/pagerduty_nagios.pl enqueue -f pd_nagios_object=host -f NOTIFICATIONTYPE="$NOTIFICATIONTYPE$" -f HOSTNAME="$HOSTNAME$" -f HOSTSTATE="$HOSTSTATE$" -f CONTACTPAGER="$CONTACTPAGER$"
}
Once you change you notification commands, set enable_environment_macros = 0 and restart Nagios. Making this one change lowered my overall server load by at least 30%!
Today I posted my first Ohai plugin to Github and put a link on the Opscode Community Plugins wiki page. I know not a whole lot of people use VServer, but hopefully some will find it useful.
#opschef
This should apply to RHEL5 as well, but I haven’t verified yet.
The easiest solution I’ve found is to simply install Ruby and it’s dependencies and then install RubyGems from source.
I’ve written a small script which installs Ruby and it’s dependencies. It then grabs the RubyGems source tarball and installs Gems from source. As I wrote this to get a working Chef install, it also adds an opscode gems source.
You can get the script here.
This is simple, but I always forget how to do it when I need it and it’s hard to find on google for some reason.
echo "hi" | mail -s "My Subject" to@someone.com -- -f from@someone.com
I just stumbled across a Mozilla Labs project called Personas. It’s light-weight theming for Firefox that can be changed without restarting the browser. After you install Personas, you get a new menu entry Tools->Personas for Firefox, where you can quickly change the persona you are using. From what I can tell, Personas seem to change the your browser toolbar and menu font colors and usually add a lightweight background picture. According to the website, the project has been going since Dec 2007, so there’s a lot of Personas to choose from. I guess I’m a little slow sometimes.
One thing that is really cool is you can visit the personas gallery and see a bunch of different personas and when you hover your cursor over a persona, your browser will temporarily use that persona. If you want to use that persona now, just click on it and it’s your active persona.
Here’s a quick little clip that shows what Personas does.
Tags: extensions, firefox
I really had a hard time getting pure-ftpd 1.0.22 to compile properly witih mysql support on a RHEL5 x86_64 server. It turns out that the mysql libraries path in the configure script is incorrect. I’m not sure if this is just a problem with my particular configuration or with the way pure-ftpd tries to figure out where the mysql libraries are. In any case, I modified the configure script to use mysql_config with appropriate options to set the mysql include paths and lib paths as appropriate. Assuming mysql_config is in your path, I wouldn’t expect this to ever fail.
If anyone else has this problem, just apply the following patch to the configure script:
*** configure.orig Tue Nov 10 09:35:19 2009 --- configure Tue Nov 10 10:11:59 2009 *************** *** 11670,11685 **** # Check whether --with-mysql was given. ! if test "${with_mysql+set}" = set; then : withval=$with_mysql; if test "x$withval" != "xno" ; then if test "x$withval" != "x" && test "x$withval" != "xyes" ; then LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}" LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib" CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include" else ! LD_RUN_PATH="/usr/local/mysql/lib:/usr/local/mysql/lib/mysql:/usr/lib/mysql:/usr/mysql/lib:/usr/mysql/lib/mysql:/usr/local/lib/mysql:${LD_RUN_PATH:+:}${LD_RUN_PATH}" ! LDFLAGS="$LDFLAGS -L/usr/local/mysql/lib -L/usr/lib/mysql -L/usr/mysql/lib -L/usr/local/lib/mysql -L/usr/local/mysql/lib/mysql -L/usr/mysql/lib/mysql" ! CPPFLAGS="$CPPFLAGS -I/usr/local/mysql/include -I/usr/include/mysql -I/usr/mysql/include -I/usr/local/include/mysql -I/usr/local/mysql/include/mysql -I/usr/mysql/include/mysql" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for floor in -lm" >&5 $as_echo_n "checking for floor in -lm... " >&6; } --- 11670,11685 ---- # Check whether --with-mysql was given. ! if test "${with_mysql+set}" = set; then withval=$with_mysql; if test "x$withval" != "xno" ; then if test "x$withval" != "x" && test "x$withval" != "xyes" ; then LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}" LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib" CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include" else ! LD_RUN_PATH="`mysql_config --libs | egrep -o '\/[[:alnum:]\/]* ' | xargs | tr ' ' ':'`:${LD_RUN_PATH}" ! LDFLAGS="$LDFLAGS `mysql_config --libs | egrep -o '\-L\/[[:alnum:]\/]* ' | xargs`" ! CPPFLAGS="$CPPFLAGS `mysql_config --include`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for floor in -lm" >&5 $as_echo_n "checking for floor in -lm... " >&6; } |
Balance Through Extremism » Redhat perl. What a tragedy..
Wow, I wonder if any of our server have been bitten by this nasty Perl bug. It’s hard to believe that RedHat has taken so long to provide a fix for this problem.
Tags: bugs, performance, perl
Grooveshark — Listen to Free Music.
Just found this website tonight for playing music online for free. It’s a community based service where you can have friends to share music with. It’s kind of like Last.fm and Pandora, but with a much nicer interface. It seems to load very quickly and the music seems like decent quality.
Tags: free music, music



