Enable software RAID on XenServer 6.2

Posted by: admin  :  Category: Bits and Bytes

Bevore we start:

I shall not use this on production servers. I shall not use this on production servers. I shall not use this on production servers. I shall not use this on production servers.

[Daaa daadidaada daa dadada daaa] (The Simpson theme rolling …)

Umm… where was I? Right, enabling a software RAID on XenServer 6.2. Possible? Yes. Recommended? No. Field of use: Poor techies like unable to afford a hardware RAID controller for a simple test box ;-)
Read more…

Bash Script to rip CD/DVD ISO image on OS X

Posted by: admin  :  Category: Operating Systems, OS X, Programming, Scripting

Apple’s OS X has an easy way to rip a CD/DVD image using Disk Utility program.
However, you’ll end up with a file in that is not in ISO format, thus utterly useless if you want to re-use the file for virtualization purposes or on another operating system unable to handle those .cdr files.

For a one-shot option, OS X provides everything to convert the .cdr to .iso files, which is outlined at http://imacify.com/2013/06/how-to-create-iso-disc-image-from-cddvd-in-mac-os-x/.

If you do however plan to rip a lot (and I mean, a lot!) of CDs/DVDs to ISO files on OS X, here’s a little bash script I came up with.

Read more…

Intercept Cisco’s “write net” command with EEM

Posted by: admin  :  Category: Cisco, Networking

Well, here’s just a quick snippet on how to intercept Cisco’s “write net” command.

Why would I want to do it? Because people are lazy and tend to forget.
So instead of forcing them to remember, that they need to add the ‘/incoming’ directory for config writebacks,
I just let an EEM applet do the trick.

How is it working?

The EEM applet is intercepting the ‘write net’ cli command by matching all inputs against the pattern given.
Whenever the command is seen, it will run my own commands instead. Nice, huh? ;-?

Enough talking, here’s the code:

no event manager applet WRITENET
event manager applet WRITENET
event cli pattern “write net” sync yes
action 1.0 puts “Please wait …”
action 1.5 cli command “enable”
action 2.0 cli command “conf t”
action 2.1 cli command “file prompt quiet”
action 2.2 cli command “exit”
action 3.0 cli command “copy run tftp://tftp01/incoming/”
action 4.0 cli command “conf t”
action 4.1 cli command “no file prompt quiet”
action 4.2 cli command “exit”
action 5.0 puts “Copy stored to TFTP server at /incoming, good bye”

Use Arduino Micro as ISP with ATmega on a breadboard

Posted by: gdelmatto  :  Category: Hacks, Hardware, HowTo's

Arduino is super cool, I really love that thing, but …

Who would really want to put a fully-featured Arduino board into each and every project, at least when they’re built to more like a permanent setting?
I guess nobody. Honestly, an Arduino is not expensive to buy, but to expensive, if you want to put dozens of them in place.

So, why not put just the ATmega chip, which drives every Arduino at its heart, inside and leave all the rest away?

This is what this post The RRRRRRRRRRBBA, a $3 Arduino talks about: Just provide power to the ATmega and get rid of all the bells and whistles. You can even spare the oscillator and the resistors.

Well, this is exactly what I wanted. But since I didn’t have the proper gear at hands to flash the ATmega chip, I first had to look into another topic, namely how to turn your existing Arduino into an ASP (in-system programmer).

Here’s some of the pages I came along:

Arduino ISP
Arduino to Breadboard
The Arduino Micro schematic
Arduino Leonardo as ISP
Arduino Micro as ISP and atTiny84A

But I soon found that doing so with an Arduino Micro, the only one I had available at that time, is not as straight forward as with other Arduino boards.
So I did this writeup to cover my findings on this.
Read more…

Raspberry Pi with Raspbmc: Getting around Onkyo and Philips woes

Posted by: gdelmatto  :  Category: Hardware, HowTo's

The culprit with technology is always the same: to old, to buggy, something missing here and there.
Adding something new usually urges you to add even more to get it running, so in the end, yeah, you know, why didn’t I stay with what I had before?

So to speak recently when I hooked a Raspberry Pi equipped with Raspbmc to my almost prehistoric Philips 42PF9966/10 plasma tv.
The reasing for doing so? Well, I use XBMC on a (jailbroken) Apple TV 2 for some time now and got fond of it.
Yet, for some obscure reason, the ATV2 only works properly when connected to my ultra cheap noname TV through HDMI.
With my Philips TV, the ATV2 would just refrain from working. All I’d get is a black screen and nothing else. Apple declares this being because of the connector type, because the Philips TV offers only one DVI digital input. Well, seems they didn’t know that HDMI was designed for backwards-compatibility with DVI, it uses the same protocols, but … yeah … you know … ;-)

So, when I heard about upcoming XBMC supporting the Raspberry Pi, I gave it a try.
I was happy to see that it indeed worked on my Philips TV. But since I had only one digital input, which was taken up by my Bluray player, I had to put a new A/V receiver in between to get enough inputs.

So after hooking up everything to my new Onkyo receiver through HDMI, connecting the later with HDMI-to-DVI to the Philips TV, I soon found that the Raspi wouldn’t give video output. And neither would it give an audio signal. Still, the Sony BD player worked like a charm.

So I connected the Raspi directly to the Philips again, which finally gave a video signal, but only after rebooting the box. After reconnecting it to the receiver, I finally got a video singal through the receiver, but still no audio, and yet, it wouldn’t last after the next reboot.

Reading on some Raspberry Pi internal workings, I found this:

  1. The Raspberry Pi does always fall back to Composite output if no HDMI display is found during startup
  2. If the HDMI display does not support audio capability, audio output on HDMI is disabled

Well, that seemed at least to explain it.
To get around it, I had to to force the Raspberry Pi to always drive the HDMI output, regardless if a display was connected or not.

According to http://elinux.org/RPiconfig these are the settings, that need to be added to /boot/config.txt to achieve this.

hdmi_force_hotplug=1
hdmi_drive=2
hdmi_group=1

However I still had some issues getting video output to work properly. Especially, I couldn’t get stable 720p output, so I had to force it to 1080i. These symptoms went away using these settings:

config_hdmi_boost=4
hdmi_mode=5

Still I had no audio. To get this working, I had do force audio output via HDMI. Additionally, I really had to enable the “ignore edid” data mode, although I wouldn’t expect my Philips TV being a “crappy Chinese one” as stated in the docs ;-)

hdmi_ignore_edid=0xa5000080
hdmi_force_edid_audio=1

After all, everything works fine now, so no reason to buy a new TV :-)

Inofficial FreeBSD port for Zend Optimizer Plus

Posted by: gdelmatto  :  Category: FreeBSD, PHP

While just in the process of doing web-server freshup on FreeBSD, I was caught by the good news that Zend Technologies have released their Zend opcode caching engine as open source.

Now it’s called Zend Optimizer Plus and hosted over there at github.

As far as I have seen, it did not yet popup as a buildable port on FreeBSD’s ports tree, but that can only take little time for today.
So I quickly made up my own port which you can download here.

To build it, simply download and extract the file to /usr/ports/devel:

cd /usr/ports/devel
fetch -o- http://phaq.phunsites.net/files/2013/02/ZendOptimizerPlus.tgz | tar -xzpvf -

Then “make install” as usual:

cd /usr/ports/devel/ZendOptimizerPlus
make install

Afterwards, running “php -i” (or phpinfo from a web-accessible script file) should denote it runs “with Zend Optimizer+ 7.0.0-dev”.

Done :-)

Nagios/Icinga Plugin to check for DokuWiki Updates

Posted by: gdelmatto  :  Category: HowTo's, Perl, Programming, Scripting

Nagios/Icinga can also serve to send you friendly remindes, like for example that you need to perform software updates.

Here’s my little contribution, a simple plugins to monitor a given DokuWiki site and check against the release server for any upgrades.

Just fetch the check_dokuwiki-0.1 tarball and extract the check_dokuwiki script to your Nagios/Icinga plugin directory.
Then add a command config like this:

# 'check_dokuwiki' command definition
define command{
        command_name	check_dokuwiki
        command_line	/usr/local/libexec/nagios/check_dokuwiki -H $HOSTNAME
	}

Then simply add a service to one or more of your DokuWiki hosts (or hostgroups, whatever you prefer).

define service{
        use                     generic-service
        host_name               your_wiki_host_objects_list_here
        service_description     dokuwiki_version
        check_command           check_dokuwiki
        max_check_attempts      5
        check_interval          5
        retry_interval          3
        check_period            24x7
        notification_interval   0
        notification_period     24x7
        notification_options    w,c,r
        }

Restart Nagios/Icinga and you’re done.

Happy monitoring :-)

Perl/SOAP::Lite: Rewrite response XML for ASP.NET compatibility

Posted by: gdelmatto  :  Category: Hacks, Perl, Programming

So you finally hacked up your nifty SOAP::Lite web service only to find that it works fine with SOAP::Lite or PHP clients, but ASP.NET terribily fails?
Yes, I should mention, that you must of course write up a WSDL first, especially for .NET, I’ll cover that topic in a follow-up.

This post however refers to a hack that I have done to SOAP::Lite to allow for dynamic response rewriting for different SOAP client implementations.
Read more…

Validate your self-created SNMP MIB

Posted by: gdelmatto  :  Category: Bits and Bytes, Memos

So, if you ever need to create your own SNMP MIB and are not relying on any given tools (i.e. you’re so crazy to write it on your own in a text editor), you may still want to validate it afterwards.

Here’s a nice web-based validator, that does the trick for you:

http://www.simpleweb.org/ietf/mibs/validate/

Notify me if IP is propagated in DNS

Posted by: gdelmatto  :  Category: Memos

So here’s my short snipped of a bash shell loop I hacked up.
It’s only purpose is to check in DNS repeatedly if a certain IP address is propagated for a given fully qualified domain name.

If the script sees the IP address, it would “ring the bell” and exit, otherwise it sleeps for a while and repeats the check.

This way I could leave it running in the console and – whenever the IP appeared in DNS – I’d get an audible alert.
No big trick after all ;-)

Here’s the code:

$ while [ : ] ; do echo scanning ... ; dig @DNSSERVER FQDN | grep IPADDR && { echo -e "\a"; break; } || sleep 5;   done

And here’s what it looks like in action:

scanning ...
scanning ...
scanning ...
scanning ...
scanning ...
scanning ...
my-cool-fqdn.some.domain.tld. 3600 IN	A	192.0.2.1
[you would hear a "bing" tone at this point as well]