Archive for the ‘Solaris’ Category

Python winbind/libwbclient module

Friday, November 13th, 2009

I’ve created a python ctypes-based module for interfacing with samba libwbclient, using ctypes means that it doesn’t require compilation, but this does rely on the ABI be compatible between versions of libwbclient, if you notice strange behavior or random segfaults, contact me.

Its tested on Linux but should in theory work on solaris, or any OS with python ctypes and samba 3.2.

Overview of the class:

class WBClient(__builtin__.object)

Class that interfaces with libwbclient via ctypes.

Optionally pass in a domain name, if no domain name is supplied the

default domain is used(from libwbclient).

Methods defined here:

__init__(self, default_domain=None)

authenticate_user(self, username, password, domain=None)

Authenticates a user

If the winbind seperator is in the username False is returned

This means username\password doesnt work, one must explicitly give

the domain as the 3rd argument if not authenticating off the default domain

Returns the full username in the form of Domain\Username (or a different winbind separator) if successful, None if not.

change_user_password(self, username, oldpw, newpw)

Change user password, (Working with samba 3.4)

get_display_name(self, username, domain=None)

Gets the display name of a user/group

get_group_membership(self, username, domain=None)

This function looks up the group membership of a user,

Returns a list if successful, None if not

get_sid(self, name, domain=None)

Get the SID string of a user/group/machine

list_groups(self, domain=None)

Lists the groups in a domain

list_users(self, domain=None)

Lists the users in a domain

lookup_domain_controller(self, domain=None)

Lookup domain controller for a domain(Could not get to work)


(re)loads Interface details, winbind separator etc

resolve_wins_by_ip(self, ip)

Resolve an IP to a Netbios name

resolve_wins_by_name(self, name)

Resolve a Netbios name to an IP.

Get your copy from

Nagios SunRay Plugin

Wednesday, March 4th, 2009

I was looking around for a nagios plugin to monitor our sunray servers where I work and I couldn’t find any. So I cooked my own. check_sunray

It’s basically just a wrapper around utwho.

The mandatory arguments for the plugin are -w and -c. -w is the warning threshold for the amount of sunray sessions and -c is the critical threshold for the amount of sunray sessions.

By default it counts all logged-in sunray sessions(but not necessarily active), i.e. the output of utwho with no arguments, with the -o option it only counts active sunray sessions(eq to utwho -c) and -a counts all sessions, even non logged-in ones (eq to utwho -a)

I use nrpe to monitor my remote sunray servers so this is the definition in nrpe.conf:

command[check_sunray]=/opt/csw/libexec/nagios-plugins/check_sunray -w 10 -c 20 -o

This will raise a warning alert if the amount of active sunray sessions goes over 10 and a critical alert if the amount of active sunray sessions goes over 20.

This has only been tested with SRSS 4.1 on solaris but im pretty sure it’ll work with linux SRSS.

If anyone has any other ideas on how to monitor a sunray server leave me a comment.

OpenSolaris in XEN

Saturday, February 9th, 2008

So I took on to put (open)Solaris in a Suse Linux 10.3 Dom0 with xen 3.1 64bit. I made a LOT of silly mistakes along the way, the first and most time wasting mistake was trying to work off the first CD instead of the DVD. The reason this was such a waste of time is because the CD doesn’t come with the 64 bit miniroot(boot_archive) so the kernel cant be loaded properly(look out for panic[cpu0]/thread=d30cfe00: HYPERVISOR_mmu_update() failed) , this wouldnt have been a problem if I was using 32 bit but unfortunately I wasn’t.

The general procedure after you download the DVD is as follows. As I’m using suse they like to bastardise things so it doesn’t come with pygrub, which is needed for a simpler install, so i had to fetch the kernel and the boot archive myself by mounting the ISO loop back and fetching the following files:

mount -o loop /home/dmarkey/sol.iso /mnt
mkdir /xen/solaris

cp /mnt/boot/amd64/x86.miniroot /xen/solaris

cp /mnt//platform/i86xpv/kernel/amd64/unix /xen/solaris

OK so now me have our kernel and our boot archive, now to generate our XEN configuration file.

name = ’solaris’
memory = ‘1024′
disk = [ 'file:/home/dmarkey/sol.iso,6:cdrom,r','file:/home/dmarkey/solaris.disk,0,w' ]
vif = [ 'mac=00:16:3e:00:20:11' ]
on_shutdown = ‘destroy’
on_reboot = ‘restart’
on_crash = ‘destroy’
kernel = ‘/xen/solaris/unix’
ramdisk = ‘/xen/solaris/x86.miniroot’
extra = ‘/platform/i86xpv/kernel/amd64/unix -B install_media=cdrom’

Because the boot archive is so bloated, you need a LOT of ram to get it booted, thats why I’m allocating 1024 meg of RAM. So now we have to generate the hard disk file, use something like DD to create a >8G file in /home/dmarkey/solaris.disk or wherever you want to put it, remember to change all the file paths in you configuration. I named this configuration file /xen/solaris/solaris.

So now we should be able to boot, so we do:

xm create -c /xen/solaris/solaris

And fingers crossed we should be able to perform a Solaris setup. When the setup is finished we need to edit the config file. First uncomment the #root=’/dev/dsk/c0d0s0′ line, and then we change the extra line to simply extra = ‘/platform/i86xpv/kernel/amd64/unix’ and you can reduce the amount of ram to 512 if you want.

The performance of Solaris under XEN is i would say near to native. The only problem is that solaris need 512mb of ram to even attempt to boot. This is because of the huge boot_archive (x86.miniroot). In another entry I will go through the steps to make a smaller boot_archive and now my Solaris under Xen will successfully boot with 96M of ram!

Copyright © 2019 All Rights Reserved.
No computers were harmed in the 0.056 seconds it took to produce this page.