Friday, February 19, 2010

Get VMware configuration info from SNMP (quick and easy)

Here are the steps I use to get SNMP working for ESX 3.5 and 4.0 so I can get some basic configuration information about the running virtual machines. I'm working on a script to auto-create parent rules for Nagios monitoring and it would be helpful for Nagios to know which VMs were on which ESX host.

First, you need to tell the firewall to allow SNMP traffic, if it's not already allowed.

Is SNMP enabled?
[root@esxserver root]# iptables -L |grep snmp

To enable SNMP:
[root@esxserver root]# esxcfg-firewall -e snmpd

v 3.5
In 3.5, you need to load a module to get at the VMware specific information.
Just edit /etc/snmp/snmpd.conf and add:

dlmod SNMPESX /usr/lib/vmware/snmp/libSNMPESX.so

And then all you need to do is restart SNMP
[root@esxserver root]# service snmpd restart

v 4.0
In v4.0, you have to proxy the SNMP request to the VMware snmp agent.

First configure the net-snmp. In /etc/snmp/snmpd.conf add this line

proxy -v 1 -c public udp:127.0.0.1:171 .1.3.6.1.4.1.6876

Then we have to configure vmware. For some reason I was unable to use the command line which is the preferred method. All the command line does is edit this XML file, /etc/vmware/snmp.xml.

<config>
<snmpSettings>
<communities>public</communities>
<enable>true</enable>
<port>171</port>
<targets>127.0.0.1</targets>
</snmpSettings>
</config>


We are telling the VMware agent to listen on port 171 so it doesn't conflict with regular SNMP, and since we proxy this through Net-SNMP, we only need to listen to localhost.

Now restart the vmware and snmp services.

[root@esxserver root]# service mgmt-vmware restart
[root@esxserver root]# service snmpd restart

Test your setup
I just want a list of what servers are running on what hosts so I run this command

snmpwalk -v2c -c public esxserver .1.3.6.1.4.1.6876.2.1.1.2

If you want to see everything this has to offer, here is the top level.

snmpwalk -v2c -c public esxserver .1.3.6.1.4.1.6876

If you don't like seeing the cryptic numbers and want what you are seeing translated to something you might be able to understand, you need to copy the VMware mibs to /usr/share/snmp/mibs and add the -m switch.

snmpwalk -v2c -c public -m ALL esxserver .1.3.6.1.4.1.6876

I include all mibs just to make it easy, but you can specify specific MIBs to translate.

Monday, November 9, 2009

Installing a Ganeti cluster - Hardware built

I finally "got" what Ganeti is and decided to create my own test bed to try it out. For the most part, Ganeti manages xen domu's using DRBD for redundancy. By default, DRBD only allows two nodes to replicate data (usually for a fail over cluster). So if you have a virtual machine on ServerA and it fails, you can fail your virtual machine over to ServerB. What Ganeti allows you to do though is to then designate ServerC as the next fail over node, sets up DRBD, and begins syncing between the two. There are some great slides about this in the PDF file at the Ganeti site.

I was able to build up three servers out of spare parts around the office and have begun to configure them for use. They each have two 64 bit procs and eight gigs of ram. I made 700 gig disk space available using RAID 5, but I might have been better off with no raid from what I'm reading in the install doc (better IO). Already it's been a nice learning experience for me, as I learned about reducing the amount of resources Dom0 takes up. The install guide is for Debian, but I'm trying to make it work for my CentOS 5.4 systems. So far so good.

Tuesday, October 20, 2009

Google Chromium on Gentoo

I installed Google Chrome on my 64 bit Ubuntu laptop last night and loved it. I just grabbed the zip file from chromium.org and really just unzipped it and ran it. What I didn't know is that the linux package is built for an Ubuntu system. So when I got to work to run chrome on my Gentoo workstation, I ran into an error:

./chrome: error while loading shared libraries: libnss3.so.1d: cannot open shared object file: No such file or directory

Gentoo has the libraries but they are named differently then Ubuntu. If you search this error, you can find that some people and figured out a work around by symlinking the libraries, but that was only necessary before the ebuild was built. Now Chromium is found in portage under www-client/chromium. There are two testing build and a masked build (http://packages.gentoo.org/package/www-client/chromium). I just have to have the most recent version as I'm a sucker for punishment, so I unmasked it with:

echo www-client/chromium >> /etc/portage/package.unmask

Then i'm off and running with

emerge www-client/chromium

It looks like it pulls ALL the source though, so even though you are compiling for 64 bit linux, you are getting source for XP and Mac OS. A du -sh shows 3.9 gig of disk use. So make sure you got the room. I'm using LXDE and it created my chromium application icon for me.

Monday, October 12, 2009

VMware View Open Client on 64 bit Ubuntu (VDI)

Here is the quick and simple set of commands of what I did to get this running:

sudo apt-get install libgtkextra-x11-2.0-dev libxml++2.6-dev libcurl4-openssl-dev intltool libboost1.38-dev

wget http://vmware-view-open-client.googlecode.com/files/VMware-view-open-client-source-4.0.0-201987.tar.gz
tar zxvf ./VMware-view-open-client-source-4.0.0-201987.tar.gz

cd VMware-view-open-client-source-4.0.0-201987

./configure

make

sudo make install

Now you should have "VMware View Open Client" under Applications -> Internet

Sunday, September 6, 2009

Tinycore Linux Review

I was recently tasked with finding a way to reuse some old laptops in case of a pandemic. We needed a way people can work at home and not bring sickness into work. We have old laptops that could be handed out to people that needed them, but they are old and XP is really slow. My boss gave me the opportunity to have Linux save the day

I tried a few distros that failed. First Knoppix. I had great success with Knoppix in the past... until I updated the system. After an apt-get upgrade, the system just ends up in a reboot cycle that I didn't fee like working on. Basically the xserver failed to start moving me onto the next auto-login command which was reboot. I then tried a nice tiny Debian install. I think this would have worked, but I found out later that the laptop I was installing that on had a flakey network (I was playing with about four laptops at the same time). I tried using the mini.iso for ubuntu and built a small xfce desktop, but by the time I was up and running, it was taking up way too much memory to use on a 128 meg system. Ubuntu is put together really nice, but it sure takes up a lot more resources than it seems it should.

I remembered working with Damn Small Linux in the past and decided to try that out. I didn't see any updates more recent than nine months. I got the feeling this wasn't as maintained as it used to be. I also didn't like the idea of doing an install, then removing packages. I just want to install only what is needed. Looking into DSL, had me stumble on Tinycore Linux.

It turns out that one of the major contributors to DSL was seeing the end of the road for the 2.4 kernel and created DSL-N. Then due to some disagreement, Shingledecker broke off on his own and created Tinycore. Shingledecker wanted to address my biggest beef with computers in general. That is the tendency for an operating system to... well, "rot". I know I've had to wipe and install my windows system over and over again, and a lot of my Linux desktops have had the same issue. Tinycore addresses this by always booting into a pristine state.

From the Distrowatch interview:
"...Tiny Core always boots from a compressed cpio image. So each boot is like the first boot from a CD-ROM. Actually we suggest that the files of Tiny Core be placed on a hard drive, a frugal install. Doing a frugal install is tiny and tidy. In fact Tiny Core can easily co-exist with an existing Linux distribution. Just copy bzImage and tinycore.gz onto your hard drive and adjust your GRUB boot loader. Add a tce directory and you are ready to go. Even using persistent home will use an existing /home directory and will simply add a "tc" directory under home. So upon each boot the system is in a known pristine state. We don't promote doing a traditional hard drive installation. I call it "scatter mode", because it is not tiny and tidy, you end up with files scattered all over your hard drive. It means that you have to allocate a partition to install. It means that you cannot co-exist with another installed Linux distribution. It means that those scattered files are not loaded fresh upon each boot and thus are susceptible to "system rot". "

I immediately got hooked on the idea of Tinycore because it only has what is necessary to boot into a desktop system. No applications are installed. If you want an application, you bring up the appbrowser and install only what you need. Everything, including the operating system, runs in memory. Once you boot up, you can eject the CD-ROM and continue on your way. You have the option of running with persistence, that is with the hard drive or maybe a USB thumb drive.

Tinycore doesn't have a lot in the way of documentation, but it doesn't lack in documentation. It's been kept simple enough that the site provides all the documentation you need. How to remaster, how to build a custom kernel, how to add packages, how to install to a USB or hard drive, and so on. I found that I only really needed the custom kernel and remaster pages from their wiki. The forums are active enough to supplement the documentation.

Within two days, I was able to build a custom kernel (2.6.31-git-r8), add my default packages and remaster a company version of Tinycore. This version I created with VPNC, RDesktop, and Opera used up about 70meg of memory. That's 70 meg for the whole operating system (kernel, filesystem, xorg. The whole system in 70 meg). Being able to load the whole thing into ram and run it there means that we get extra speed out these old laptops. And to do it all in under 70megs is really amazing to me.

Now instead of using just the spare laptops, I have a custom company CD-ROM that can be handed out to employees that should be able to boot and get employees connected to work.

Overall, I'm having a great time playing with Tinycore, and I love it's simplicity and efficiency.

Links:
http://www.tinycorelinux.com/
http://en.wikipedia.org/wiki/Tiny_Core_Linux
http://en.wikipedia.org/wiki/Damn_Small_Linux
http://distrowatch.com/weekly.php?issue=20090323#feature
http://www.shingledecker.org/

Thursday, August 20, 2009

The importance of SysAdmin news


I got out of a meeting yesterday realizing the importance of keeping on top of vendor news. The vendor was in, and my boss pointed out that their acquisition of a new company might lead to further business depending on how the vendor integrates that new company. I didn't even know they bought it.

I realized that there are a lot of products the company I work for uses, that I don't keep track of. I had once been tasked with checking out single sign on solutions for Linux, and stumbled on RedHat's directory server (Now 389 Directory Server). I really should have been keeping an eye at least on their press releases.

Granted, a lot of the press releases companies put out there and just feel good pieces for investors. But it's very helpful knowing about aquisitions, spin offs, or even when the company decides to take a paid for product and open source it. Keeping on top of your vendors puts you in control so the next time they call and "touch base", you'll know to ask about recent changes and how it will effect your relationship with them.

Now I'm going to add as many as I can to my Google Reader. Hopefully the next time I have a meeting or phone call with them, I won't say "Oh! You make that?"

Tuesday, July 28, 2009

Knoppix - First glance

I have to say WOW. I'm very impressed with the Knoppix 6.0.1 install I just did. I'm glad to see they chose to go with a more lightweight approach than other distros.

I have an older laptop that seems to get slower and slower with each update of Ubuntu. I once decided to kick Ubuntu out and install Gentoo on this laptop. It really was faster with Gentoo, but one update kill X and I had a hard time figuring out what killed it. I put Ubuntu back on, but it was so slow that I just ended up not using it anymore. I decided to have some fun and try installing Gentoo again, but the only boot disk I had was this Knoppix disk from a coworker. I noticed that instead of Gnome or KDE, Knoppix chose LXDE for it's default windowing system. Fantastic! I was running this with Gentoo and liked what I saw. I decided to go ahead an install Knoppix to the hard drive to see how it performed.

I've only had it installed for about a half hour now, but it's pretty snappy on my old system and even has some good Compiz effects running. I also like that Iceweasle is the default browser.