If it's possible, please help!
Seems like i did something wrong, or didn't understand something.
I set all userparametrs directly in /opt/zabbix/etc/zabbix_agentd.conf. Path to script is set here
UserParameter=redis.discovery[*], /opt/zabbix/etc/scripts/zbx_redis_discovery.sh $1 $2
I edited /opt/zabbix/etc/scripts/zbx_redis_discovery.sh to specify redis location:
REDIS_CLI_DEFAULT_PATH="/opt/redis/bin/redis-cli"
When i run zbx_redis_discovery.sh general debug, few files redis-127.0.0.1-6379* in /tmp are created with root privileges.
After this i can request some information with
./opt/zabbix/sbin/zabbix_agentd -t redis.stat.get[expired_keys,127.0.0.1,6379]
redis.stat.get[expired_keys,127.0.0.1,6379] [t|29562818]
And remotely the same.
But i get, only what is in redis-127.0.0.1-6379 file (so it's not in realtime)
chown zabbix.zabbix redis-127.0.0.1* didn't help.
I imported template in gui, but it show Timeout while executing a shell script.
Here's resutl of zbx_redis_discovery.sh general debug
Hello, Pavel!
If it's possible, please help! Seems like i did something wrong, or didn't understand something.
I set all userparametrs directly in /opt/zabbix/etc/zabbix_agentd.conf. Path to script is set here UserParameter=redis.discovery[*], /opt/zabbix/etc/scripts/zbx_redis_discovery.sh $1 $2
I edited /opt/zabbix/etc/scripts/zbx_redis_discovery.sh to specify redis location: REDIS_CLI_DEFAULT_PATH="/opt/redis/bin/redis-cli"
When i run zbx_redis_discovery.sh general debug, few files redis-127.0.0.1-6379* in /tmp are created with root privileges. After this i can request some information with ./opt/zabbix/sbin/zabbix_agentd -t redis.stat.get[expired_keys,127.0.0.1,6379] redis.stat.get[expired_keys,127.0.0.1,6379] [t|29562818] And remotely the same.
But i get, only what is in redis-127.0.0.1-6379 file (so it's not in realtime)
chown zabbix.zabbix redis-127.0.0.1* didn't help.
I imported template in gui, but it show Timeout while executing a shell script.
Here's resutl of zbx_redis_discovery.sh general debug
`+ '[' -e /tmp/redis-cli ']' ++ cat /tmp/redis-cli
REDIS_CLI=/opt/redis/bin/redis-cli
'[' general '!=' general ']'
echo -n '{"data":[' {"data":[+ for s in '$LIST'
sed -e 's:},$:}:' ++ echo root:/opt/redis/bin/redis-server:127.0.0.1:6379: ++ sed 's/*/127.0.0.1/g' ++ cut -d: -f3
HOST=127.0.0.1 ++ echo root:/opt/redis/bin/redis-server:127.0.0.1:6379: ++ sed 's/*/127.0.0.1/g' ++ cut -d: -f4
PORT=6379
[[ 1 -ne 0 ]]
(( i=0 ))
(( i<1 ))
PASSWORD=debug ++ discover_redis_instance 127.0.0.1 6379 debug ++ HOST=127.0.0.1 ++ PORT=6379 ++ PASSWORD=debug +++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug ping ++ ALIVE=PONG ++ [[ PONG != \P\O\N\G ]] +++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug info +++ grep config_file +++ cut -d : -f2 +++ sed s/.conf//g +++ rev +++ cut -d / -f1 +++ rev +++ tr -d '[:space:]' +++ tr '[:lower:]' '[:upper:]' ++ INSTANCE=REDIS ++ '[' REDIS = '' ']' +++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug config get dir +++ cut -d ' ' -f2 +++ sed -n 2p ++ INSTANCE_RDB_PATH=/ +++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug config get dbfilename +++ cut -d ' ' -f2 +++ sed -n 2p ++ INSTANCE_RDB_FILE=dump.rdb ++ echo REDIS
INSTANCE=REDIS ++ discover_redis_rdb_database 127.0.0.1 6379 debug ++ HOST=127.0.0.1 ++ PORT=6379 ++ PASSWORD=debug +++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug ping ++ ALIVE=PONG ++ [[ PONG != \P\O\N\G ]] +++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug config get dir +++ cut -d ' ' -f2 +++ sed -n 2p ++ INSTANCE_RDB_PATH=/ +++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug config get dbfilename +++ cut -d ' ' -f2 +++ sed -n 2p ++ INSTANCE_RDB_FILE=dump.rdb ++ echo //dump.rdb
RDB_PATH=//dump.rdb ++ discover_redis_available_commands 127.0.0.1 6379 debug ++ HOST=127.0.0.1 ++ PORT=6379 ++ PASSWORD=debug +++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug ping ++ ALIVE=PONG ++ [[ PONG != \P\O\N\G ]] +++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug info all +++ grep cmdstat +++ cut -d: -f1 ++ REDIS_COMMANDS='cmdstat_get cmdstat_del cmdstat_exists cmdstat_srem cmdstat_sunion cmdstat_smembers cmdstat_hset cmdstat_hget cmdstat_hmset cmdstat_hmget cmdstat_hincrby cmdstat_select cmdstat_expire cmdstat_keys cmdstat_auth cmdstat_ping cmdstat_multi cmdstat_exec cmdstat_info cmdstat_config cmdstat_slowlog cmdstat_command' ++ IFS=' ' ++ echo 'cmdstat_get cmdstat_del cmdstat_exists cmdstat_srem cmdstat_sunion cmdstat_smembers cmdstat_hset cmdstat_hget cmdstat_hmset cmdstat_hmget cmdstat_hincrby cmdstat_select cmdstat_expire cmdstat_keys cmdstat_auth cmdstat_ping cmdstat_multi cmdstat_exec cmdstat_info cmdstat_config cmdstat_slowlog cmdstat_command'
COMMANDS='cmdstat_get cmdstat_del cmdstat_exists cmdstat_srem cmdstat_sunion cmdstat_smembers cmdstat_hset cmdstat_hget cmdstat_hmset cmdstat_hmget cmdstat_hincrby cmdstat_select cmdstat_expire cmdstat_keys cmdstat_auth cmdstat_ping cmdstat_multi cmdstat_exec cmdstat_info cmdstat_config cmdstat_slowlog cmdstat_command' ++ discover_redis_available_slaves 127.0.0.1 6379 debug ++ HOST=127.0.0.1 ++ PORT=6379 ++ PASSWORD=debug +++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug ping ++ ALIVE=PONG ++ [[ PONG != \P\O\N\G ]] +++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug info all +++ grep '^slave' +++ cut -d : -f1 +++ grep '[0-1024]' ++ REDIS_SLAVES= ++ IFS=' ' ++ echo ''
SLAVES=
[[ -n REDIS ]]
[[ general == \g\e\n\e\r\a\l ]]
generate_redis_stats_report 127.0.0.1 6379 debug
HOST=127.0.0.1
PORT=6379
PASSWORD=debug
local REDIS_REPORT_RESULT=/tmp/redis-127.0.0.1-6379
local REDIS_REPORT_RESULT_TMP=/tmp/redis-127.0.0.1-6379.tmp ++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug info all
REDIS_REPORT=
REDIS_REPORT_RC=0
local REDIS_SLOWLOG_LEN_RESULT=/tmp/redis-127.0.0.1-6379-slowlog-len
local REDIS_SLOWLOG_LEN_RESULT_TMP=/tmp/redis-127.0.0.1-6379-slowlog-len.tmp ++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug slowlog len ++ cut -d ' ' -f2 ++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug slowlog reset
REDIS_SLOWLOG_LEN=
REDIS_SLOWLOG_LEN_RC=0
local REDIS_SLOWLOG_RAW_RESULT=/tmp/redis-127.0.0.1-6379-slowlog-raw
local REDIS_SLOWLOG_RAW_RESULT_TMP=/tmp/redis-127.0.0.1-6379-slowlog-raw.tmp ++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug slowlog get
REDIS_SLOWLOG_RAW=
REDIS_SLOWLOG_RAW_RC=0
local REDIS_MAX_CLIENTS_RESULT=/tmp/redis-127.0.0.1-6379-maxclients
local REDIS_MAX_CLIENTS_RESULT_TMP=/tmp/redis-127.0.0.1-6379-maxclients.tmp ++ /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a debug config get 'maxclients' ++ cut -d ' ' -f2 ++ sed -n 2p
REDIS_MAX_CLIENTS=
REDIS_MAX_CLIENTS_RC=0
[[ -e /tmp/redis-127.0.0.1-6379.tmp ]]
[[ 0 -eq 0 ]] ++ mv /tmp/redis-127.0.0.1-6379.tmp /tmp/redis-127.0.0.1-6379
REDIS_REPORT_DUMP=
[[ 0 -ne 0 ]]
[[ -e /tmp/redis-127.0.0.1-6379-slowlog-len.tmp ]]
[[ '' -eq 0 ]] ++ mv /tmp/redis-127.0.0.1-6379-slowlog-len.tmp /tmp/redis-127.0.0.1-6379-slowlog-len
REDIS_REPORT_DUMP=
[[ 0 -ne 0 ]]
[[ -e /tmp/redis-127.0.0.1-6379-maxclients.tmp ]]
[[ 0 -eq 0 ]] ++ mv /tmp/redis-127.0.0.1-6379-slowlog-raw.tmp /tmp/redis-127.0.0.1-6379-slowlog-raw
REDIS_REPORT_DUMP=
[[ 0 -ne 0 ]]
[[ -e /tmp/redis-127.0.0.1-6379-maxclients.tmp ]]
[[ 0 -eq 0 ]] ++ mv /tmp/redis-127.0.0.1-6379-maxclients.tmp /tmp/redis-127.0.0.1-6379-maxclients
REDIS_REPORT_DUMP=
[[ 0 -ne 0 ]]
generate_general_discovery_json 127.0.0.1 6379 REDIS //dump.rdb
HOST=127.0.0.1
PORT=6379
INSTANCE=REDIS
RDB_PATH=//dump.rdb
echo -n '{'
echo -n '"{#HOST}":"127.0.0.1",'
echo -n '"{#PORT}":"6379",'
echo -n '"{#INSTANCE}":"REDIS",'
echo -n '"{#RDB_PATH}":"//dump.rdb"'
echo -n '},'
(( i++ ))
(( i<1 ))
unset {"{#HOST}":"127.0.0.1","{#PORT}":"6379","{#INSTANCE}":"REDIS","{#RDB_PATH}":"//dump.rdb"}+ echo -n ']}' ]}+ echo ''
unset IFS`