Archive

Archive for the ‘solaris’ Category

NRPE and Solaris SMF

September 7, 2011 Leave a comment

NRPE running under Solaris SMF control.

The SMF manifest:

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
  <service name='application/monitoring/nrpe' type='service' version='0'>
    <single_instance/>
    <dependency name='fs-local' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/system/filesystem/local'/>
    </dependency>
    <dependency name='network-service' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/network/service'/>
    </dependency>
    <dependency name='name-service' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/milestone/name-services'/>
    </dependency>
    <instance name='default' enabled='true'>
      <dependency name='config-file' grouping='require_all' restart_on='refresh' type='path'>
        <service_fmri value='file://localhost/usr/local/etc/nrpe/nrpe.cfg'/>
      </dependency>
      <exec_method name='start' type='method' exec='/local/lib/svc/method/nrpectl start' timeout_seconds='30'>
        <method_context working_directory='/var/tmp'>
          <method_credential user='nrpe' group='nrpe' privileges='basic,sys_resource,!proc_info,!file_link_any' limit_privileges='basic,sys_resource,!proc_info,!file_link_any'/>
        </method_context>
      </exec_method>
      <exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'/>
      <exec_method name='refresh' type='method' exec='/local/lib/svc/method/nrpectl refresh' timeout_seconds='60'/>
      <property_group name='nrpectl' type='application'>
        <propval name='NRPE_CFG' type='astring' value='/usr/local/etc/nrpe/nrpe.cfg'/>
        <propval name='NRPE_FQB' type='astring' value='/usr/local/sbin/nrpe'/>
      </property_group>
    </instance>
    <template>
      <common_name>
        <loctext xml:lang='C'>NRPE</loctext>
      </common_name>
      <documentation>
        <doc_link name='nagios.org' uri='http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf'/>
      </documentation>
    </template>
  </service>
</service_bundle>

The associated method:

#!/bin/sh

. /lib/svc/share/smf_include.sh

NRPE_FQB=`svcprop -p nrpectl/NRPE_FQB $SMF_FMRI`
NRPE_BIN=`basename $NRPE_FQB`
NRPE_CFG=`svcprop -p nrpectl/NRPE_CFG $SMF_FMRI`

pid=`pgrep -x -d " " $NRPE_BIN`

case $1 in
   'start')   if [ -z "$pid" ]; then
                 smf_clear_env
                 $NRPE_FQB -c $NRPE_CFG -d >&2
                 if pgrep -x -d " " $NRPE_BIN >/dev/null 2>&1; then
                    :
                 else
                    echo "NRPE failed to start" >&2
                    exit $SMF_EXIT_ERR_FATAL
                 fi
              else
                 echo "NRPE already running (pid=$pid)" >&2
                 exit $SMF_EXIT_ERR_OTHER
              fi
              ;;
   'refresh') if [ -z "$pid" ]; then
                 echo "NRPE not running; nothing to refresh" >&2
                 exit $SMF_EXIT_ERR_OTHER
              else
                 pkill -x $NRPE_BIN
              fi
              ;;
esac
exit $SMF_EXIT_OK

Season to taste.

Categories: solaris, sysadmin Tags: , , ,

OpenSolaris 2009.06 on a MBP

June 25, 2009 Leave a comment

I don’t really have the time to try this out, especially with all the gotchas, but it is nevertheless interesting. I may give it a try once some version of OpenSolaris goes into 2010. For now, I’ll keep watching out for Karim’s experience and see how it pans out. No, not giving up on Mac OS X; just curious about the possibilities.

Categories: solaris Tags: , , ,

OpenSolaris 2009.06: ready, set, go!

June 18, 2009 Leave a comment

Today I picked up a cheap Compaq Presario (yep, C-o-m-p-a-q) with an Athlon X2, 4GB of RAM and a 320GB SATA drive for under $300. I have some VMs and other cruft to run and I rather not do it on the Mac Pro anymore. This will do fine, especially as a playground of sorts. I wanted to put OpenSolaris 2009.06 on it, which took less than 20 minutes, including the creation of a ZFS root mirror. Another 10 minutes to flip into a Dom0 and I’m ready to go.

Very sweet indeed.

Categories: os, solaris, sysadmin Tags: , , ,

OpenSolaris 2009.06

OpenSolaris 2009.06 is out. Get the bits. They’re yummy.

Categories: solaris Tags:

OpenSolarisDay

Los próximos 26 y 27 de junio se cebrará OpenSolarisDay en la Universidad Complutense de Madrid (Facultad de Matemáticas) y allí estaré. En marzo me acerqué hasta Granada para asistir a uno de los viernes técnicos que la comunidad ha ofrecido, éste de la mano de David Galán y Toni de la Fuente, y la verdad es que estoy encantado de ver que hay una activa y creciente comunidad de OpenSolaris en España.

Llevo un tiempo pendiente de participar más en la comuninidad y este encuentro me da la excusa perfecta para empezar de una vez (con el permiso y la venia en el trabajo). Aún no he decidido del todo qué hacer, pero estoy pensando en proponer un charla o ponencia para hablar un poco de arquitectura operacional para servicios a gran escala (es decir, servicios cuya infrastructura consiste en cientos o miles de nodos sin ser un cluster computacional de investigación).

Categories: solaris Tags: , , ,
Follow

Get every new post delivered to your Inbox.