From 7d235fb013021d771c75479450e2e2dcda1426a3 Mon Sep 17 00:00:00 2001 From: Thomas Eckert Date: Tue, 8 Oct 2019 18:19:20 +0200 Subject: [PATCH] add new type `__xymon_server` This type installs a Xymon monitoring-server. See https://xymon.com/ for a demo and further information. --- cdist/conf/type/__xymon_server/gencode-remote | 25 ++++++ cdist/conf/type/__xymon_server/man.rst | 87 +++++++++++++++++++ cdist/conf/type/__xymon_server/manifest | 50 +++++++++++ .../type/__xymon_server/parameter/boolean | 1 + .../__xymon_server/parameter/default/state | 1 + .../type/__xymon_server/parameter/optional | 1 + cdist/conf/type/__xymon_server/singleton | 0 7 files changed, 165 insertions(+) create mode 100755 cdist/conf/type/__xymon_server/gencode-remote create mode 100644 cdist/conf/type/__xymon_server/man.rst create mode 100755 cdist/conf/type/__xymon_server/manifest create mode 100644 cdist/conf/type/__xymon_server/parameter/boolean create mode 100644 cdist/conf/type/__xymon_server/parameter/default/state create mode 100644 cdist/conf/type/__xymon_server/parameter/optional create mode 100644 cdist/conf/type/__xymon_server/singleton diff --git a/cdist/conf/type/__xymon_server/gencode-remote b/cdist/conf/type/__xymon_server/gencode-remote new file mode 100755 index 00000000..55451c42 --- /dev/null +++ b/cdist/conf/type/__xymon_server/gencode-remote @@ -0,0 +1,25 @@ +#!/bin/sh -e +# +# 2018-2019 Thomas Eckert (tom at it-eckert.de) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . + +## "move" user-modified dirs to /etc/xymon to be managed by __xymon_config: +if [ ! -L /usr/lib/xymon/server/ext ]; then + echo "mv /usr/lib/xymon/server/ext /etc/xymon" + echo "ln -s /etc/xymon/ext /usr/lib/xymon/server/" + echo "ext-dir moved and symlinked" >> "$__messages_out" +fi diff --git a/cdist/conf/type/__xymon_server/man.rst b/cdist/conf/type/__xymon_server/man.rst new file mode 100644 index 00000000..a9a180e1 --- /dev/null +++ b/cdist/conf/type/__xymon_server/man.rst @@ -0,0 +1,87 @@ +cdist-type__xymon_server(7) +=========================== + +NAME +---- +cdist-type__xymon_server - Install a Xymon server + + +DESCRIPTION +----------- +This cdist type installs a Xymon (https://www.xymon.com/) server and (optional) +required helper packages. + +This includes the Xymon client as a dependency, so NO NEED to install +`__xymon_client` separately. + +To access the webinterface a webserver is required. The cdist-type +`__xymon_apache` can be used to install and configure the apache webserver for +the use with Xymon. + +Further and day-to-day configuration of Xymon can either be done manually in +`/etc/xymon/` or the directory can be deployed and managed by `__xymon_config`. + + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +state + 'present', 'absent', defaults to 'present'. If '--install_helpers' is + specified for 'absent' the helper packages will be un-installed. + + +BOOLEAN PARAMETERS +------------------ +install_helpers + Install helper packages used by Xymon (fping, heirloom-mailx, traceroute, + ntpdate). + + +EXAMPLES +-------- + +.. code-block:: sh + + # minmal + __xymon_server + + # the same + __xymon_server --state present + + # also install helper packages: + __xymon_server --install_helpers + + # examples to give a more complete picture: __xymon_server installed on + # `xymon.example.com` w/ IP 192.168.1.1: + # + # install webserver and grant 2 private subnets access to the webinterface: + __xymon_apache --ipacl "192.168.0.0/16 10.0.0.0/8" + # deploy server-configuration with __xymon_config: + __xymon_config --confdir=xymon.example.com + + # install xymon-client on other machines (not needed on the server): + __xymon_client --servers "192.168.1.1" + + + +SEE ALSO +-------- +:strong:`cdist__xymon_apache`\ (7), :strong:`cdist__xymon_config`\ (7), +:strong:`cdist__xymon_client`\ (7), :strong:`xymon`\ (7) + + +AUTHORS +------- +Thomas Eckert + + +COPYING +------- +Copyright \(C) 2018-2019 Thomas Eckert. You can redistribute it +and/or modify it under the terms of the GNU General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. diff --git a/cdist/conf/type/__xymon_server/manifest b/cdist/conf/type/__xymon_server/manifest new file mode 100755 index 00000000..7cee0d23 --- /dev/null +++ b/cdist/conf/type/__xymon_server/manifest @@ -0,0 +1,50 @@ +#!/bin/sh -e +# +# 2018-2019 Thomas Eckert (tom at it-eckert.de) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . + +state=$(cat "$__object/parameter/state") +if [ -f "$__object/parameter/install_helpers" ]; then + install_helpers=1 +else + install_helpers=0 +fi + +os=$(cat "$__global/explorer/os") +case "$os" in + debian|ubuntu) + : + ;; + *) + echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 + echo "Please contribute an implementation for it if you can." >&2 + exit 1 + ;; +esac + +__package xymon --state "$state" + +## install helper-packages/tools used by the xymon server if requested: +if [ "$install_helpers" = "1" ]; then + __package fping --state "$state" + __package heirloom-mailx --state "$state" + __package traceroute --state "$state" + __package ntpdate --state "$state" +fi + +## CLI-usage often requires a shell: +require="__package/xymon" __user xymon --shell "/bin/bash" --state "$state" diff --git a/cdist/conf/type/__xymon_server/parameter/boolean b/cdist/conf/type/__xymon_server/parameter/boolean new file mode 100644 index 00000000..56ebcb2c --- /dev/null +++ b/cdist/conf/type/__xymon_server/parameter/boolean @@ -0,0 +1 @@ +install_helpers diff --git a/cdist/conf/type/__xymon_server/parameter/default/state b/cdist/conf/type/__xymon_server/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__xymon_server/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__xymon_server/parameter/optional b/cdist/conf/type/__xymon_server/parameter/optional new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/cdist/conf/type/__xymon_server/parameter/optional @@ -0,0 +1 @@ +state diff --git a/cdist/conf/type/__xymon_server/singleton b/cdist/conf/type/__xymon_server/singleton new file mode 100644 index 00000000..e69de29b