diff --git a/README.md b/README.md index 3549b12..37987d7 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ For currently available local checks, see: [files/check-mk/local](https://github Currently the following checkmk agent plugins are supported: -``` +```yaml checkmkagent_plugins_available: [ 'mk_ceph', 'mk_logwatch.py', 'mk_mysql' ] ``` @@ -37,7 +37,7 @@ N/A Example Playbook ---------------- -``` +```yaml - hosts: site vars: checkmkagent_host_url: 'http://monitor01.example.com/mysite' @@ -59,7 +59,7 @@ Older versions of this role used the variable `checkmkagent_baseurl` instead `ch `mk_apt` was installed in `/usr/lib/check_mk_agent/plugins/60` instead of `/usr/lib/check_mk_agent/plugins/3600`. To delete the check on all hosts from the wrong location you could use ansible like this: -``` +```console % ansible -i hosts all -m shell -a "ls -l /usr/lib/check_mk_agent/plugins/60/mk_apt" % ansible -i hosts all -b -m shell -a "rm /usr/lib/check_mk_agent/plugins/60/mk_apt" % ansible -i hosts all -b -m shell -a "rmdir /usr/lib/check_mk_agent/plugins/60" @@ -74,4 +74,4 @@ MIT Author Information ------------------ -Darshaka Pathirana - https://synpro.solutions +Darshaka Pathirana - diff --git a/files/check-mk/local/check_megacli_battery b/files/check-mk/local/check_megacli_battery index c5b1453..682050f 100644 --- a/files/check-mk/local/check_megacli_battery +++ b/files/check-mk/local/check_megacli_battery @@ -13,10 +13,12 @@ fi # battery_adapter=ALL or an adapter if [ -e "$MK_CONFDIR/megacli.cfg" ]; then - . $MK_CONFDIR/megacli.cfg + # shellcheck disable=SC1090 + . "$MK_CONFDIR/megacli.cfg" fi # if unconfigured then default to all adapters +# shellcheck disable=SC2154 if [ -z "$battery_adapter" ] ; then exit 0 fi diff --git a/files/check-mk/local/check_megacli_diskgroups b/files/check-mk/local/check_megacli_diskgroups index b88c11d..ac6198f 100644 --- a/files/check-mk/local/check_megacli_diskgroups +++ b/files/check-mk/local/check_megacli_diskgroups @@ -14,9 +14,11 @@ fi # num_disk_groups=0 if [ -e "$MK_CONFDIR/megacli.cfg" ]; then - . $MK_CONFDIR/megacli.cfg + # shellcheck disable=SC1090 + . "$MK_CONFDIR/megacli.cfg" fi +# shellcheck disable=SC2154 if [ -z "$num_disk_groups" ]; then exit 0 fi @@ -38,7 +40,7 @@ for adapter in $adapters ; do fi if [ "$num_disk_groups_adapter" -eq 0 ] ; then - [ ! -z "$output" ] && output="${output}, " + [ -n "$output" ] && output="${output}, " output="${output}Adapter $adapter: no disk group" continue else @@ -57,7 +59,7 @@ for adapter in $adapters ; do echo "2 ${check_name} - $STATUS on adapter $adapter [see 'megacli -CfgDsply -a$adapter -NoLog']" exit 1 else - [ ! -z "$output" ] && output="${output}, " + [ -n "$output" ] && output="${output}, " output="${output}Adapter $adapter: $STATUS" fi done @@ -70,7 +72,7 @@ elif [ "$num_disk_groups_present" -gt "$num_disk_groups_expected" ] ; then exit 1 fi -[ ! -z "$output" ] && output="${output}, " +[ -n "$output" ] && output="${output}, " output="${output}$num_disk_groups_present disk group(s) found" echo "0 ${check_name} - $output" diff --git a/files/check-mk/local/check_megacli_num_disks b/files/check-mk/local/check_megacli_num_disks index 7b65870..8e72b3f 100644 --- a/files/check-mk/local/check_megacli_num_disks +++ b/files/check-mk/local/check_megacli_num_disks @@ -14,9 +14,11 @@ fi # num_disks=[number of disks to be expected] if [ -e "$MK_CONFDIR/megacli.cfg" ]; then - . $MK_CONFDIR/megacli.cfg + # shellcheck disable=SC1090 + . "$MK_CONFDIR/megacli.cfg" fi +# shellcheck disable=SC2154 if [ -z "$num_disks" ] ; then exit 0 fi diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml deleted file mode 100644 index 0bcfa80..0000000 --- a/molecule/default/converge.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Converge - hosts: all - tasks: - - name: "Include ansible-role-checkmkagent" - include_role: - name: "ansible-role-checkmkagent" diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml deleted file mode 100644 index 3bd4fbd..0000000 --- a/molecule/default/molecule.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -dependency: - name: galaxy -driver: - name: docker -platforms: - - name: instance - image: geerlingguy/docker-debian10-ansible - pre_build_image: true - container_default_behavior: no_defaults - - name: debian_11 - image: geerlingguy/docker-debian11-ansible - pre_build_image: true - container_default_behavior: no_defaults -provisioner: - name: ansible -verifier: - name: ansible diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml deleted file mode 100644 index 79044cd..0000000 --- a/molecule/default/verify.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -# This is an example playbook to execute Ansible tests. - -- name: Verify - hosts: all - gather_facts: false - tasks: - - name: Example assertion - assert: - that: true