Blog Archives

Check_VM for Oracle VM and Nagios.

Personal backup…

Refinements might be added if bugs or improvements are found. So keep an eye out for newer versions 😉

This script might also be compatible with other  Xen clones.

# Author : Chris Gralike
# Company: AMIS Services BV
# Simple but effective Oracle VM check command for use with nagios
# This command checks the state of any given VM machine using the XM command.
# It will try to match the friendly name as well as the system name.
# It will return OK - and usefull metadata on succes, NOK on failure.
# usage : check_xm vmname
# ########################

use strict;                     # Good practice
use warnings;                   # Good practice

my (@data, @values, @name, $vmname, $vmcheck, $i, $result);

# Get the command parameters
if( ($#ARGV + 1) == 1 ) {
$vmname = $ARGV['0'];
print "usage: ./check_xm vmname \n";
exit 1;

# Perform the actual test
open(XM, "xm list|");
$i = 0;
if($i > 0){
# Split the output in portions
@data = split(" ", $_);
# Get the human readable name
@name = split('_', $data['0']);
$name['1'] = 'dezeisnietingebruik!';
if(($vmname eq $name['1']) || ($vmname eq $data['0'])){
print "OK - $data['0'] is active with Id:$data['1'] $data['3']CPUs $data['2']M \n";
exit 0;
close XM;

# If the loop was finished without result, then there is a problem!
print "NOK - $vmname is not running on this server\n";
exit 2;

Simple VBScript to restart all VMware services

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:{impersonationLevel=impersonate}!\\”&strComputer&”\root\cimv2”)
Set colListOfServices = objWMIService.ExecQuery(“Select * from win32_Service where Name Like ‘VM%'”)
IntSleep = 15000
For Each objService in colListOfServices
If UCase(Left(, 1)) > “N” then
WScript.Sleep intSleep
strMsg = strMsg & vbCr & & ” Restarted.”
End If

Wscript.Echo strMsg

Sure you can tweak and modify it as you see fit 🙂

Timekeeping in VMware… o my…

If there is a subject that has many and i realy mean many posts, and with these posts many many readers its timekeeping in vmware. Especially when your Guest OS is of the linux platform. Also there are many suggestions on how to solve this problem. Too give you guys a quick glace of whats happening out there… Some of the suggestions you might encounter.

1. Cron the ntpd refresh command. (put the ntp renew in a task and execute it every second)
    (Not realy an option with 100Servers+ and loads, loads of network traffic)
2. Recompile the kernel using the 100Hz frequency setting instead of the 1000 or 250hz setting.
    (One I want to test before discarding it, he might have a point there)
3. Patch the kernel / NTPD using the latest versions.
     (Should be a standard job and best practice, not an suggestion!)
4. Use a VMWare compatible compiled rpm to reinstall the kernel.
     (Sounds much like option 2 i want to test first, ill go for the manual compile 🙂 )
5. dont even want to mention all these other options 
     (too silly but fun reading 🙂 )

With all respect to the guys searching and finding solutions stated above. There was indeed a time these solutions where the best to apply. But time has gone past, vmware introduced solutions using the VMWare tools (almost the same a the cron solution). And communities responded comitted to solve these problems for their most valued distro. The result is a setting in the kernel that is available for various kernels, and these settings can be found on the VMware site. Even though i commited myself to test these various options before implementing one or the other, the bootloader option looks the savest to suggest too the big audience. So here it is.

Oh always there are people to thank 🙂
• My uncle for paying way more attention then me 🙂 Marco Gralike
• Prutser for breaking open the kernel discussion, good article there.
•  VMware for maintaining there KB so well 🙂
• You for taking the time to read this nonsense 🙂