Module: check_mk
Branch: master
Commit: 4466b9ac6bcef0b663a43fcd95d373c4bb629d51
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4466b9ac6bcef0…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Apr 12 13:10:28 2018 +0200
Fixed some semantic errors
Change-Id: I4850043996aed91e4bdb5fdf45076ec7fe3e8227
---
agents/plugins/mk_site_object_counts | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/agents/plugins/mk_site_object_counts b/agents/plugins/mk_site_object_counts
index 7c5f9f7..8241a69 100755
--- a/agents/plugins/mk_site_object_counts
+++ b/agents/plugins/mk_site_object_counts
@@ -39,15 +39,14 @@ function get_tag_stats () {
local site="$2"
local header="$3"
local tags=($(echo "$header" | tr ' ' '\n'))
- if [ -n "$tags" ] && [ -S "$socket" ];
+ if [ "${#tags[@]}" -ne 0 ] && [ -S "$socket" ];
then
local tags_query="GET hosts\n"
for tag in "${tags[@]}";
do
tags_query="${tags_query}Stats: custom_variables ~ TAGS ${tag}\n"
done
- echo "Tags|$header|$(echo -e "${tags_query}" | \
- waitmax 3 /omd/sites/${site}/bin/unixcat ${socket})"
+ echo "Tags|$header|$(echo -e "${tags_query}" | waitmax 3
"/omd/sites/${site}/bin/unixcat" "${socket}")"
fi
}
@@ -57,15 +56,14 @@ function get_check_command_stats () {
local site="$2"
local header="$3"
local service_check_commands=($(echo "$header" | tr ' '
'\n'))
- if [ -n "$service_check_commands" ] && [ -S "$socket" ];
+ if [ "${#service_check_commands[@]}" -ne 0 ] && [ -S
"$socket" ];
then
local service_check_commands_query="GET services\n"
for service_check_command in "${service_check_commands[@]}";
do
service_check_commands_query="${service_check_commands_query}Stats:
check_command ~~ ${service_check_command}$\n"
done
- echo "Service check commands|$header|$(echo -e
"${service_check_commands_query}" | \
- waitmax 3 /omd/sites/${site}/bin/unixcat
${socket})"
+ echo "Service check commands|$header|$(echo -e
"${service_check_commands_query}" | waitmax 3
"/omd/sites/${site}/bin/unixcat" "${socket}")"
fi
}
@@ -80,10 +78,14 @@ function get_check_command_stats () {
# | |
# '----------------------------------------------------------------------'
+SITES=
+TAGS=
+SERVICE_CHECK_COMMANDS=
+
if [ -e "$MK_CONFDIR/site_object_counts.cfg" ];
then
- . $MK_CONFDIR/site_object_counts.cfg
+ . "$MK_CONFDIR/site_object_counts.cfg"
fi