sysctlbyname(3) (and others) from Python

Several times in the past I needed to query sysctls from Python. I was unhappy that this was not possible because the Python standard library didn’t include a sysctl function. I even created a Python module just to do this. :-) Of course, you may already be thinking “ctypes! ctypes! ctypes!”. Yes, that’s what I’m going to talk about.

ctypes is a Python module to access foreign C types and functions, namely sysctlbyname(3). It’s easy to work with, here’s an example:

from ctypes import *
libc = CDLL("libc.so")
size = c_uint(0)
libc.sysctlbyname("kern.ostype", None, byref(size), None, 0);
buf = create_string_buffer(size.value)
libc.sysctlbyname("kern.ostype", buf, byref(size), None, 0);
>>> buf.value
'FreeBSD'

 

Python ctypes are available in Python 2.5 and up.

aimon – ACPI AI Boost monitoring for FreeBSD

It’s about time that I release this project to the wild. It’s a really simple thing, nonetheless.

aimon is a system monitor much like MRTG, but specifically designed to monitor acpi_aiboost(4). acpi_aiboost(4) reports these values under FreeBSD and is present on several ASUS workstations and servers.

So, if you want nifty graphics about your server temperature, voltage and fan speed, this is for you. 

Here’s an example of how it looks like:

If you’re interested, the project home page is: http://fnop.net/~rpaulo/aimon/.

Apple’s CalendarServer on FreeBSD

I’ve come across a blog post by Roy Hooper that explains how to setup CalendarServer on FreeBSD. I haven’t tried it yet, but I suppose it should work without much effort.

For those who don’t know, CalendarServer is a WebDAV server that implements the CalDAV extensions. This basically mens that you can register a bunch of users in your CalendarServer and using iCal or Chandler (to name a few) you can send invitations to meetings, share calendars and other nifty things that could help you organize better your company.

FreeBSD and Mac OS X: a happy combination

I notice that most of my readers’ homes consist of one/more FreeBSD server(s) and one/more Apple computer(s) running Mac OS X. In this post I will introduce the multicast DNS and service discovery concepts. Both are very will suited for a workstation running Mac OS X and a home server running FreeBSD. In the previous blog post I showed how you could use FreeBSD as a Time Machine backup and now I’m going to show you how to make your FreeBSD look like an Apple Xserve. :-)

I assume familiarity with FreeBSD administration and some networking concepts.

Continue reading