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;

Shared : Always redirect to root script.

This script is intended to redirect people back to the root application when manually browsing to hidden application folders. i.e.
/inc/ should never show an index, so we install an index.html / index.php. This script will redirect people back to ./ no matter what the path.

// No matter where you are, always redirect back to root
$r = '';
$d = (count(explode('/', dirname($_SERVER['SCRIPT_NAME']))) -1);
for($l = 1; $l &lt;= $d; $l++){$r .= '../';}

Memo : Windows Server 2008 Core Commands

Well if i ever need to do something like setting an IP on a Windows server 2008 Core machine, this is where i can find the manuals.

Nice product for a stub location though 😀

Tip : Terminal Server Client tool.

Security, security and if possible some ease of control. Well i grew pretty tired of typing;


and repeating this for each new instance. And needing to remember all the ips from different networks etc. I didnt want to store these as machinex.rdp knowing its just a flat text file with the rpd extention. Then i came across someone that told me, dude! you should try Royal ts…

And i was like…. Whoat? Well, have a peek for yourself and drop me a message if you liked it 🙂

Browse to this location, and download version 1.5.1 (wich is the last free full purpose legacy client)

Do buy the last one if you realy realy realy like it, these guys need the motivation also 😀


Memo : Windows NTP configuration

Ill be short about it, time is important!

The old way….

Net time /

The adviced way….
Register the time service.

w32tm /register

Configure it to sync with an external ntp server.

w32tm /config /update /manualpeerlist:”” /syncfromflags:MANUAL /reliable:YES

View the current stats

w32tm /monitor

Little warning, i feel should be made.
When you are updating back in time, the service might need some time to slowly correct the time. This is because else conflicts might arise with time dependant services and the like. Keep an eye on your windows Logs and use the /monitor switch the follow the ntp service.

Check which NTP pool to use for your own country at this location : Also, the listed pools mainly consist of STRATUM 2 public servers. This should be correct enough for your local network ^^.

Make sure that the ntp service can be reached, and make sure DNS is available. Else resolve the pool addresses (that may change over time).