Friday, August 9, 2013

MegaCLI on SmartOS

I'm working on a Dell R710 with PERC H700 controller.

# prtconf -v|grep -i raid
                        value='RAID controller'
                        value='MegaRAID SAS 2108 [Liberator]'


# prtconf -v|grep -i perc
                        value='PERC H700 Integrated'
...


Firts of all go to LSI website http://www.lsi.com/support/Pages/Download-Results.aspx and search by keyword "MegaCLI. Then download Latest MegaCLI (there is Solaris OS).

Unzip it and copy MegaCLI/MegaCli_Solaris/x86/MegaCli to your SmartOS global zone (under /opt/custom/bin for example).

Now edit it with vi (yes, with vi), search for mr_sas and change this word (the driver name) to dr_sas.

Without doing this the utility doesn't detect any controller.
i.e.

# ./MegaCli -adpCount                              

Controller Count: 0.

Exit Code: 0x00


Thanks to jacques, Nils and elijah on the smartos-discuss mailing list.

Wednesday, August 7, 2013

using send_nsca from SmartOS global zone

If you don't want to install pkgin in the global zone, but you want to use Nagios send_nsca command, this is how I did it.

Inside a zone install the nagios-nsca package.

pkgin in nagios-nsca-2.9.1nb2


From the global zone, cd to the zone zfs and copy these files in a place of your own.

cd /zones/<uuid>

cp opt/local/gcc47/x86_64-sun-solaris2.11/lib/amd64/libgcc_s.so.1 /opt/custom/nsca/

cp opt/local/gcc47/x86_64-sun-solaris2.11/lib/amd64/libgcc_s.so.1
/opt/custom/nsca/

cp opt/local/lib/libmcrypt.so.4
/opt/custom/nsca/


Create a configuration file

vi /opt/custom/nsca/send_nsca.cfg


Now set the LD_LIBRARY_PATH variable and run the command

export LD_LIBRARY_PATH=/opt/custom/nsca; echo "host;passive_check;0;All seems to be OK" | /opt/custom/nsca/send_nsca -H nagios.ip -p 5667 -d ";" -c /opt/custom/nsca/send_nsca.cfg

nsca and send_nsca version incompatibility

I have a Nagios NSCA server running on Debian squeeze. The installed nsca package is the 2.7.2

I want to send passive nagios checks from a SmartOS zone. But the pkgsrc version of nsca client package is 2.9.1

There are incompatibility issues between the 2.7 server 2.7 and a 2.9 client (example http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=670373).

Dropping packet with invalid CRC32 - possibly due to client using wrong password or crypto algorithm?

To resolve the problem without upgrading Debian to a newer release, you can use backports.
Following the instructions I've added a new source to apt

vi /etc/apt/sources.list.d/backports.list

deb http://mi.mirror.garr.it/mirrors/debian-backports squeeze-backports main

apt-get update

And I've installed the newer version of NSCA server.

apt-get -t squeeze-backports install nsca

Now the latest version of send_nsca available on SmartOS works.

Quick testing shows that the 2.7.2 clients seems to work with the 2.9.1 server.

nagios plugin to compare (master/slave) SOA records

This is a Nagios script to compare the master ns and the slave ns SOA records.
So you can know if the slave zone is expired, or is not in sync with the master.

http://exchange.nagios.org/directory/Plugins/Network-Protocols/DNS/checkexpire/details

https://github.com/alcir/checkexpire.sh


Tuesday, August 6, 2013

mass destroy zfs snapshots

Please pay attention...

zfs list -t snapshot|awk '{print $1}' > /tmp/zfstodestroy

Edit the file to delete the snapshots you don't want to delete!
Then:

while read uuid; do zfs destroy $uuid; done < <(cat /tmp/zfstodestroy)

Friday, August 2, 2013

ENOSPC, open '/zones...metadata.json'

SmartOS.

Issuing this command

vmadm update f7c4fbb0-aa35-41d4-9d21-614caba785c7 max_physical_memory=2048

I got an error like

ENOSPC, open '/zones/f7c4fbb0-aa35-41d4-9d21-614caba785c7/config/metadata.json'


I try to enter in the zone

zlogin f7c4fbb0-aa35-41d4-9d21-614caba785c7

but I got

[Connected to zone 'f7c4fbb0-aa35-41d4-9d21-614caba785c7' pts/12]
No utmpx entry. You must exec "login" from the lowest level "shell".

[Connection to zone 'f7c4fbb0-aa35-41d4-9d21-614caba785c7' pts/12 closed]



WTF?

The zone reached the zfs disk quota. Disk full.

But also
vmadm update f7c4fbb0-aa35-41d4-9d21-614caba785c7 quota=50
returns
ENOSPC, open '/zones/f7c4fbb0-aa35-41d4-9d21-614caba785c7/config/metadata.json'


So the solution is simple:

zfs set quota=40G zones/f7c4fbb0-aa35-41d4-9d21-614caba785c7

vmadm update f7c4fbb0-aa35-41d4-9d21-614caba785c7 max_physical_memory=2048
Successfully updated VM f7c4fbb0-aa35-41d4-9d21-614caba785c7


Thursday, August 1, 2013

X11 forwarding request failed on channel 0

I was testing X11 stuff under a SmartOS zone, using the latest pkgsrc-2013Q2, but I got the following error doing an ssh

ssh dest.server -l root -X

X11 forwarding request failed on channel 0


The solution, as suggested by jperkin, is to add this line

XAuthLocation /opt/local/bin/xauth

to

/etc/ssh/sshd_config

and restart ssh.

Or you can disable Sun_SSH_1.5 service and install openssh.

two new java tools for dicom files

Remember: I'm not a programmer and I'm not a dicom expert.

I've "released" two java "tools" for dicom files.

dcmfileget

https://github.com/alcir/dcmfileget

This tool (as the dcm2txt tool from dcm4che) read a file and print some dicom attributes: patient name, study date, patientid, studyid, studyiuid.

Or if a directory is passed (instead of a single file) it scan each file and print such attributes.

dicomfileCopy

https://github.com/alcir/dicomfileCopy

This tool scan a directory and copy each file to the destination directory creating a path like /destination/study_year/study_month/study_day/patientname_studyi

xclock and rdesktop using a smartos zone

Just for fun