Nagios Update

Oh how the time gets away from you…
I have Nagios (Refer to the April 15th post) installed and in production. I am still tweaking the configuration and rolling out device monitoring.
Adding anything to be monitored is time consuming. Some might even think it is very time consuming. The three main files are switch.cfg, windows.cfg and printer.cfg and all editing is done through either vi or some other text editor. There are also other configurations and add-ons for monitoring Netware and/or Linux/Unix machines.
Windows server monitoring requires two main parts: installing the NSClient++ on the actual server and adding the necessary configuration to the windows.cfg on the Nagios box. For a clear how-to on installing the NSClient++ refer to this blog post. You may find that additional server config, such as loading WMI or other SNMP reporting may be required to collect the necessary data.
The windows.cfg editing is fairly straight forward. This PDF file on the Nagios website will be very helpful.
1) Add the host definition (insert your values for the bold text)
define host{
use windows-server ; Inherit default values from a Windows server template (make sure you keep this line!)
host_name winserver
alias My Windows Server
address 192.168.1.2
}
2) Add the services or counters to be monitored
define service{
use generic-service
host_name winserver
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}

define service{
use generic-service
host_name winserver
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}

define service{
use generic-service
host_name winserver
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}

NOTE: Any time the Nagios cfg files are edited you MUST verify the config and then restart the nagios service. Failure to do this will not show the correct config in Nagios Service Detail or may cause a failure of the nagios service.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios restart

Check this tool out and join the 3 million other users!

http://www.nagios.org

Internet Connection Sharing with Windows Mobile 6.1 in Ubuntu

After turning in my HTC 6800 as an insurance claim, I was given a new HTC Touch Pro running Windows Mobile 6.1. I had not even tethered my data phone since my UTC 6700 and was curious if it could even be done on the newer Windows Mobile OS. So few Google searches later, I was able to find a how-to, and a really easy copy pasta style one at that. There is a note at the bottom regarding possible issues with the HTC Touch and Diamond, I had no issues what so ever, YMMV. Full text from Ubuntu Forums to follow…

–Himuraken

From Ubuntu Forums
How To: Internet sharing on USB with Linux and Windows Mobile
I have been lookin’ for a complete guide on “How to connect to HSDPA/3G trough USB with Linux and Windows Mobile 6” – And here is the solution!

To connect your WM6 device via usb to your linux pc do the following:

On your phone enable internet sharing via usb but do not connect the usb cable yet.

Run the following commands..you may need to install “svn” for this to work: (install by terminal: sudo apt-get install subversion)

Code:

svn co https://synce.svn.sourceforge.net/svnroot/synce/trunk/usb-rndis-lite/
cd usb-rndis-lite/
make
sudo ./clean.sh
sudo make install

Create the path “/etc/sysconfig/network/”, in Hardy Heron the path “sysconfig/network/” doesnt exists, easy with nautilus trough terminal:

Code:

sudo nautilus

Nautilus opens, and browse to “/etc/” and create the path “sysconfig/network/” and futher. – Close nautilus.

The create the file “ifcfg-rndis0” in “/etc/sysconfig/network/“, easy with gedit (gnome’s text-editor) trough terminal:

Code:

sudo gedit /etc/sysconfig/network/ifcfg-rndis0

Fill the file with the text below:

Code:

BOOTPROTO='dhcp'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR=''
MTU='1460'
MRU='1500'
NAME=''
PEERDNS=no
NETMASK=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='hotplug'
USERCONTROL='no'
_nm_name='static-0'

So, if you haven’t start “Internet Sharing” on your WM-phone yet. Do it now..

– Now plug the phone into the usb cable going to the pc and if you do a “dmesg” you should see the following (or something similar):
Code:

[ 6539.589930] usb 5-1: USB disconnect, address 2
[ 6539.590829] rndis0: unregister ‘rndis_host’ usb-0000:00:1d.2-1, RNDIS device (SynCE patched)
[ 6540.972801] usb 5-1: new full speed USB device using uhci_hcd and address 3
[ 6541.019337] usb 5-1: configuration #1 chosen from 1 choice
[ 6541.628430] rndis0: register ‘rndis_host’ at usb-0000:00:1d.2-1, RNDIS device (SynCE patched), 80:00:60:0f:e8:00

and if you do an ifconfig you should have a new rndis0 device:

Code:

rndis0 Link encap:Ethernet HWaddr 80:00:60:0f:e8:00
inet addr:192.168.0.102 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::8200:60ff:fe0f:e800/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:8050 Metric:1
RX packets:3008 errors:2425 dropped:0 overruns:0 frame:225
TX packets:2993 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1915412 (1.8 MB) TX bytes:763519 (745.6 KB)

—-
The rndis0 device will exist both when internet sharing is enabled via usb and when it is NOT….here is how it works:

If internet sharing IS enabled via usb you have access to the internet and will get an IP…default route will be set.

If internet sharing is NOT enabled via usb then the rndis0 device will exist and can be used by programs such as syncE to manage your contact list or transfer files but you will not have internet access (from the phone) and more than likely you will not get an ip address auto assigned (it may keep the ip it used last).

I know this works as I’m connected at the moment via the rndis0 device. I find it to be more responsive than the connection via bluetooth. Hope this helps someone.

Source from: http://forums.opensuse.org/1579065-post1.html

Solution for HTC Touc Pro / Diamond (HTC devices that can’t get DHCP to
work properly): http://ubuntuforums.org/showthread.p…82#post6239582

Device or resource busy when using mdadm

After my Buffalo NAS physically failed, I decided to go back to the good ole’ home brew files server / NAS. So I stripped out the 250GB drives from the NAS and set out to setup Linux software RAID which is also known as md RAID. I went this route because my hardware RAID controller currently in use by another system, and I wanted a little weekend project.

After loading Ubuntu 8.10 to a stand alone drive (/dev/sda) I went ahead and prepped the system for the RAID array. After getting the disks installed and formatted, I dropped to the command line and ran sudo apt-get install mdadm. Once that was complete I attempted to create a RAID 10 array using the following command:

sudo mdadm –verbose –create /dev/md0 –level raid10 –raid-devices=4 /dev/sdb /dev/sdc /dev/sdd /dev/sde

which failed and gave the following errors:
mdadm: Cannot open /dev/sdb1: Device or resource busy
mdadm: Cannot open /dev/sdc1: Device or resource busy
mdadm: Cannot open /dev/sdd1: Device or resource busy
mdadm: Cannot open /dev/sde1: Device or resource busy
mdadm: create aborted

After scouring Google and using every possible search term I could not find anything pointing the cause of the problem. I made sure the disks were not mounted, verified they were not in use, made sure that swapoff had been run on each disk, and generally tried everything. After playing around with different things it just kind of dawned on me, my onboard RAID controller might be interfering. Most people in the Linux world refer to onboard RAID’s as FakeRAID or FRAID. It appears that the Ubuntu installer detected the onboard Nvidia RAID controller and installed dmraid into the running kernel. If you must use FakeRAID, dmraid may be useful to you, if you want true Linux software RAID, you need mdadm.

To resolve this, make sure that you go into the BIOS for your FakeRAID and disable / remove / delete any arrays that may be configured. Afterwards, reboot and go into your motherboard BIOS and disable the onboard RAID controller. Make sure the port are still enabled, you just want the RAID functionality disabled. Lastly, go to the command line and run
sudo apt-get remove dmraid. This will remove the dmraid modules and update your boot image to not include the dmraid software.

Once you have completed the above, rerun your mdadm command and you should be off and running in no time.

–Himuraken

Enable SSH on VMWare ESXi 3.5 & 4.0

I have been playing around with ESXi and needed to upload some files via SCP and discovered that SSH is not enabled by default. There are many sources out there for accomplishing this but I found the following information to be the easiest to follow.

1) At the console of the ESXi host, press ALT-F1 to access the console window.
2) Enter unsupported in the console and then press Enter. You will not see the text you type in.
3) If you typed in unsupported correctly, you will see the Tech Support Mode warning and a password prompt. Enter the password for the root login.
4) You should then see the prompt of ~ #. Edit the file inetd.conf (enter the command *vi /etc/inetd.conf*).
5) Find the line that begins with #ssh and remove the #. Then save the file. If you’re new to using vi, then move the cursor down to #ssh line and then press the Insert key. Move the cursor over one space and then hit backspace to delete the #. Then press ESC and type in :wq to save the file and exit vi. If you make a mistake, you can press the ESC key and then type it :q! to quit vi without saving the file.
6) Restart host or try kill -HUP `ps | grep inetd`

The original blog posting can be found here.

–Himuraken

VirtualBox and cloning virtual hard disk drives

After breaking my VMWare Workstation install by upgrading to the latest kernel, I decided to give VirtualBox a try. VirtualBox comes in two flavors, the full version and the open source edition (OSE). I have had a great time creating virtual machines in VirtualBox, the application really is quite solid. I am seeing performance similar to what I am use to with VMWare.

I primarily use virtual machines for testing production type systems in an environment that I can experiment with. Something about trying out new products and ideas seems to worry my clients and end users, no surprise there. With that being said, I have created a Windows 2008 Standard addition VM, a Windows XP Professional VM, and a Windows Vista Business VM. That is about where I would like the creation to stop, I want to simulate multiple client machines, but I do not want to manually load all of the client systems. In VMWare it is quite straight forward, you simply shut the VM down, highlight it and click on Clone. Well VirtualBox is almost that straight forward, but you have to do the cloning from the command line, and more importantly, you must use absolute paths.

The command is documented in many places across the web, but most if not all of them that I found were something like this:

VBoxManage clonevdi yourvirtualhdd.vdi yourclonedvirtualhdd.vdi

The problem with this is that the above command uses relative paths which is kind of standard for most apps, not VirtualBox. So in my case the command would actually look like this:

VBoxManage clonevdi /home/himuraken/VM/VirtualBox/BaseInstalls/yourvirtualdd.vdi /home/himuraken/VM/VirtualBox/BaseInstalls/yourclonedvirtualhdd.vdi

This may appear complex or difficult to understand for some but just understand it this way, you need to provide the full path to the image you want to clone and the full path to the location you want to store the cloned VDI to.

–Himuraken

Resolv.conf getting reset on reboot

If you have been around Linux for any length of time, you know that you can statically define which DNS servers your computer uses for name resolution. This is not always the case in Ubuntu / Debian systems because of a package called dhcp3-client. If this package is in use on your system, you will notice that your resolv.conf file is reset every time the system reboots or the network interfaces are cycled. This is because dhcp3-client resets your resolv.conf file using the information provided by your local DHCP server.

In my case, I am running numerous tools from my box and I need these tools to be able to resolve names on my LAN using the DNS server on my LAN. There are a couple different ways to resolve this issue but I’ll show you the way that I like to handle this.

Make sure that you have the IP addresses of the DNS servers you want to use and drop to the command line and run: sudo nano /etc/dhcp3/dhclient.conf

Navigate down through all of the commented area and locate the request directive. You will need to enter in your DNS above the request line with the prepend command. Mine looks like this:

prepend domain-name-servers 10.10.10.11, 208.67.222.222;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
netbios-name-servers, netbios-scope, interface-mtu;

As you can see, you just need to add that line and as many DNS servers as you need. In this example I have chosen to use my internal DNS server and OpenDNS as a secondary. Make sure your syntax is correct, separate DNS servers with commas and end the line with a semi-colon.

–Himuraken

Identifying kernel and Ubuntu versions

These are pretty basic tasks but they are important things to know if you are new to Linux. These are particularly useful if you are running a Linux system without an X server.

To find the Linux kernel version that you are running, open your favorite terminal or CLI and type in: uname -a. Using the -a switch will display all information related to the kernel version. Usually, uname -r will be sufficient.

To find the version of Ubuntu that you are running, open your favorite terminal or CLI and type in: cat /etc/issue. This will give you the version number only. If you need to know the name of the version just run
cat /etc/lsb-release and check the named value in the field named DISTRIB_CODENAME=.

Hopefully these simple but useful commands will help you.

–Himuraken