Archive for the Category » OpenSolaris «

Friday, February 26th, 2010 | Author:

kermitOn my Solaris machines at $WORK I use iMil‘s pkgin to install additional software. But until today, I add to do it by hand, on every machine… Not really what I like to do after a little more than a year using puppet. So I wrote a provider to manage packages with pkgin. It was very informative on puppet internals and I learned more about my favorite config management system.

Enough talking, here is the file : pkgin.rb

Example of use in a manifest :

class foo {
    package { "bla":
        ensure => installed,
        provider => pkgin
    }
}
Wednesday, March 04th, 2009 | Author:

eth0Et voila, mon premier plugin pour munin ! C’est un plugin solaris only (utilisation du module Kstat oblige) qui permet de monitorer les I/O sur les pools ZFS. Je n’ai pas trouvé comment faire des stats par pool (comprendre à la “zpool iostat”) et si quelqu’un a une astuce à ce niveau là, je suis preneur. En attendant voici le fichier.

Tuesday, March 03rd, 2009 | Author:

Petit post rapide en forme de pense bête : pour extraire des infos sur les I/O des pools ZFS en perl (sous solaris) :

#!/usr/perl5/bin/perl -w
 
use strict;
use Sun::Solaris::Kstat;
 
my $Kstat = Sun::Solaris::Kstat->new();
 
my $bytes_read = ${Kstat}->{unix}->{0}->{vopstats_zfs}->{read_bytes};
my $bytes_write = ${Kstat}->{unix}->{0}->{vopstats_zfs}->{write_bytes};
 
print $bytes_read." / ".$bytes_write."\n";

A venir : un plugin munin pour grapher les I/O ZFS

Category: Code, OpenSolaris, SysAdmin  | Tags: ,  | One Comment
Thursday, November 13th, 2008 | Author:

Il y a quelques temps j’ai essayé de monter des disques iSCSI exportés depuis mes filers opensolaris sur des machines linux. Le problème c’est que lors de la connexion à la target, l’initiator se plantait lamentablement dans un kernel panic de derrière les fagots. Maintenant que lenny est presque là, avec des kernels récents (2.6.26) on peut jouer avec tout ça. Petit résumé & regroupement des informations éparpillées à travers le web. La target sera une machine solaris, et l’initiator une debian dotée d’un kernel 2.6.26-1-amd64.

Sur la machine solaris :

# on vérifie que les packages nécessaires sont là
solaris-devx$ pkginfo |grep iscsi
system      SUNWiscsir                       Sun iSCSI Device Driver (root)
system      SUNWiscsitgtr                    Sun iSCSI Target (Root)
system      SUNWiscsitgtu                    Sun iSCSI Target (Usr)
system      SUNWiscsiu                       Sun iSCSI Management Utilities (usr)

# on active le service iscsi target
solaris-devx# svcadm enable iscsitgt

# configuration du discovery iscsi
solaris-devx# iscsiadm modify discovery --sendtargets enable
solaris-devx# iscsiadm add discovery-address <ip_solaris>

# Création de volumes ZFS à exporter
solaris-devx# zfs create tank/xen
solaris-devx# zfs set shareiscsi=on tank/xen
# volume1 héritera des propriétés de tank/xen et sera directement partagé
solaris-devx# zfs create -s -V 10g tank/xen/volume1
# petite vérification
solaris-devx# iscsiadm list target
Target: iqn.1986-03.com.sun:02:6bc5ce3d-eb83-4055-fe67-d1fd9a7eb7b7
        Alias: tank/xen/volume1
        TPGT: 1
        ISID: 4000002a0000
        Connections: 1

Sur la machine debian :

# on installe open-iscsi
debian-test# apt-get install open-iscsi
# on se logge sur la target
debian-test# iscsiadm -m discovery -t st -p <ip_solaris>
<ip_solaris>:3260,1 iqn.1986-03.com.sun:02:6bc5ce3d-eb83-4055-fe67-d1fd9a7eb7b7
debian-test# iscsiadm  -m node -l -T "iqn.1986-03.com.sun:02:6bc5ce3d-eb83-4055-fe67-d1fd9a7eb7b7"
Logging in to [iface: default, target: iqn.1986-03.com.sun:02:6bc5ce3d-eb83-4055-fe67-d1fd9a7eb7b7, portal: <ip_solaris>,3260]
Login to [iface: default, target: iqn.1986-03.com.sun:02:6bc5ce3d-eb83-4055-fe67-d1fd9a7eb7b7, portal: <ip_solaris>,3260]: successful
# vérification
debian-test# dmesg
[snip]
[58182.163989] sd 3:0:0:0: [sdc] 20971520 512-byte hardware sectors (10737 MB)
[58182.167839] sd 3:0:0:0: [sdc] Write Protect is off
[58182.167867] sd 3:0:0:0: [sdc] Mode Sense: 67 00 00 08
[58182.171977] sd 3:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[58182.175981] sd 3:0:0:0: [sdc] 20971520 512-byte hardware sectors (10737 MB)
[58182.175989] sd 3:0:0:0: [sdc] Write Protect is off
[58182.175989] sd 3:0:0:0: [sdc] Mode Sense: 67 00 00 08
[58182.183974] sd 3:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[58182.183989]  sdc: sdc1
[58182.187989] sd 3:0:0:0: [sdc] Attached SCSI disk

Et voila ! un beau disque tout beau tout chaud ! A noter plusieurs choses : la première c’est qu’on a opéré en live, sans authentification ni rien. iSCSI supporte néanmoins ces features. La seconde c’est que les IQN sont pour le moins “cryptiques”. Il est possible de les renommer pour les rendre humainement compréhensibles.

Sources : benr & wiki debian.

Thursday, April 03rd, 2008 | Author:

This post follows this one and is a translation of what I wrote here.

It does not exist (yet) MIBs for ZFS, and particulary to check failed disks. This is quite annoying. Hopefully, Solaris has (since Solaris 10) Fault Manager.

Quick FMd

fmd in 3 commands :

  • fmadm faulty : lists the problems (and their UUID)
  • fmadm repair [UUID] : marks the problem as repaired
  • fmdump : dump problems list, including repaired ones

Installing SNMPd

pkgadd -d [repsdespackages] SUNWsmcmd SUNWsmmgr SUNWsmagt

Run snmpconf (with the -i switch) to setup easily the behaviour of the daemon.

and of course :

svcadm enable sma

SNMPd & FMd
Add into /etc/sma/snmp/snmpd.conf :

dlmod sunFM /usr/lib/fm/amd64/libfmd_snmp.so.1

to activate the snmp module for fmd

and then restart sma :

svcadm restart sma

Please note that the path is arch dependant (x86 64 bits here)

Crash test it

# prepare a file based zfs pool
mkdir crash
cd crash
# Files must be > 64M
dd if=/dev/zero of=pool1 bs=1024k count=64
dd if=/dev/zero of=pool2 bs=1024k count=64
dd if=/dev/zero of=pool3 bs=1024k count=64
# create the pool
sudo zpool create crashtest raidz /home/nico/crash/pool1 /home/nico/crash/pool2 /home/nico/crash/pool3
# break it
rm pool3
# scrub it (to be sure that the system sees the failure)
sudo zpool scrub crashtest
# check that fmd does its job
sudo fmadm faulty

Now, let’s see what informations we get with SNMP :

snmptable -v2c -c public 127.0.0.1 SUN-FM-MIB::sunFmProblemTable

| sunFmProblemUUID | sunFmProblemCode | sunFmProblemURL | sunFmProblemDiagEngine | sunFmProblemDiagTime | SunFmProblemSuspectCount |
| “96397f16-1cea-463b-e9db-de989cd42e81” | ? | ? | ? | ? | ? |

The module exports 4 tables : sunFmProblemTable, sunFmFaultEventTable, sunFmModuleTable, sunFmResourceTable

the easiest way is to use snmpwalk :

snmpwalk -c public -v 2c 127.0.0.1 SUN-FM-MIB::sunFmProblemTable
SUN-FM-MIB::sunFmProblemUUID.”96397f16-1cea-463b-e9db-de989cd42e81″ = STRING: “96397f16-1cea-463b-e9db-de989cd42e81″
SUN-FM-MIB::sunFmProblemCode.”96397f16-1cea-463b-e9db-de989cd42e81″ = STRING: ZFS-8000-D3
SUN-FM-MIB::sunFmProblemURL.”96397f16-1cea-463b-e9db-de989cd42e81″ = STRING: http://sun.com/msg/ZFS-8000-D3
SUN-FM-MIB::sunFmProblemDiagEngine.”96397f16-1cea-463b-e9db-de989cd42e81″ = STRING: fmd:///module/zfs-diagnosis
SUN-FM-MIB::sunFmProblemDiagTime.”96397f16-1cea-463b-e9db-de989cd42e81″ = STRING: 2008-2-21,12:31:2.0,+1:0
SUN-FM-MIB::sunFmProblemSuspectCount.”96397f16-1cea-463b-e9db-de989cd42e81” = Gauge32: 1

Nagios integration

See this post.

See also

All this stuff is based upon this excellent post.

Thursday, February 21st, 2008 | Author:

OpenSolaris has a nice feature : the fault manager. I wrote a little plugin for Nagios to be able to monitor events that are generated through this facility via SNMP. You will find the (little) howto here.

I would also like to thank all the #opensolaris & #opensolaris-fr crew on freenode for the support and the time they gave to me.

Download : SNMP & fmd

Monday, November 26th, 2007 | Author:

Une intro sympa, simple sans être fade au combo iSCSI + Solaris (même si j’ai rencontré quelques soucis avec OpenSolaris + iSCSI + ZFS) par un monsieur fort convivial qui poste régulièrement des choses sympa sur Solaris (la plupart du temps valables pour OpenSolaris du coup).