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.


#!/usr/bin/perl
#
# 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'];
}else{
print "usage: ./check_xm vmname \n";
exit 1;
}

# Perform the actual test
open(XM, "xm list|");
$i = 0;
while(<XM>){
if($i > 0){
# Split the output in portions
@data = split(" ", $_);
# Get the human readable name
@name = split('_', $data['0']);
if(!$name['1']){
$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;
}
}
$i++;
}
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;

Essence of Business Intelligence?

You can only effectively control the breaks and throttle, when you know the type of car you are driving, type of breaks and throttle and how to handle them, break and throttle effect when you use them, current speed, effective speed limit, the environment you drive the car in, the reason to why you are driving at all….

Oh, you get the point…

:)
Some nice articles to get you going (sadly most are written in Dutch).

 

 

Extract all content to disk from a SPS2007 content DB using PHP

Today I ran into a problem. We needed to migrate a huge amount of data from an old SharePoint 2007 content database without the availability of the MOSS front-end. All i had was the database and a corrupted sharepoint install that wasnt going to help me allot.

To overcome this problem I decided to write a little PHP application that would do this task for me. I allready had WAMP setup on my desktop, so i figured this to be the quickest route. Then i figured, maybe other people face this problem as well. So here it is, the code, and some helpers to get you going.


<?php
/**
* @name           : index.php - MSSql Content connector
* @Author        : Chris Gralike
* @version        :
* @copyright     : WETFYWTDWI - what ever ** you want to do with it, no guarantees :) 
*  This script ONLY READS the database tables, so dont give it more permissions :) 
*/

// What to search for in the directory structure.
$search = '';
// Where too put the files
$createdir = './Downloaded';
// What server too connect to.
$ServerName = 'amisnt05.amis.local';
// Database connection parameters.
$connectionInfo = array('Database' => 'MOSS_PROD_WSS_Content_WebApp02',
'UID' => 'php_login',
'PWD' => 'welcome12345678');
// This can be a very long task to complete, so disable the timelimit.
set_time_limit(0);
// Create a connection
$conn = sqlsrv_connect($ServerName, $connectionInfo)
or die( print_r( sqlsrv_errors(), true));

// The SQL statment to query the AllDocs tables.
$tsql = "SELECT dbo.AllDocs.Id,
dbo.AllDocs.SetupPath,
dbo.AllDocs.LeafName,
dbo.AllDocs.DirName,
dbo.AllDocs.SetupPath,
dbo.AllDocs.Extension,
dbo.AllDocs.ExtensionForFile,
dbo.AllDocStreams.Id as StreamId,
dbo.AllDocStreams.Content
FROM dbo.AllDocs
RIGHT OUTER JOIN dbo.AllDocStreams ON dbo.AllDocs.Id = dbo.AllDocStreams.Id
WHERE AllDocs.DirName LIKE '%{$search}%'
AND AllDocs.SetupPath IS NULL
AND AllDocs.Extension != ''
";
// The result set
$result = sqlsrv_query($conn, $tsql);

// Process the results
while($row = sqlsrv_fetch_array($result,  SQLSRV_FETCH_ASSOC)){
// When create is true, then it will create the folders in
// in the foreach
$create = false;
$dirptr = $createdir;

// Find the folders and recreate them starting from the searchstring.
$folders = explode('/', $row['DirName']);
foreach ($folders as $val){
if($val == $search || $create == true || empty($search)){
$create = true;
$dirptr .= '/'.$val;
if(!is_dir($dirptr)){
mkdir($dirptr);
echo "INFO: created $dirptr <br/>";
}else{
echo "WARN: skipping $dirptr allready exists. <br />";
}
}
}

// Recreate the file
$filepath = $dirptr.'/'.$row['LeafName'];
if(!is_file($filepath)){
touch($filepath);
}
if($fp = fopen($filepath,'w')){
fwrite($fp, $row['Content']);
echo "INFO: file {$row['LeafName']} written. <br />";
}else{
echo "ERROR: file {$row['LeafName']} could not be written in $filepath. <br />";
}
fclose($fp);
}
// Close the database connection.
sqlsrv_close($conn);
?>

Simply configure the first vars in the script and run the file. It might take a huge while before you get some output.

TIP: Use the $search to narrow down the query a bit.
It searches the DirName (I.e. Site\DocLib\Folder\SubFolder\)

The output will look like this.

INFO: created ./Downloaded/SearchCenter
INFO: created ./Downloaded/SearchCenter/Pages
INFO: file facetedsearch.aspx written.
WARN: skipping ./Downloaded/SearchCenter allready exists.
WARN: skipping ./Downloaded/SearchCenter/Pages allready exists.
INFO: file resultskeyword.aspx written.

ANY THOUGHTS, OR NEED SOME HELP?
Then please leave a comment :-)

WARNING!: YOU NEED THE Microsoft MSSQL DRIVER FOR PHP, not the old php equivalent.
here are some tips on where to get it. My version was php 5.3.8

First off, mssql isnt supported out of the box anymore. when using PHP 5.2 and up, you need to get the Microsoft for PHP driver. Check this site for more information : http://sqlsrvphp.codeplex.com/

Its a bit of an hassle ill give you that.
Challenge: I needed 1.5hours to find the correct Lib,Install,Coding info and get it working.

Basically it requires you to download the native client, the drivers and an correct update of the php.ini your wamp instance is using.

Tip: Use <?php phpinfo() ?> to find the right version for your PHP compilation.
Search for : PHP Extension Build : API20090626,TS,VC9

DIFFERENT SHAREPOINT VERSION?!

Be sure to verify the SQL query inside the $tsql=” var and alter it accordingly. The other part should be pretty straight forward.

networkmapping to sharepoint using VBS.

Some details need allot explaining, so ill just reference to the sources containing the needed information.

First, make sure the Clients WebClient is configured correctly. Configured incorrectly the WebClient will cause headaches. So make sure you read and understand “basic Authentication, and SSL.” Then read this: http://blogs.msdn.com/b/robert_mcmurray/archive/2008/01/17/webdav-redirector-registry-settings.aspx

Next figure out, what version of windows you are running. There are differences between XP (usually working just fine), Vista, Win7, Win8. Afterward read this: http://support.microsoft.com/kb/9410503

finally create a script to test your environment:

Dim objNetwork
Set objNetwork = CreateObject("Wscript.Network")
'http://support.microsoft.com/kb/941050
objNetwork.MapNetworkDrive "G:", "\\your.sharepoint.link.tld@SSL\site\Shared Documents\"
Wscript.Echo "Script completed!"
Wscript.Quit

Cant wait…

After reading this benchmark: http://blog.centreon.com/public/Centreon_Engine_Benchmarks.pdf, I was wondering. isn’t it strange that their own benchmark is telling us they beat the good-old-nagios on all elements?

Do not get me wrong, I still believe that Centreon is a wonderful product. But i cant ignore the fact that the Nagios Core / Nagios XI are on the move as well.  And for some reason I get the feeling they are referring to history. Last time I was informed,  Nagios employed a team of developers as well in developing Nagios XI. And next to that, Nagios also enables OS programmers to commit code: http://www.nagios.org/contribute.

Please dear Centreon, don’t spoil your good name and stick to the facts. You have a great product, no need for bashing. Next to that, don’t use a translate without review in your benchmark documents.

Having that said, what happed to Icinga?

It seams that Icinga is well on their way as well seeing this sheet: https://www.icinga.org/nagios/feature-comparison/

Anyway, any monitoring needs?

It seems a crossroad is nearing in which you are forced to pick a side and stick by it.

And yet somehow, I cant suppress a feeling of sadness about this development.
Goodbye years of scripting, hacking and rewriting happiness, Hello ‘next-next-finish’ world ;-)

Any insights?
Please share them with us web reading it-guy folk  :=)

SPF2010 Explorer view, very poor performance?

Also installed Sharepoint Foundation 2010 in conjunction with your server 2008 server?

Also experiencing very slow performance with the explorer view, or the mapped networkdrive?

Then you might want to turn off “Automatically detect settings.” in the Lan Settings section of IE.

Background

I was also experiencing ridiculous slow performance when opening a document lib in explorer view. At first I thought it was due to the zone settings, which are used by the Web Client, responsible for this connection. After fiddling around with the settings endlessly with no result. Reading the Microsoft (outdated) whitepapers for suggestions with no result, and finaly experimenting with web-folders and webdav -not needed for SharePoint explorer view- with no result… It was clearly time for a different approach.

I installed Wireshark to find out what was actually happening on the line, and this is what I found. After clicking the “view in explorer” link, the following happens on the line:

The yellow lines you see between the “actuall” traffic, are so called “WPAD” queries. WPAD stands for “Web Proxy Automatic Detection”. In the screen you can clearly see that the webclient is trying to auto detect the proxy settings prior to actually connecting. The time this action consumes is equal to the wait time, the user is experiencing.

After disabling this feature in the IE>Internet Options>Connections>Lan Settings>Automatically detect settings. Opening the document library is instant.

After I disabled this setting, the LAN behavior looked like this:

Some tips.

You dont need to install the IIS WebDav in order to use explorer view. SPF implements its own version of WebDAV for this functionality.
“Many people are under the misconception that SharePoint uses the WebDAV functionality provided by IIS 6.0. Actually, SharePoint provides its own WebDAV implementation using the Stsfilt.dll ISAPI filter that is installed with both Windows SharePoint Services and SharePoint Portal Server” (Understanding and troubleshooting Sharepoint Explorer view.doc, Steve Sheppard, 2006)

Explorer view is offered through the Web Client Service. Its useful to understand its dependencies (zones, proxy, and other settings)

(src:troubleshooting SharePoint explorer view.doc, annotations by myself)

Usefull sources:

http://www.microsoft.com/en-us/download/details.aspx?id=9981

http://msdn.microsoft.com/en-us/library/ee705814.aspx

http://support.microsoft.com/kb/2423797

http://support.microsoft.com/kb/2388749

http://support.microsoft.com/kb/923174

Any other useful tips?
Please be generous and share them, just post a comment below!

Backup script for GLPI (http://www.glpi-project.org)

If you are using the great GLPI tool, you will notice that the market value of the data inside will increase rapidly. This usually also implicates that it is ‘wise’ to back this data up.

There are many ways to do so using nice plugins, even nicer gui`s and apps. I (headstrong that I am), wanted something very basic and functional, easy to configure, and that will work in an environment that has multiple GLPI installations. Answer to my question: build something for your own.

So i scripted something for Linux that will allow you to backup the entire GLPI tree (where the uploaded files reside), and the sql database.

Because we use a deduped backup storage (datadomain), i dont have to worry about duplicate data. If you need to, then add something to clean the backup store. This script doesn’t account for that :)

This is the script:


#!/bin/bash
# Wrote by Chris
# Goal is to easly backup glpi in a multi installation environment.

GLPI_DIR='/var/www/glpi_0805';
BACKUP_DIR='/backup/nfsloc';
LOGFILE='/var/log/backup.log';

############################################################################
#Dont change anything after this point, unless you know what you are doing #
#No guarantees, une this script at own risk                                #
############################################################################

# Do some generic stuff here
# Add checks if you like :) 
#############################
MYSQLDUMP=`which mysqldump`;
AWK=`which awk`;
FIND=`which find`;
DATE=`date +%d.%m.%Y`;
LOGTIME=`date +"%d-%m-%Y %H:%m"`;
DBCONFIG=`find $GLPI_DIR -name "config_db.php"`;
DBNAME=`grep "dbdefault" $DBCONFIG | awk -F '=' '{ gsub(/\047/,""); gsub(/\;/,""); gsub(/ /,""); print $2;}'`;
GLPISIZE=`du -sh $GLPI_DIR`;

#
# Start working....
############################
echo -e "$LOGTIME \t## New backup started ##" >> $LOGFILE;
echo -e "$LOGTIME \tpacking: $GLPISIZE.. into $BACKUP_DIR/backup.$DATE.tar.bz2 ..." >> $LOGFILE;
tar -cjPf $BACKUP_DIR/backup.$DATE.tar.bz2 $GLPI_DIR >> $LOGFILE;
echo -e "$LOGTIME \tCreating mysqldump into $BACKUP_DIR/sqldump.$DATE.sql ..." >> $LOGFILE;
mysqldump $DBNAME > $BACKUP_DIR/sqldump.$DATE.sql;
# Go back to original working directory.
echo -e "$LOGTIME \tAll done..." >> $LOGFILE;
echo "all done! ";

exit 0;

If you want to install this script follow the following instructions:


#This is for Oracle Enterprise Linux / RedHat EL distro`s
#Your environment might be slightly different.
cd /opt
mkdir ./scripts
cd scripts
vi ./backup.sh
#insert the code above into the editor and save the lot using ':wq'
#alter the top of the script to match your environment.
chmod +x ./backup.sh
#next create a symbolic link to the cron.daily, this might be different in your linux distro (see manual pages on your distro using 'man cron').
ln -s /opt/scripts/backup.sh /etc/cron.daily/backup
#monitor the /var/log/backup.log for details

Happy backing up :)

(Dont forget to clean the backup dir on a regular basis if you dont have the luxury of an deduping storage)

Exact Globe, folder allready exists during CLIOP export to network.

On Windows 7.

If you get an error message suggesting that the user doesnt have the correct rights to create a new directory inside the designated CLIOP export networkpath. This might be, because you are running Exact in an elevated state (as administrator). This is needed by some users to netupdate the client, but will cause all sorts of problems when the client is used in this state.

To resolve this problem, verify that the user has the proper rights on the designated network location. This can simply be done by opening the path in windows explorer, next create a folder and file. If this is succesfull the network rights are correct (so you dont need to create a new support call ;)

Next verify that the exact client isnt running as administrator. You can verify this by rightclicking the shortcut, and then select properties. Locate the ‘Compatibility’ tab, and verify that the checkbox ‘run as administrator’ isnt checked. IF it is, uncheck it and apply the new settings.

If network policies allow, also verify that the checkbox isnt checked on the exact binairy inside the exact installation dir.

I hope this helps :)

Rgrds, Chris

simple fix for Joomla rss (com_ninjarssyndicator) blank line issue.

Like many we experienced the blank line issue within the Joomla RSS ninja syndicator. The effect of this blank line is that it is not being recognized by rss parsers. To overcome this little issue without needing to hack all the joomla plugin source files in search of this blank line i simply wrote a little PHP script that removes this first line if its there, else it will simply output the rss.

I used this broken company training feed  and fixed it using php. You can view them here.

http://www.amis.nl/index.php?option=com_ninjarsssyndicator&feed_id=7&format=raw

http://technology.amis.nl/blog/xmlfeed.php?id=1

The script to fix it is shown below. Simply alter the urls and paste it inside a php file somewhere on your webserver.

<?php
///////
// Very simple script to clean the blankline from an RSS FEED.
$default = 2; // Default feed id.

if(isset($_GET{'id'})){
   if(is_numeric($_GET{'id'})){
      $index = $_GET{'id'};
   }else{
      $index = $default;
   }
}else{
   $index = $default;
}

$url = 'http://www.domain.ext?option=com_ninjarsssyndicator&feed_id='.$index.'&format=raw';

if($lines = file($url)){
   foreach($lines as $n => $l){
     if(ord($l) != '10'){
       echo "$l";
     }
   }
}
exit;
?>

Samenvatting “Mind Mapping(c)” – Introductiedag 2-9-2011

Mindmap is een geregistreerd handelsmerk van de Buzan Organisation

Vandaag was onze eerste dag op de opleiding Bedrijfskundige Informatica aan de Hogeschool Utrecht.

Als verrassingspresentatie  hebben we vandaag een college gehad van Mvr. drs. Fransien Roovers over het maken van een Mindmap(c). Hierbij gaf zij aan dat een mindmap een prima voorbereiding is op de verschillende opdrachten voor dit jaar.

Het idee van een Mindmap(c) is dat je via een methodische aanpak zowel het logische deel als wel het creatieve deel van je hersenen activeert. Dit is mogelijk door een gedachtepatroon op creatieve wijze op papier te zetten en hierbij bepaalde termen en emoties middels een tekening of sleutelwoord te omschrijven. Het programma dat Mvr. drs. Fransien Roovers behandeld heeft bestond uit de volgende punten;

1. Wat is een mindmap(c) nu precies?
2. Oefenen door zelf een mindmap(c) te maken.
3. Welke regels gelden er bij het maken van een Mindmap(c)?
4. Doel van de Mindmap(c) (hierboven omschreven)

Wat is een mindmap(c) nu precies.

Een mindmap is een boom van kreten die via horizontale takken op logische wijze aan elkaar verbonden zijn. Om de kreten in deze takken te verduidelijken en verdiepen kunnen kleine tekeningen gebruikt worden, maar ook pijlen (relaties) en wolken (groeperen) zijn mogelijkheden. Omdat het mindmappen een creatief en beeldend proces is kan dit het best uitgelegd worden middels een filmpje die mevr. drs. Fransien Roovers met ons deelde.
Achter deze link is een filmpje van een mindmap(c) te bekijken.

Welke regels gelden er?
1. Werk horizontaal.
2. Maak gebruik van symbolen
3. Schrijf de termen duidelijk leesbaar op.
4. Gebruik takken (branches)
5. Maak vloeiende verbindingen tussen de takken
6. Houd de mind map overzichtelijk, leesbaar groot naar klein
7. Maak gebruik van kleuren om gebieden te kenmerken, de aandacht te vestigen op, je creativiteit een boost te geven.
8. Hanteer geen structuur, het mag kris-kras door elkaar, van de hak op de tak
9. Gebruik wolkjes, plaatjes om de te groeperen, schikken, in te dikken etc.
10. Zorg dat je omgeving rustig is, en je voldoende tijd besteed aan het opstellen van de map.

Doel van de mindmap kan zijn,

Manier om nieuwe informatie opnemen.
Methode om gedachten te ordenen voor een presentatie of tekst.
Methode om creatieve ideeën te ontwikkelen.

Opdracht voor de eerste lesdag,

Het afmaken van een mindmap over jouw beleving bij de aankomende studie.

Follow

Get every new post delivered to your Inbox.

Join 49 other followers