Monday, December 17, 2012

Introducing django and mysql

I wanted to do some rapid prototyping with web applications, and decided to give python and django a go. There are various tutorials out there, but none of them seem to focus on using existing database structures and views.

So this is primarily to document my own findings. If someone else finds it useful: be my guest. ;-)

Oracle OMS Agent migration

I've recently migrated a few Oracle databases to Enterprise Manager 12c. While this is worth a few posts on it's own, here's just a quick hint of how to update the IP/hostname of an agent after it's been registered at OEM.

First, verify that the agent is responding to requests, by navigating to the new IP/host with your browser:
https://my.new_server.lan:3872/emd/main/
Then log on to the OEM repository DB as sysman. The table MGMT_TARGETS holds all the juicy agent details. Just update the column EMD_URL with the new value, and everything is fine.
For instance
update mgmt_targets set emd_url=replace(emd_url,'my.server.lan','my.new_server.lan')  where target_name like '%my.server.lan%';
Verify your changes in the view MGMT$TARGET.
Finally the agent should be available in Setup - Agents at once. I then resync'd the agent from EMS, and secured the agent. All targets were up and running without issues then.

Tuesday, September 18, 2012

trac-0.12.3 and HTML notifications and commit_updater

As I've written before, trac-0.12.3 still doesn't HTML notifications. Maurice found out how to work around a limitation with the commit_updater plugin here.


Tuesday, May 29, 2012

XenServer and "The VDI is not available"

I've been happily running XenServer for a few years now. Last week I encountered a weird issue with seemingly corrupted VDIs, which turned out to be fine after a server reboot.
In the aftermath I had a corrupted storage repository, that manifested like this:
  • Unable to scan the SR:
Error code: SR_BACKEND_FAILURE_46
Error parameters: , The VDI is not available [opterr=Error scanning VDI <uuid> ]
  • Unable to copy VDIs from or to the SR
    This was nasty, because this meant it wasn't possible to backup virtual disks.
After reading comments on the XenServer forums for many hours I found a working solution. First of all check the file /var/log/SMlog on the pool master server and then trigger a rescan of the bad SR. In my case I had a VDI with an invalid footer.
The log looks like this:
***** VHD scan error: vhd=VHD-<uuid> scan-error=-22 error-message='invalid footer'
*** vhd-scan error: <uuid>
Raising exception [46, The VDI is not available [opterr=Error scanning VDI <uuid>]]
I verified this by running
/usr/sbin/vhd-util scan -f -m "VHD-*" -l VG_XenStorage-<storage-reporitory-uuid> -p
Which, amongst others, gave me this line:
vhd=VHD-<uuid> scan-error=-22 error-message='invalid footer'
 Now many people recommended running vdi-forget to get rid of this VDI. I tried that, but that didn't fix anything. Others recommended running vdi-destroy. After I ran vdi-forget I wasn't able to run vdi-destroy anymore. So I had to work it out using lvremove like this:
lvremove /dev/VG_XenStorage-<storage-repository-uuid>/VHD-<uuid>
This gave me a few warnings like "open failed: Read-only file system" but in the end it did the trick. I re-scanned the storage repository and it finally worked. A few orphaned VDIs showed up which I promptly removed. Subsequent rescans of my SR coalesced VDIs without problems.

I found these links to be helpful: CTX122001 and Thread: Issue with reclaiming disk space in xenserver 6.0.

For the record, I'm running XenServer 5.6 SP2.

Thursday, March 15, 2012

check_email_delivery and SMTP SSL

For all of you who want/need/have to monitor an email server's performance or delay, there is a nice plugin for nagios out there written by Jonathan Buhacoff. It's not only a single plugin either, but a suite of scripts to check various smtp- and imap-related things.

Friday, March 2, 2012

Logitech Media Server & MySQL

Logitech, in their infinite wisdom, has decided to rename slimserver to SqueezeCenter then Squeezebox Server and finally Logitech Media Server.
Because I like to run it on my NAS, I despise the embedded SQLite and always want it to use MySQL instead. This has always been well-documented in the slimdevices wiki.
When these steps are applied to Logitech Media Server, it reverts to SQLite on it's own.

After some troubleshooting i found updated instructions here. For the tl;dr folks, here's the relevant lines to server.prefs:
dbtype: MySQL
dbusername: slimserver
dbpassword: slimserver
dbsource: dbi:mysql:database=slimserver;mysql_socket=/var/lib/mysql/mysql.sock
 I can't wait to see how they will name v8 - and how they'll change the config settings once more. Sigh.

Tuesday, February 28, 2012

trac-0.12.3 and HTML notification

Trac still does not do HTML mails. As I've written before, it can be hacked to send good looking HTML notifications, though. I happily used trac-0.12.2 until I discovered some issues with subversion-1.7.
So I upgraded to trac-0.12.3, the upgrade went seamlessly. All it took as a repository resync for changesets with removed files to show up again. Yay!
Of course trac still doesn't send HTML notifications, so I had to apply my previous patches from trac-0.12.2. Except for trac/ticket/notification.py this was rather easy. See my diff here or grab it from pastebin.

Wednesday, February 15, 2012

trac and HTML notifications

Hacking Trac

Of course I used a modified trac 0.10 before, so there were some features I wanted to keep. The most important one are HTML notifications on ticket changes. Today, in trac 0.12.2 this feature still hasn't made it into their trunk. I find it sad really, but that's another story.

There are a few places that offer patches, but none is complete, and worst of all, none seems to work with trac 0.12.2 right away.

So, for any poor souls in the same situation, here's what I did to make it work. First of all download the sources for trac (v0.12.2 in my case), grabbed the best parts of the patches mentioned above, and set to work patching trac. Then I created an egg file, installed it and restarted apache. That's all!