Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing deprecated fields on apilistener resource and old notify scripts #325

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

8la
Copy link

@8la 8la commented Aug 6, 2018

Have removed some fields deprecated on the apilistener resource. Adapted LWRP.md documentation to reflect those changes.

@vkhatri vkhatri self-assigned this Aug 14, 2018
@8la 8la changed the title Removing deprecated fields on apilistener resource Removing deprecated fields on apilistener resource and old notify scripts Sep 12, 2018
@8la 8la force-pushed the 8la/update_icinga2_apilistener_resource branch from 39987ba to 91d85f0 Compare September 12, 2018 09:13
@8la
Copy link
Author

8la commented Sep 12, 2018

I dont know why integration fails on Travis but suite chef13server-centos-6 pass OK on my local machine.

For the elapsed time, higher than the other suites it may be because of systemctl stuck starting the service.

@8la
Copy link
Author

8la commented Sep 12, 2018

alorenzo :: git/personal/chef-icinga2 ‹8la/update_icinga2_apilistener_resource› » KITCHEN_YAML=.kitchen.dokken.yml kitchen verify chef13server-centos-6
-----> Starting Kitchen (v1.16.0)
WARN: Unresolved specs during Gem::Specification.reset:
      rake (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
-----> Creating <chef13server-centos-6>...
       Creating kitchen sandbox at /home/alorenzo/.dokken/kitchen_sandbox/3dc6069d5f-chef13server-centos-6
       Creating verifier sandbox at /home/alorenzo/.dokken/verifier_sandbox/3dc6069d5f-chef13server-centos-6
       Building work image..
       Creating container 3dc6069d5f-chef13server-centos-6
       Finished creating <chef13server-centos-6> (0m22.90s).
-----> Converging <chef13server-centos-6>...
       Creating kitchen sandbox in /home/alorenzo/.dokken/kitchen_sandbox/3dc6069d5f-chef13server-centos-6
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 5.6.4...
       Removing non-cookbook files before transfer
       Preparing data_bags
       Preparing nodes
       Preparing validation.pem
       Preparing client.rb
Starting Chef Client, version 13.3.42
Creating a new client identity for chef13server-centos-6 using the validator key.
resolving cookbooks for run list: ["icinga2::default", "icinga2-test::default"]
Synchronizing Cookbooks:
  - icinga2-test (0.0.0)
  - icinga2 (4.0.0)
  - ulimit (1.0.0)
  - yum-epel (3.2.0)
  - chocolatey (2.0.1)
  - icinga2repo (1.0.0)
  - yum (5.1.0)
  - apt (7.0.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 42 resources
Recipe: icinga2repo::yum
  * yum_repository[icinga2-release] action create
    * template[/etc/yum.repos.d/icinga2-release.repo] action create
      - create new file /etc/yum.repos.d/icinga2-release.repo
      - update content in file /etc/yum.repos.d/icinga2-release.repo from none to 8448f9
      --- /etc/yum.repos.d/icinga2-release.repo 2018-09-12 12:18:10.465234479 +0000
      +++ /etc/yum.repos.d/.chef-icinga2-release20180912-22-ng38f6.repo 2018-09-12 12:18:10.465234479 +0000
      @@ -1 +1,12 @@
      +# This file was generated by Chef
      +# Do NOT modify this file by hand.
      +
      +[icinga2-release]
      +name=icinga2-release
      +baseurl=http://packages.icinga.com/epel/$releasever/release/
      +enabled=1
      +fastestmirror_enabled=0
      +gpgcheck=1
      +gpgkey=http://packages.icinga.com/icinga.key
      +metadata_expire=10h
      - change mode from '' to '0644'
    * execute[yum clean metadata icinga2-release] action run
      - execute yum clean metadata --disablerepo=* --enablerepo=icinga2-release
    * execute[yum-makecache-icinga2-release] action run
      - execute yum -q -y makecache --disablerepo=* --enablerepo=icinga2-release
    * ruby_block[yum-cache-reload-icinga2-release] action create
      - execute the ruby block yum-cache-reload-icinga2-release
    * execute[yum clean metadata icinga2-release] action nothing (skipped due to action :nothing)
    * execute[yum-makecache-icinga2-release] action nothing (skipped due to action :nothing)
    * ruby_block[yum-cache-reload-icinga2-release] action nothing (skipped due to action :nothing)
  
  * yum_repository[icinga2-snapshot] action create
    * template[/etc/yum.repos.d/icinga2-snapshot.repo] action create
      - create new file /etc/yum.repos.d/icinga2-snapshot.repo
      - update content in file /etc/yum.repos.d/icinga2-snapshot.repo from none to b8f00c
      --- /etc/yum.repos.d/icinga2-snapshot.repo        2018-09-12 12:18:11.941273399 +0000
      +++ /etc/yum.repos.d/.chef-icinga2-snapshot20180912-22-181bk6b.repo       2018-09-12 12:18:11.941273399 +0000
      @@ -1 +1,12 @@
      +# This file was generated by Chef
      +# Do NOT modify this file by hand.
      +
      +[icinga2-snapshot]
      +name=icinga2-snapshot
      +baseurl=http://packages.icinga.com/epel/$releasever/snapshot/
      +enabled=0
      +fastestmirror_enabled=0
      +gpgcheck=1
      +gpgkey=http://packages.icinga.com/icinga.key
      +metadata_expire=10h
      - change mode from '' to '0644'
    * execute[yum clean metadata icinga2-snapshot] action run
      - execute yum clean metadata --disablerepo=* --enablerepo=icinga2-snapshot
    * execute[yum-makecache-icinga2-snapshot] action run (skipped due to only_if)
    * ruby_block[yum-cache-reload-icinga2-snapshot] action create
      - execute the ruby block yum-cache-reload-icinga2-snapshot
    * execute[yum clean metadata icinga2-snapshot] action nothing (skipped due to action :nothing)
    * execute[yum-makecache-icinga2-snapshot] action nothing (skipped due to action :nothing)
    * ruby_block[yum-cache-reload-icinga2-snapshot] action nothing (skipped due to action :nothing)
  
Recipe: yum-epel::default
  * yum_repository[epel] action create
    * template[/etc/yum.repos.d/epel.repo] action create
      - create new file /etc/yum.repos.d/epel.repo
      - update content in file /etc/yum.repos.d/epel.repo from none to 6f0d2a
      --- /etc/yum.repos.d/epel.repo    2018-09-12 12:18:12.133278462 +0000
      +++ /etc/yum.repos.d/.chef-epel20180912-22-bh2fi0.repo    2018-09-12 12:18:12.133278462 +0000
      @@ -1 +1,12 @@
      +# This file was generated by Chef
      +# Do NOT modify this file by hand.
      +
      +[epel]
      +name=Extra Packages for 6 - $basearch
      +enabled=1
      +failovermethod=priority
      +fastestmirror_enabled=0
      +gpgcheck=1
      +gpgkey=https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6
      +mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch
      - change mode from '' to '0644'
    * execute[yum clean metadata epel] action run
      - execute yum clean metadata --disablerepo=* --enablerepo=epel
    * execute[yum-makecache-epel] action run
      - execute yum -q -y makecache --disablerepo=* --enablerepo=epel
    * ruby_block[yum-cache-reload-epel] action create
      - execute the ruby block yum-cache-reload-epel
    * execute[yum clean metadata epel] action nothing (skipped due to action :nothing)
    * execute[yum-makecache-epel] action nothing (skipped due to action :nothing)
    * ruby_block[yum-cache-reload-epel] action nothing (skipped due to action :nothing)
  
Recipe: icinga2::install
  * yum_package[gcc] action install
    - install version 4.4.7-23.el6 of package gcc
  * yum_package[gcc-c++] action install
    - install version 4.4.7-23.el6 of package gcc-c++
  * yum_package[glibc] action install (up to date)
  * yum_package[glibc-common] action install (up to date)
  * yum_package[mailx] action install
    - install version 12.4-8.el6_6 of package mailx
  * yum_package[icinga2-doc] action install
    - install version 2.9.1-1.el6.icinga of package icinga2-doc
  * yum_package[icinga2-common] action install
    - install version 2.9.1-1.el6.icinga of package icinga2-common
  * yum_package[icinga2-bin] action install
    - install version 2.9.1-1.el6.icinga of package icinga2-bin
  * yum_package[nagios-plugins-all] action install
    - install version 2.2.1-4git.el6 of package nagios-plugins-all
  * yum_package[icinga2] action install
    - install version 2.9.1-1.el6.icinga of package icinga2
Recipe: icinga2::config
  * directory[/etc/icinga2] action create
    - change owner from 'root' to 'icinga'
  * directory[/etc/icinga2/repository.d] action create
    - create new directory /etc/icinga2/repository.d
    - change mode from '' to '0750'
    - change owner from '' to 'icinga'
    - change group from '' to 'icinga'
  * directory[/etc/icinga2/conf.d] action create (up to date)
  * directory[/etc/icinga2/pki] action create
    - create new directory /etc/icinga2/pki
    - change mode from '' to '0750'
    - change owner from '' to 'icinga'
    - change group from '' to 'icinga'
  * directory[/etc/icinga2/scripts] action create (up to date)
  * directory[/etc/icinga2/zones.d] action create (up to date)
  * directory[/etc/icinga2/objects.d] action create
    - create new directory /etc/icinga2/objects.d
    - change mode from '' to '0750'
    - change owner from '' to 'icinga'
    - change group from '' to 'icinga'
  * directory[/etc/icinga2/features-enabled] action create (up to date)
  * directory[/etc/icinga2/features-available] action create (up to date)
  * directory[/opt/icinga2_custom_plugins] action create
    - create new directory /opt/icinga2_custom_plugins
    - change mode from '' to '0750'
    - change owner from '' to 'icinga'
    - change group from '' to 'icinga'
  * directory[/etc/icinga2/user_defined_objects] action create
    - create new directory /etc/icinga2/user_defined_objects
    - change mode from '' to '0750'
    - change owner from '' to 'icinga'
    - change group from '' to 'icinga'
  * directory[/var/log/icinga2] action create (up to date)
  * directory[/var/run/icinga2] action create
    - create new directory /var/run/icinga2
    - change mode from '' to '0750'
    - change owner from '' to 'icinga'
    - change group from '' to 'icingacmd'
  * directory[/var/log/icinga2/compat] action create (up to date)
  * directory[/var/log/icinga2/compat/archives] action create (up to date)
  * directory[/var/cache/icinga2] action create
    - change group from 'icingacmd' to 'icinga'
  * template[/etc/logrotate.d/icinga2] action create
    - update content in file /etc/logrotate.d/icinga2 from 1fe10e to 634133
    --- /etc/logrotate.d/icinga2        2018-07-24 11:32:04.000000000 +0000
    +++ /etc/logrotate.d/.chef-icinga220180912-22-x446q6        2018-09-12 12:21:03.649807924 +0000
    @@ -1,25 +1,35 @@
    +#
    +# This file is managed by Chef.
    +# Do NOT modify this file directly.
    +#
    +
     /var/log/icinga2/icinga2.log /var/log/icinga2/debug.log {
        daily
        rotate 7
    +   su icinga icinga
        compress
        delaycompress
        missingok
        notifempty
        create 644 icinga icinga
    +   copytruncate
        postrotate
    -           /bin/kill -USR1 $(cat /var/run/icinga2/icinga2.pid 2> /dev/null) 2> /dev/null || true
    +           if ! killall -q -USR1 icinga2; then
    +                   exit 1
    +           fi
        endscript
     }
     
     /var/log/icinga2/error.log {
        daily
    +   su icinga icinga
        rotate 90
        compress
        delaycompress
        missingok
        notifempty
        create 644 icinga icinga
    +   copytruncate
        # TODO: figure out how to get Icinga to re-open this log file
     }
    -
  * template[/etc/icinga2/icinga2.conf] action create
    - update content in file /etc/icinga2/icinga2.conf from b09cba to 90196f
    --- /etc/icinga2/icinga2.conf       2018-07-24 11:32:04.000000000 +0000
    +++ /etc/icinga2/.chef-icinga220180912-22-oghz43.conf       2018-09-12 12:21:03.657808135 +0000
    @@ -1,4 +1,10 @@
     /**
    +# This file is managed by Chef.
    +# Do NOT modify this file directly.
    +#
    +*/
    +
    +/**
      * Icinga 2 configuration file
      * - this is where you define settings for the Icinga application including
      * which hosts/services to check.
    @@ -16,7 +22,9 @@
      * The zones.conf defines zones for a cluster setup.
      * Not required for single instance setups.
      */
    -include "zones.conf"
    +// disabled in favor of LWRP resources. use endpoint and
    +// zone LWRP to create objects instead.
    +// include "zones.conf"
     
     /**
      * The Icinga Template Library (ITL) provides a number of useful templates
    @@ -25,22 +33,8 @@
      */
     include <itl>
     include <plugins>
    -include <plugins-contrib>
    -include <manubulon>
     
     /**
    - * This includes the Icinga 2 Windows plugins. These command definitions
    - * are required on a master node when a client is used as command endpoint.
    - */
    -include <windows-plugins>
    -
    -/**
    - * This includes the NSClient++ check commands. These command definitions
    - * are required on a master node when a client is used as command endpoint.
    - */
    -include <nscp>
    -
    -/**
      * The features-available directory contains a number of configuration
      * files for features which can be enabled and disabled using the
      * icinga2 feature enable / icinga2 feature disable CLI commands.
    @@ -50,9 +44,21 @@
     include "features-enabled/*.conf"
     
     /**
    + * The repository.d directory contains all configuration objects
    + * managed by the 'icinga2 repository' CLI commands.
    + */
    +include_recursive "repository.d"
    +
    +/**
      * Although in theory you could define all your objects in this file
      * the preferred way is to create separate directories and files in the conf.d
      * directory. Each of these files must have the file extension ".conf".
      */
     include_recursive "conf.d"
    +
    +// All Objects definitions conf files are stored under "objects.d/"
    +include_recursive "objects.d"
    +
    +// User defined Objects / Configuration
    +include_recursive "user_defined_objects"
  * template[/etc/sysconfig/icinga2] action create
    - update content in file /etc/sysconfig/icinga2 from eae981 to da54c3
    --- /etc/sysconfig/icinga2  2018-07-24 11:19:35.000000000 +0000
    +++ /etc/sysconfig/.chef-icinga220180912-22-1t2ym62 2018-09-12 12:21:03.673808559 +0000
    @@ -1,17 +1,17 @@
    -#This is the default environment Icinga 2 runs with.
    -#Make your changes here.
    -
    -#DAEMON=/usr/sbin/icinga2
    -#ICINGA2_CONFIG_FILE=/etc/icinga2/icinga2.conf
    -#ICINGA2_RUN_DIR=/var/run
    -#ICINGA2_STATE_DIR=/var
    -#ICINGA2_PID_FILE=/var/run/icinga2/icinga2.pid
    -#ICINGA2_LOG_DIR=/var/log/icinga2
    -#ICINGA2_ERROR_LOG=/var/log/icinga2/error.log
    -#ICINGA2_STARTUP_LOG=/var/log/icinga2/startup.log
    -#ICINGA2_LOG=/var/log/icinga2/icinga2.log
    -#ICINGA2_CACHE_DIR=/var/cache/icinga2
    -#ICINGA2_USER=icinga
    -#ICINGA2_GROUP=icinga
    -#ICINGA2_COMMAND_GROUP=icingacmd
    +#
    +# This file is managed by Chef.
    +# Do NOT modify this file directly.
    +#
    +DAEMON=/usr/sbin/icinga2
    +ICINGA2_CONFIG_FILE=/etc/icinga2/icinga2.conf
    +ICINGA2_RUN_DIR=/var/run/icinga2
    +ICINGA2_STATE_DIR=/var
    +ICINGA2_PID_FILE=/var/run/icinga2/icinga2.pid
    +ICINGA2_ERROR_LOG=/var/log/icinga2/error.log
    +ICINGA2_STARTUP_LOG=/var/log/icinga2/startup.log
    +ICINGA2_LOG=/var/log/icinga2/icinga2.log
    +ICINGA2_USER=icinga
    +ICINGA2_GROUP=icinga
    +ICINGA2_COMMAND_GROUP=icingacmd
    +ICINGA2_CACHE_DIR=$ICINGA2_STATE_DIR/cache/icinga2
    - change mode from '0644' to '0640'
  * template[/etc/icinga2/init.conf] action create
    - create new file /etc/icinga2/init.conf
    - update content in file /etc/icinga2/init.conf from none to 2cb6f8
    --- /etc/icinga2/init.conf  2018-09-12 12:21:03.677808664 +0000
    +++ /etc/icinga2/.chef-init20180912-22-1qapog7.conf 2018-09-12 12:21:03.677808664 +0000
    @@ -1 +1,13 @@
    +/**
    +# This file is managed by Chef.
    +# Do NOT modify this file directly.
    +*/
    +
    +/**
    + * This file is read by Icinga 2 before the main
    + * configuration file (icinga2.conf) is processed.
    + */
    +
    +const RunAsUser = "icinga"
    +const RunAsGroup = "icinga"
    - change mode from '' to '0640'
    - change owner from '' to 'icinga'
    - change group from '' to 'icinga'
  * template[/etc/icinga2/constants.conf] action create
    - update content in file /etc/icinga2/constants.conf from 53e05d to 64c1f8
    --- /etc/icinga2/constants.conf     2018-07-24 11:32:04.000000000 +0000
    +++ /etc/icinga2/.chef-constants20180912-22-1yqv88s.conf    2018-09-12 12:21:03.689808983 +0000
    @@ -1,29 +1,16 @@
     /**
    +# This file is managed by Chef.
    +# Do NOT modify this file directly.
    +*/
    +
    +/**
      * This file defines global constants which can be used in
      * the other configuration files.
      */
     
    -/* The directory which contains the plugins from the Monitoring Plugins project. */
    +const NodeName = "dokken"
     const PluginDir = "/usr/lib64/nagios/plugins"
    -
    -/* The directory which contains the Manubulon plugins.
    - * Check the documentation, chapter "SNMP Manubulon Plugin Check Commands", for details.
    - */
     const ManubulonPluginDir = "/usr/lib64/nagios/plugins"
    +const TicketSalt = "ed25aed394c4bf7d236b347bb67df466"
     
    -/* The directory which you use to store additional plugins which ITL provides user contributed command definitions for.
    - * Check the documentation, chapter "Plugins Contribution", for details.
    - */
    -const PluginContribDir = "/usr/lib64/nagios/plugins"
    -
    -/* Our local instance name. By default this is the server's hostname as returned by `hostname --fqdn`.
    - * This should be the common name from the API certificate.
    - */
    -//const NodeName = "localhost"
    -
    -/* Our local zone name. */
    -const ZoneName = NodeName
    -
    -/* Secret key for remote node tickets */
    -const TicketSalt = ""
  * template[/etc/icinga2/scripts/mail-service-notification.sh] action create
    - update content in file /etc/icinga2/scripts/mail-service-notification.sh from 9ba2e4 to ea9234
    --- /etc/icinga2/scripts/mail-service-notification.sh       2018-07-24 11:32:04.000000000 +0000
    +++ /etc/icinga2/scripts/.chef-mail-service-notification20180912-22-m4bcwi.sh       2018-09-12 12:21:03.701809299 +0000
    @@ -3,6 +3,10 @@
     # Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/)
     # Except of function urlencode which is Copyright (C) by Brian White ([email protected]) used under MIT license
     
    +# This file is managed by Chef.
    +# Do NOT modify this file directly.
    +#
    +
     PROG="`basename $0`"
     ICINGA2HOST="`hostname`"
     MAILBIN="mail"
    - change owner from 'root' to 'icinga'
    - change group from 'root' to 'icinga'
  * template[/etc/icinga2/scripts/mail-host-notification.sh] action create
    - update content in file /etc/icinga2/scripts/mail-host-notification.sh from 40c1b1 to 9f897c
    --- /etc/icinga2/scripts/mail-host-notification.sh  2018-07-24 11:32:04.000000000 +0000
    +++ /etc/icinga2/scripts/.chef-mail-host-notification20180912-22-11qhr0n.sh 2018-09-12 12:21:03.709809510 +0000
    @@ -1,8 +1,11 @@
     #!/usr/bin/env bash
     #
     # Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/)
    -# Except of function urlencode which is Copyright (C) by Brian White ([email protected]) used under MIT license 
    +# Except of function urlencode which is Copyright (C) by Brian White ([email protected]) used under MIT license
     
    +# This file is managed by Chef.
    +# Do NOT modify this file directly.
    +
     PROG="`basename $0`"
     ICINGA2HOST="`hostname`"
     MAILBIN="mail"
    @@ -18,12 +21,14 @@
     
     Required parameters:
       -d LONGDATETIME (\$icinga.long_date_time\$)
    +  -e SERVICENAME (\$service.name\$)
       -l HOSTNAME (\$host.name\$)
       -n HOSTDISPLAYNAME (\$host.display_name\$)
    -  -o HOSTOUTPUT (\$host.output\$)
    +  -o SERVICEOUTPUT (\$service.output\$)
       -r USEREMAIL (\$user.email\$)
    -  -s HOSTSTATE (\$host.state\$)
    +  -s SERVICESTATE (\$service.state\$)
       -t NOTIFICATIONTYPE (\$notification.type\$)
    +  -u SERVICEDISPLAYNAME (\$service.display_name\$)
     
     Optional parameters:
       -4 HOSTADDRESS (\$address\$)
    @@ -61,7 +66,7 @@
     }
     
     ## Main
    -while getopts 4:6::b:c:d:f:hi:l:n:o:r:s:t:v: opt
    +while getopts 4:6:b:c:d:e:f:hi:l:n:o:r:s:t:u:v: opt
     do
       case "$opt" in
         4) HOSTADDRESS=$OPTARG ;;
    @@ -69,48 +74,51 @@
         b) NOTIFICATIONAUTHORNAME=$OPTARG ;;
         c) NOTIFICATIONCOMMENT=$OPTARG ;;
         d) LONGDATETIME=$OPTARG ;; # required
    +    e) SERVICENAME=$OPTARG ;; # required
         f) MAILFROM=$OPTARG ;;
    -    h) Help ;;
    +    h) Usage ;;
         i) ICINGAWEB2URL=$OPTARG ;;
         l) HOSTNAME=$OPTARG ;; # required
         n) HOSTDISPLAYNAME=$OPTARG ;; # required
    -    o) HOSTOUTPUT=$OPTARG ;; # required
    +    o) SERVICEOUTPUT=$OPTARG ;; # required
         r) USEREMAIL=$OPTARG ;; # required
    -    s) HOSTSTATE=$OPTARG ;; # required
    +    s) SERVICESTATE=$OPTARG ;; # required
         t) NOTIFICATIONTYPE=$OPTARG ;; # required
    +    u) SERVICEDISPLAYNAME=$OPTARG ;; # required
         v) VERBOSE=$OPTARG ;;
        \?) echo "ERROR: Invalid option -$OPTARG" >&2
    -       Error ;;
    +       Usage ;;
         :) echo "Missing option argument for -$OPTARG" >&2
    -       Error ;;
    +       Usage ;;
         *) echo "Unimplemented option: -$OPTARG" >&2
    -       Error ;;
    +       Usage ;;
       esac
     done
     
     shift $((OPTIND - 1))
     
    -## Keep formatting in sync with mail-service-notification.sh
    -for P in LONGDATETIME HOSTNAME HOSTDISPLAYNAME HOSTOUTPUT HOSTSTATE USEREMAIL NOTIFICATIONTYPE ; do
    -   eval "PAR=\$${P}"
    +## Keep formatting in sync with mail-host-notification.sh
    +for P in LONGDATETIME HOSTNAME HOSTDISPLAYNAME SERVICENAME SERVICEDISPLAYNAME SERVICEOUTPUT SERVICESTATE USEREMAIL NOTIFICATIONTYPE ; do
    +        eval "PAR=\$${P}"
     
    -   if [ ! "$PAR" ] ; then
    -           Error "Required parameter '$P' is missing."
    -   fi
    +        if [ ! "$PAR" ] ; then
    +                Error "Required parameter '$P' is missing."
    +        fi
     done
     
     ## Build the message's subject
    -SUBJECT="[$NOTIFICATIONTYPE] Host $HOSTDISPLAYNAME is $HOSTSTATE!"
    +SUBJECT="[$NOTIFICATIONTYPE] $SERVICEDISPLAYNAME on $HOSTDISPLAYNAME is $SERVICESTATE!"
     
     ## Build the notification message
     NOTIFICATION_MESSAGE=`cat << EOF
    -***** Host Monitoring on $ICINGA2HOST *****
    +***** Service Monitoring on $ICINGA2HOST *****
     
    -$HOSTDISPLAYNAME is $HOSTSTATE!
    +$SERVICEDISPLAYNAME on $HOSTDISPLAYNAME is $SERVICESTATE!
     
    -Info:    $HOSTOUTPUT
    +Info:    $SERVICEOUTPUT
     
     When:    $LONGDATETIME
    +Service: $SERVICENAME
     Host:    $HOSTNAME
     EOF
     `
    @@ -118,13 +126,13 @@
     ## Check whether IPv4 was specified.
     if [ -n "$HOSTADDRESS" ] ; then
       NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE
    -IPv4:       $HOSTADDRESS"
    +IPv4:    $HOSTADDRESS"
     fi
     
     ## Check whether IPv6 was specified.
     if [ -n "$HOSTADDRESS6" ] ; then
       NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE
    -IPv6:       $HOSTADDRESS6"
    +IPv6:    $HOSTADDRESS6"
     fi
     
     ## Check whether author and comment was specified.
    @@ -139,7 +147,7 @@
     if [ -n "$ICINGAWEB2URL" ] ; then
       NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE
     
    -$ICINGAWEB2URL/monitoring/host/show?host=$(urlencode "$HOSTNAME")"
    +$ICINGAWEB2URL/monitoring/service/show?host=$(urlencode "$HOSTNAME")&service=$(urlencode "$SERVICENAME")"
     fi
     
     ## Check whether verbose mode was enabled and log to syslog.
    - change owner from 'root' to 'icinga'
    - change group from 'root' to 'icinga'
  * user_ulimit[icinga] action create
    * template[/etc/security/limits.d/icinga_limits.conf] action create
      - create new file /etc/security/limits.d/icinga_limits.conf
      - update content in file /etc/security/limits.d/icinga_limits.conf from none to 9a5a7e
      --- /etc/security/limits.d/icinga_limits.conf     2018-09-12 12:21:03.737810250 +0000
      +++ /etc/security/limits.d/.chef-icinga_limits20180912-22-qww24q.conf     2018-09-12 12:21:03.737810250 +0000
      @@ -1 +1,17 @@
      +# Limits settings for icinga
      +
      +icinga - nofile 48000
      +
      +icinga - nproc unlimited
      +
      +icinga - memlock unlimited
      +
      +
      +
      +
      +
      +
      +
      +
      +
      - change mode from '' to '0644'
  
Recipe: icinga2::service
  * service[icinga2] action enable (up to date)
  * ruby_block[delayed_icinga2_service_start] action run
    - execute the ruby block delayed_icinga2_service_start
Recipe: icinga2-test::default
  * icinga2_usergroup[testgroup] action create
    * template[object_config_usergroup_testgroup] action create
      - create new file /etc/icinga2/objects.d/usergroup.conf
      - update content in file /etc/icinga2/objects.d/usergroup.conf from none to 2910d1
      --- /etc/icinga2/objects.d/usergroup.conf 2018-09-12 12:21:03.849813211 +0000
      +++ /etc/icinga2/objects.d/.chef-usergroup20180912-22-1vt8epo.conf        2018-09-12 12:21:03.849813211 +0000
      @@ -1 +1,14 @@
      +/**
      + * This file is managed by Chef.
      + * Do NOT modify this file directly.
      +*/
      +
      +/**
      + * UserGroup Objects.
      +*/
      +
      +object UserGroup "testgroup" {
      +  display_name = "Test User Group"
      +}
      +
      - change owner from '' to 'icinga'
      - change group from '' to 'icinga'
    * template[object_template_usergroup_testgroup] action create (skipped due to only_if)
  
  * icinga2_user[testuser] action create
    * template[object_config_user_testuser] action create
      - create new file /etc/icinga2/objects.d/user.conf
      - update content in file /etc/icinga2/objects.d/user.conf from none to 19fe73
      --- /etc/icinga2/objects.d/user.conf      2018-09-12 12:21:03.857813423 +0000
      +++ /etc/icinga2/objects.d/.chef-user20180912-22-n8gui3.conf      2018-09-12 12:21:03.857813423 +0000
      @@ -1 +1,21 @@
      +/**
      + * This file is managed by Chef.
      + * Do NOT modify this file directly.
      +*/
      +
      +/**
      + * User Objects.
      +*/
      +
      +object User "testuser" {
      +  import "generic-user"
      +  display_name = "Test User"
      +  enable_notifications = true
      +  groups = ["testgroup"]
      +  email = "[email protected]"
      +  period = "24x7"
      +  states = [ OK, Warning, Critical, Unknown, Up, Down ]
      +  types = [ DowntimeStart, DowntimeEnd, DowntimeRemoved, Custom, Acknowledgement, Problem, Recovery, FlappingStart, FlappingEnd ]
      +}
      +
      - change owner from '' to 'icinga'
      - change group from '' to 'icinga'
    * template[object_template_user_testuser] action create (skipped due to only_if)
  
  * icinga2_environment[test] action create
    * template[/etc/icinga2/objects.d/host_test_test.conf] action create
      - create new file /etc/icinga2/objects.d/host_test_test.conf
      - update content in file /etc/icinga2/objects.d/host_test_test.conf from none to 01d2bc
      --- /etc/icinga2/objects.d/host_test_test.conf    2018-09-12 12:21:03.873813845 +0000
      +++ /etc/icinga2/objects.d/.chef-host_test_test20180912-22-bu6og9.conf    2018-09-12 12:21:03.873813845 +0000
      @@ -1 +1,54 @@
      +/**
      + * This file is managed by Chef.
      + * Do NOT modify this file directly.
      +*/
      +
      +/**
      + * Chef Environment Host Objects.
      +*/
      +
      +object Host "node1.foo" {
      +  import "generic-host"
      +  display_name = "node1.foo"
      +  address = "192.168.100.101"
      +  groups = ["test", "test-foo"]
      +  max_check_attempts = 3
      +  check_interval = 1m
      +  retry_interval = 10s
      +  vars["application"] = "foo"
      +  vars["cpu"] = 1
      +  vars["disks"]["mounts"] = {
      +  }
      +  vars["environment"] = "test"
      +  vars["flock"] = "foo"
      +  vars["hostgroups"] = [ "test", "test-foo" ]
      +  vars["memory"] = "1655MB"
      +  vars["platform"] = "centos"
      +  vars["remote_client"] = "node1.foo"
      +  vars["run_list"] = ""
      +  vars["tags"] = [  ]
      +}
      +
      +object Host "node2.foo" {
      +  import "generic-host"
      +  display_name = "node2.foo"
      +  address = "192.168.100.102"
      +  groups = ["test", "test-foo"]
      +  max_check_attempts = 3
      +  check_interval = 1m
      +  retry_interval = 10s
      +  vars["application"] = "foo"
      +  vars["cpu"] = 1
      +  vars["disks"]["mounts"] = {
      +  }
      +  vars["environment"] = "test"
      +  vars["flock"] = "foo"
      +  vars["hostgroups"] = [ "test", "test-foo" ]
      +  vars["memory"] = "1655MB"
      +  vars["platform"] = "centos"
      +  vars["remote_client"] = "node2.foo"
      +  vars["run_list"] = ""
      +  vars["tags"] = [  ]
      +}
      +
      - change mode from '' to '0640'
      - change owner from '' to 'icinga'
      - change group from '' to 'icinga'
    * icinga2_envhostgroup[test] action create
      * template[/etc/icinga2/objects.d/envhostgroup_test.conf] action create
        - create new file /etc/icinga2/objects.d/envhostgroup_test.conf
        - update content in file /etc/icinga2/objects.d/envhostgroup_test.conf from none to f56d69
        --- /etc/icinga2/objects.d/envhostgroup_test.conf       2018-09-12 12:21:03.889814268 +0000
        +++ /etc/icinga2/objects.d/.chef-envhostgroup_test20180912-22-1qgts1m.conf      2018-09-12 12:21:03.889814268 +0000
        @@ -1 +1,21 @@
        +/**
        + * This file is managed by Chef.
        + * Do NOT modify this file directly.
        +*/
        +
        +/**
        + * Chef Environment HostGroup Objects.
        +*/
        +
        +# default environment hostgroup object for env nodes
        +object HostGroup "test" {
        +  display_name = "test"
        +  assign where "test" in host.vars.hostgroups
        +}
        +
        +object HostGroup "test-foo" {
        +  display_name = "test foo"
        +  assign where "test-foo" in host.vars.hostgroups
        +}
        +
        - change mode from '' to '0640'
        - change owner from '' to 'icinga'
        - change group from '' to 'icinga'
    
  
Recipe: icinga2::service
  * service[icinga2] action restart
    - restart service service[icinga2]
  * service[icinga2] action reload
    - reload service service[icinga2]
  * service[icinga2] action start (up to date)

Running handlers:
Running handlers complete
Chef Client finished, 50/74 resources updated in 02 minutes 57 seconds
       Finished converging <chef13server-centos-6> (2m58.59s).
-----> Setting up <chef13server-centos-6>...
       Finished setting up <chef13server-centos-6> (0m0.00s).
-----> Verifying <chef13server-centos-6>...
       Loaded tests from test/smoke/server 

Profile: tests from test/smoke/server
Version: (not specified)
Target:  docker://fe534ec8436e15ecd426ffacf6b15dbfa74c5e11c14860219a82dd31538e84a3


  System Package
     ✔  icinga2 should be installed
  System Package
     ✔  icinga2-common should be installed
  System Package
     ✔  icinga2-bin should be installed
  System Package
     ✔  icinga2-libs should be installed
  Service icinga2
     ✔  should be installed
     ✔  should be enabled
     ✔  should be running

Test Summary: 7 successful, 0 failures, 0 skipped
       Finished verifying <chef13server-centos-6> (0m3.98s).
-----> Kitchen is finished. (3m26.93s)
 

@lippserd lippserd requested a review from vkhatri October 9, 2020 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants