CodeLab
9Aug/110

Memcached ZenPack version 1.2

After a long wait the version 1.2 of the ZenPacks.community.Memcached zenpack is ready (currently waiting for zenoss to process the github pull request).

3Mar/11Off

Python introspection: find which class defines each method

At $work we are currently developing a medium size framework where a common practice is having several levels of subclasses. Scripts written to exercise this framework can either use the subclasses for very specific functionality or restrict themselves to the top-level-class' methods only for maximum portability. But with several levels of inheritance, how do know in which class a method was defined? The solution that follows was a courtesy of Alex Martelli on the online forum stackoverflow:

Filed under: Python Continue reading
23Feb/11Off

Simple HTTP streaming with Twisted & Javascript

When writing web based apps a recurring problem is updating page contents in response to server side events. A classical pattern to solve it is to do periodic pooling of the server using XMLHttpRequests, however this often leads to making far more HTTP requests than what is really needed. It would be best to be able to originate the update from the server. Emerging technologies such as HTML5 websockets may provide a neat solution in the future, but until they become widely supported by all major browsers your path will be filled of all sort of "workarounds" to emulate the websockets on all those still catching-up. However a simple solution may be at hand in some particular cases: enter the world of html streaming.

23Sep/10Off

Quick sitemaps with PERL, WWW::Mechanize and the Template Toolkit

Recently, I redesigned the http://www.ferrarihaines.com website, and re-wrote its back-end to make it Catalyst-based (I know, it seems like an overkill, but this sets a nice base for future plans). While getting ready to launch the new version I needed to update the sitemap.xml, but despite of FH being a small site, working out manually all the new links seemed a very tedious task

19Aug/100

Writing a custom, non-SNMP, non-SSH, PythonPlugin-based zenoss modeler

If you have been customizing zenoss to suit your business needs you are likely to have developed several SNMP-based or SSH-based modelers in your zenpacks. But what if either protocol does not suit your needs? There is another, not so well documented plug-in class supported by zenoss: PythonPlugin.

24Jun/100

Accessing zenoss dmd from standalone scripts

Quite often is is very useful scripting repetitive tasks in zenoss, whether it might be listing devices and its properties, dumping lists of users, re-arranging organizers or other type of routine maintenance. To do so invariably you need to get hold of the zenoss dmd. This is a short snipped showing a way of doing it:

9May/10Off

Sorting SNMP oids in PERL

The most efficient way of sorting SNMP oids in perl is using the XS-based module Sort::Key::OID by S. FandiƱo. But some times going to the change request bureaucracy to get approved & installed a new module might take a while; or simply you want to avoid the maintenance overhead of an extra module in your farm for such a basic functionality.

Here is a pure PERL alternative, based in Randal's well known Schwartzian transform:

5May/10Off

Clone VirtualBox disks (.vdi) to duplicate a virtual machines

  1. Release and remove the VMware image from virtualbox's virtual media manager if the disk is already in use by one of your virtual machines.
  2. Copy the disk using VBoxManage:
5May/10Off

Convert VMware disks (.vmdk) to VirtualBox format (.vdi)

Although you can play directly VMware images in VirtualBox, sometimes you might prefer to convert it to a native .vdi image so you can use all the standard commands like clonevdi, etc on it.

Converting the image is quite straightforward:

  1. Release and remove the VMware image from virtualbox's virtual media manager if the disk is already in use by one of your virtual machines.
  2. Clone the disk specifying VDI as output format:
1May/1017

Monitoring memcached with a Zenoss Zenpack

Zenoss is an open source enterprise-grade monitoring tool that quickly is becoming a standard among the monitoring applications.

This step-by-step guide shows how to monitor memcached instances using a custom Zenoss Zenpack. The Zenoss.community.Memcached zenpack extends Zenoss to provide a custom datasource type, MemcachedStats, which automatically brings to Zenoss all the sections of the memcached stats as datapoints.