Cfengine Configuration - Distributing Nagios plugins

Tobias Mucke tobias.mucke at list.ru
Sat Sep 8 21:31:39 CEST 2007


Hi list,

sorry for the delay but I am in vacation in Greece right now. Here is how I distribute the Nagios plugins RPM with Cfengine. I am building my own RPM package, but this works with any RPM you have to deploy.

There are some global variables used in this extract from my Cfengine configuration, which are not set in this snippet. They are not important for the understanding of the code, e.g. my ARCH variables are set like this in cf.linux.

#
# Cfengine configuration cf.linux
#
control:

   linux::

       DEFAULT_ARCH = ( i586 )

   linux&i686::

       SYSTEM_ARCH = ( i586 )

   linux&x86_64::

       SYSTEM_ARCH = ( x86_64 )

#
# End of file
#

Here is the cf.nagios for Nagios related stuff. I shortened it to make it more comprehensive.

#
# Cfengine configuration cf.nagios
#
groups:

   linux::

      nagios_plugins_installed = ( '/bin/rpm -q nagios-plugins' )

control:

   linux::

      NAGIOS_PLUGINS_VERSION = ( 1.4.9-41 )

      #
      # Set RPM filename
      # ARCH is set in a global configuration file depending on 
      # system architecture
      # 
      NAGIOS_PLUGINS_RPM = ( $(DEFAULT_ARCH)/nagios-plugins-$(NAGIOS_PLUGINS_VERSION).$(DEFAULT_ARCH).rpm )

packages:

   linux::

      nagios-plugins   version=$(NAGIOS_PLUGINS_VERSION)
                       cmp=lt
                       define=nagios_plugins_outdated
                       elsedefine=nagios_plugins_uptodate

copy:

   linux&(!nagios_plugins_installed|nagios_plugins_outdated)::

      #
      # RPMBASE is globally set to my RPM build directory
      # RPMTMP is globally set to somewhere beyond /tmp
      #
      $(RPMBASE)/$(NAGIOS_PLUGINS_RPM)
         dest=$(RPMTMP)/$(NAGIOS_PLUGINS_RPM)
         mode=444
         owner=root
         group=root
         backup=false
         timestamps=preserve
         type=any
         server=$(CFSERVER)
         trustkey=true

shellcommands:

   linux&(!nagios_plugins_installed|nagios_plugins_outdated)::

      #
      # Here the package is actually installed or updated
      #
      "$(RPMBIN) -U $(RPMTMP)/$(NAGIOS_PLUGINS_RPM)"
         umask=0022

#
# End of file
#

Any comments appreciated.

Tobias


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/




More information about the Developers mailing list