From a4ca5541cffb606de801372b544a10063e0edf6b Mon Sep 17 00:00:00 2001 From: Gardouille Date: Mon, 16 Feb 2015 14:09:12 +0100 Subject: [PATCH] xymon::client::config : manage the main config file: /etc/xymon/xymonclient.cfg --- manifests/client.pp | 2 + manifests/client/config.pp | 7 +++ manifests/params.pp | 5 ++- templates/client/xymonclient.cfg.erb | 65 ++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 templates/client/xymonclient.cfg.erb diff --git a/manifests/client.pp b/manifests/client.pp index 45f2972..bc03dff 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -35,6 +35,8 @@ class xymon::client ( $service_default_tpl = $xymon::params::cli_service_default_tpl, $service_path = $xymon::params::cli_service_path, $service_tpl = $xymon::params::cli_service_tpl, + $main_cfg_path = $xymon::params::cli_main_cfg_path, + $main_cfg_tpl = $xymon::params::cli_main_cfg_tpl, $list_server = $xymon::params::list_server, ) inherits xymon::params { diff --git a/manifests/client/config.pp b/manifests/client/config.pp index 40ad6a2..b0bdb31 100644 --- a/manifests/client/config.pp +++ b/manifests/client/config.pp @@ -24,5 +24,12 @@ class xymon::client::config { notify => Service[$xymon::client::service_name], } + # Client Configuration + file { "${xymon::client::main_cfg_path}": + ensure => present, + content => template($xymon::client::main_cfg_tpl), + notify => Service[$xymon::client::service_name], + } + } # Private class: xymon::client::config diff --git a/manifests/params.pp b/manifests/params.pp index 511e771..3646788 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -12,7 +12,6 @@ class xymon::params { $cli_package_name = undef $cli_pkg_ensure = 'present' $cli_pkg_provider = 'dpkg' - # Service $cli_service_enabled = true $cli_service_managed = true @@ -21,7 +20,9 @@ class xymon::params { $cli_service_default_tpl = 'xymon/client/default.service.erb' $cli_service_path = '/etc/init.d/xymon-client' $cli_service_tpl = 'xymon/client/xymon-client.deb_service.erb' - + # Configuration + $cli_main_cfg_path = '/etc/xymon/xymonclient.cfg' + $cli_main_cfg_tpl = 'xymon/client/xymonclient.cfg.erb' $list_server = [ '127.0.0.1' ] } diff --git a/templates/client/xymonclient.cfg.erb b/templates/client/xymonclient.cfg.erb new file mode 100644 index 0000000..30be6f2 --- /dev/null +++ b/templates/client/xymonclient.cfg.erb @@ -0,0 +1,65 @@ +# Environment settings for the Xymon client. + +XYMSRV="0.0.0.0" # IP address of the Xymon server +XYMSERVERS="<% @list_server.each do |val| -%><%= val -%> <% end -%>" # IP of multiple Xymon servers. XYMSRV must be "0.0.0.0". +CONFIGCLASS="$SERVEROSTYPE" # Default configuration class for logfiles + +PATH="/bin:/usr/bin:/sbin:/usr/sbin:/etc" # PATH setting for the client scripts. +SHELL="/bin/sh" # Shell to use when forking programs + +# You normally dont need to modify anything below here +XYMONDPORT="1984" # Portnumber where xymond listens +XYMONHOME="$XYMONCLIENTHOME" # Directory for the Xymon client files +XYMON="$XYMONHOME/bin/xymon" # The Xymon client "xymon" utility +XYMONTMP="$XYMONHOME/tmp" # Where we may store temporary files. +XYMONCLIENTLOGS="$XYMONHOME/logs" # Where we store the client logfiles + +# Compatibility settings +HOBBITCLIENTHOME="$XYMONCLIENTHOME" + +BBDISP="$XYMSRV" +BBDISPLAYS="$XYMSERVERS" + +BBPORT="$XYMONDPORT" +BBHOME="$XYMONHOME" +BB="$XYMON" +BBTMP="$XYMONTMP" +BBCLIENTLOGS="$XYMONCLIENTLOGS" + + +# The following defines a bunch of commands that BB extensions expect to be present. +# Xymon does not use them, but they are provided here so if you use BB extension +# scripts, then they will hopefully run without having to do a lot of tweaking. + +UPTIME="/usr/bin/uptime" +AWK="/usr/bin/awk" +CAT="/bin/cat" +CP="/bin/cp" +CUT="/usr/bin/cut" +DATE="/bin/date" +EGREP="/bin/egrep" +EXPR="/usr/bin/expr" +FIND="/usr/bin/find" +GREP="/bin/grep" +HEAD="/usr/bin/head" +ID="/usr/bin/id" +LN="/bin/ln" +LS="/bin/ls" +MV="/bin/mv" +RM="/bin/rm" +SED="/bin/sed" +SORT="/usr/bin/sort" +TAIL="/usr/bin/tail" +TOP="/usr/bin/top" +TOUCH="/usr/bin/touch" +TR="/usr/bin/tr" +UNIQ="/usr/bin/uniq" +WHO="/usr/bin/who" +WC="/usr/bin/wc -l" +WCC="/usr/bin/wc" +# DF,DFCMD and PS are for compatibility only, NOT USED by the Xymon client +DF="/bin/df -Pk" +DFCMD="/bin/df -Pk" +PS="ps ax" + +MAXLINE="32768"