Hello everybody. I have a problem with a receiving data from host to zabbix server. I have the script which make JSON format for zabbix server for discovery rules.
This script returns the following if execute it from host(agent):
But when I doing the get request from zabbix server with this command:
zabbix_get -s 172.16.164.72 -k di[kworker/85]
I get the output:
Here is incomplete value which ends "+". Everytime I have output limited to 10 symbols with every process which has more than 10 symbols
My config file for zabbix-agent:
Help me please to understand it and I will be glad if you have a solution. Thank you
#!/bin/bash
TERM=linux
while [ -n "$1" ]
do
case "$1" in
.................................................. ...............................
-j) p="$2"
g=$(top -Hbn1 | grep $p | awk '{print $NF}' ORS=',')
IFS=$',' read -r -a customArray <<< $g
echo -e "["
for ((c=0; c<${#customArray[@]}; c++))
do
if ((c==$((${#customArray[@]}-1))));
then
echo -e "{"proc":"${customArray[c]}"}"
else
echo -e "{"proc":"${customArray[c]}"},"
fi
done
echo -e "]"
shift ;;
.................................................. .................................
esac
shift
done
TERM=linux
while [ -n "$1" ]
do
case "$1" in
.................................................. ...............................
-j) p="$2"
g=$(top -Hbn1 | grep $p | awk '{print $NF}' ORS=',')
IFS=$',' read -r -a customArray <<< $g
echo -e "["
for ((c=0; c<${#customArray[@]}; c++))
do
if ((c==$((${#customArray[@]}-1))));
then
echo -e "{"proc":"${customArray[c]}"}"
else
echo -e "{"proc":"${customArray[c]}"},"
fi
done
echo -e "]"
shift ;;
.................................................. .................................
esac
shift
done
/zabbix_proc.sh -j kworker/85
[
{"proc":"kworker/85:0H"},
{"proc":"kworker/85:1H"},
{"proc":"kworker/85:2"},
{"proc":"kworker/85:0"}
]
[
{"proc":"kworker/85:0H"},
{"proc":"kworker/85:1H"},
{"proc":"kworker/85:2"},
{"proc":"kworker/85:0"}
]
zabbix_get -s 172.16.164.72 -k di[kworker/85]
I get the output:
[
{"proc":"kworker/85+"},
{"proc":"kworker/85+"},
{"proc":"kworker/85+"},
{"proc":"kworker/85+"}
]
{"proc":"kworker/85+"},
{"proc":"kworker/85+"},
{"proc":"kworker/85+"},
{"proc":"kworker/85+"}
]
My config file for zabbix-agent:
UserParameter=di[*],/etc/zabbix/zabbix_proc.sh -j $1
UnsafeUserParameters=1
AllowKey=system.run[*]
UnsafeUserParameters=1
AllowKey=system.run[*]
Comment