pavelnemirovsky / zabbix-redis-template

Multi Instance Redis Discovery Template for Zabbix
MIT License
44 stars 26 forks source link

What is {$REDIS_PASSWORDS} value if password is empty? #2

Closed fireice009 closed 7 years ago

fireice009 commented 7 years ago

Leave it empty will cause error.

pavelnemirovsky commented 7 years ago

Checking... standby

pavelnemirovsky commented 7 years ago

Thanks for reporting, I fixed that behavior as part of this commit: https://github.com/pavelnemirovsky/zabbix-redis-template/commit/2566bbee8dac3a3c7f64297c6020bbd28ba0fcea

In template empty response may look as following: image

fireice009 commented 7 years ago

Zabbix server and agent version is 3.2.1.

image

pavelnemirovsky commented 7 years ago
pavelnemirovsky commented 7 years ago

Also pay attention i update the template where replications has been changed to replication due typo in discovery slave replication param

fireice009 commented 7 years ago

[root@localhost bin]# ./zbx_redis_discovery.sh general {"data":[tr: [:upper:] and/or[:lower:] Structural alignment is incomplete tr: [:upper:] and/or[:lower:] Structural alignment is incomplete tr: [:upper:] and/or[:lower:] Structural alignment is incomplete ]}

"Structural alignment is incomplete" is translated from other language. It may have some difference from English.

zbx_redis_discovery.sh has invalid syntax on my CentOS 7.

pavelnemirovsky commented 7 years ago

Dude, run following command: zbx_redis_discovery.sh general debug

fireice009 commented 7 years ago

Oh, I'm Sorry.

[root@localhost bin]# zbx_redis_discovery.sh general debug
+ '[' -a /tmp/redis-cli ']'
++ cat /tmp/redis-cli
+ REDIS_CLI=/data/codis/redis/bin/redis-cli
+ '[' -a /tmp/stdbuf ']'
++ cat /tmp/stdbuf
+ STDBUF=/usr/bin/stdbuf
+ '[' general '!=' general ']'
+ echo -n '{"data":['
{"data":[+ sed -e 's:\},$:\}:'
+ for s in '$LIST'
++ echo 'root:/usr/local/redis/bin/redis-server:*:6380'
++ sed 's/*/127.0.0.1/g'
++ cut -d: -f3
+ HOST=127.0.0.1
++ echo 'root:/usr/local/redis/bin/redis-server:*:6380'
++ sed 's/*/127.0.0.1/g'
++ cut -d: -f4
+ PORT=6380
+ [[ 1 -ne 0 ]]
+ (( i=0 ))
+ (( i<1 ))
+ PASSWORD=debug
++ discover_redis_instance 127.0.0.1 6380 debug
++ HOST=127.0.0.1
++ PORT=6380
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug info
+++ grep config_file
+++ sed s/.conf//g
+++ rev
+++ cut -d / -f1
+++ rev
+++ tr -d '[:space:]'
+++ tr w '[:upper:]'
tr: [:upper:] 和/或[:lower:] 的结构对齐不完整
++ INSTANCE=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug config get dir grub2-mknetdir mkdir mkfontdir rmdir ttmkfdir vdir
++ INSTANCE_RDB_PATH=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug config get '*dbfilename'
++ INSTANCE_RDB_FILE=dump_6380.rdb
++ echo
+ INSTANCE=
++ discover_redis_rdb_database 127.0.0.1 6380 debug
++ HOST=127.0.0.1
++ PORT=6380
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug config get dir grub2-mknetdir mkdir mkfontdir rmdir ttmkfdir vdir
++ INSTANCE_RDB_PATH=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug config get '*dbfilename'
++ INSTANCE_RDB_FILE=dump_6380.rdb
++ echo /dump_6380.rdb
+ RDB_PATH=/dump_6380.rdb
++ discover_redis_avalable_commands 127.0.0.1 6380 debug
++ HOST=127.0.0.1
++ PORT=6380
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug info all
+++ grep cmdstat
+++ cut -d: -f1
++ REDIS_COMMANDS='cmdstat_set
cmdstat_keys
cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
++ IFS='
'
++ echo 'cmdstat_set
cmdstat_keys
cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
+ COMMANDS='cmdstat_set
cmdstat_keys
cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
++ discover_redis_avalable_slaves 127.0.0.1 6380 debug
++ HOST=127.0.0.1
++ PORT=6380
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug info all
+++ grep '^slave'
+++ cut -d : -f1
+++ grep '[0-1024]'
++ REDIS_SLAVES=
++ IFS='
'
++ echo ''
+ SLAVES=
+ [[ -n '' ]]
+ (( i++  ))
+ (( i<1 ))
+ unset
+ for s in '$LIST'
++ echo 'root:/usr/local/redis/bin/redis-server:*:6381'
++ sed 's/*/127.0.0.1/g'
++ cut -d: -f3
+ HOST=127.0.0.1
++ echo 'root:/usr/local/redis/bin/redis-server:*:6381'
++ sed 's/*/127.0.0.1/g'
++ cut -d: -f4
+ PORT=6381
+ [[ 1 -ne 0 ]]
+ (( i=0 ))
+ (( i<1 ))
+ PASSWORD=debug
++ discover_redis_instance 127.0.0.1 6381 debug
++ HOST=127.0.0.1
++ PORT=6381
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug info
+++ grep config_file
+++ sed s/.conf//g
+++ rev
+++ cut -d / -f1
+++ rev
+++ tr -d '[:space:]'
+++ tr w '[:upper:]'
tr: [:upper:] 和/或[:lower:] 的结构对齐不完整
++ INSTANCE=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug config get dir grub2-mknetdir mkdir mkfontdir rmdir ttmkfdir vdir
++ INSTANCE_RDB_PATH=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug config get '*dbfilename'
++ INSTANCE_RDB_FILE=dump_6381.rdb
++ echo
+ INSTANCE=
++ discover_redis_rdb_database 127.0.0.1 6381 debug
++ HOST=127.0.0.1
++ PORT=6381
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug config get dir grub2-mknetdir mkdir mkfontdir rmdir ttmkfdir vdir
++ INSTANCE_RDB_PATH=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug config get '*dbfilename'
++ INSTANCE_RDB_FILE=dump_6381.rdb
++ echo /dump_6381.rdb
+ RDB_PATH=/dump_6381.rdb
++ discover_redis_avalable_commands 127.0.0.1 6381 debug
++ HOST=127.0.0.1
++ PORT=6381
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug info all
+++ grep cmdstat
+++ cut -d: -f1
++ REDIS_COMMANDS='cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
++ IFS='
'
++ echo 'cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
+ COMMANDS='cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
++ discover_redis_avalable_slaves 127.0.0.1 6381 debug
++ HOST=127.0.0.1
++ PORT=6381
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug info all
+++ grep '^slave'
+++ cut -d : -f1
+++ grep '[0-1024]'
++ REDIS_SLAVES=
++ IFS='
'
++ echo ''
+ SLAVES=
+ [[ -n '' ]]
+ (( i++  ))
+ (( i<1 ))
+ unset
+ for s in '$LIST'
++ echo 'root:/usr/local/redis/bin/redis-server:*:6382'
++ sed 's/*/127.0.0.1/g'
++ cut -d: -f3
+ HOST=127.0.0.1
++ echo 'root:/usr/local/redis/bin/redis-server:*:6382'
++ sed 's/*/127.0.0.1/g'
++ cut -d: -f4
+ PORT=6382
+ [[ 1 -ne 0 ]]
+ (( i=0 ))
+ (( i<1 ))
+ PASSWORD=debug
++ discover_redis_instance 127.0.0.1 6382 debug
++ HOST=127.0.0.1
++ PORT=6382
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug info
+++ grep config_file
+++ sed s/.conf//g
+++ rev
+++ cut -d / -f1
+++ rev
+++ tr -d '[:space:]'
+++ tr w '[:upper:]'
tr: [:upper:] 和/或[:lower:] 的结构对齐不完整
++ INSTANCE=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug config get dir grub2-mknetdir mkdir mkfontdir rmdir ttmkfdir vdir
++ INSTANCE_RDB_PATH=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug config get '*dbfilename'
++ INSTANCE_RDB_FILE=dump_6382.rdb
++ echo
+ INSTANCE=
++ discover_redis_rdb_database 127.0.0.1 6382 debug
++ HOST=127.0.0.1
++ PORT=6382
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug config get dir grub2-mknetdir mkdir mkfontdir rmdir ttmkfdir vdir
++ INSTANCE_RDB_PATH=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug config get '*dbfilename'
++ INSTANCE_RDB_FILE=dump_6382.rdb
++ echo /dump_6382.rdb
+ RDB_PATH=/dump_6382.rdb
++ discover_redis_avalable_commands 127.0.0.1 6382 debug
++ HOST=127.0.0.1
++ PORT=6382
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug info all
+++ grep cmdstat
+++ cut -d: -f1
++ REDIS_COMMANDS='cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
++ IFS='
'
++ echo 'cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
+ COMMANDS='cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
++ discover_redis_avalable_slaves 127.0.0.1 6382 debug
++ HOST=127.0.0.1
++ PORT=6382
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug info all
+++ grep '^slave'
+++ cut -d : -f1
+++ grep '[0-1024]'
++ REDIS_SLAVES=
++ IFS='
'
++ echo ''
+ SLAVES=
+ [[ -n '' ]]
+ (( i++  ))
+ (( i<1 ))
+ unset
+ echo -n ']}'
]}+ echo ''

+ unset IFS
[root@localhost bin]# zbx_redis_discovery.sh general debug
+ '[' -a /tmp/redis-cli ']'
++ cat /tmp/redis-cli
+ REDIS_CLI=/data/codis/redis/bin/redis-cli
+ '[' -a /tmp/stdbuf ']'
++ cat /tmp/stdbuf
+ STDBUF=/usr/bin/stdbuf
+ '[' general '!=' general ']'
+ echo -n '{"data":['
{"data":[+ sed -e 's:\},$:\}:'
+ for s in '$LIST'
++ echo 'root:/usr/local/redis/bin/redis-server:*:6380'
++ sed 's/*/127.0.0.1/g'
++ cut -d: -f3
+ HOST=127.0.0.1
++ echo 'root:/usr/local/redis/bin/redis-server:*:6380'
++ sed 's/*/127.0.0.1/g'
++ cut -d: -f4
+ PORT=6380
+ [[ 1 -ne 0 ]]
+ (( i=0 ))
+ (( i<1 ))
+ PASSWORD=debug
++ discover_redis_instance 127.0.0.1 6380 debug
++ HOST=127.0.0.1
++ PORT=6380
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug info
+++ grep config_file
+++ sed s/.conf//g
+++ rev
+++ cut -d / -f1
+++ rev
+++ tr -d '[:space:]'
+++ tr w '[:upper:]'
tr: [:upper:] 和/或[:lower:] 的结构对齐不完整
++ INSTANCE=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug config get dir grub2-mknetdir mkdir mkfontdir rmdir ttmkfdir vdir
++ INSTANCE_RDB_PATH=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug config get '*dbfilename'
++ INSTANCE_RDB_FILE=dump_6380.rdb
++ echo
+ INSTANCE=
++ discover_redis_rdb_database 127.0.0.1 6380 debug
++ HOST=127.0.0.1
++ PORT=6380
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug config get dir grub2-mknetdir mkdir mkfontdir rmdir ttmkfdir vdir
++ INSTANCE_RDB_PATH=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug config get '*dbfilename'
++ INSTANCE_RDB_FILE=dump_6380.rdb
++ echo /dump_6380.rdb
+ RDB_PATH=/dump_6380.rdb
++ discover_redis_avalable_commands 127.0.0.1 6380 debug
++ HOST=127.0.0.1
++ PORT=6380
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug info all
+++ grep cmdstat
+++ cut -d: -f1
++ REDIS_COMMANDS='cmdstat_set
cmdstat_keys
cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
++ IFS='
'
++ echo 'cmdstat_set
cmdstat_keys
cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
+ COMMANDS='cmdstat_set
cmdstat_keys
cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
++ discover_redis_avalable_slaves 127.0.0.1 6380 debug
++ HOST=127.0.0.1
++ PORT=6380
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6380 -a debug info all
+++ grep '^slave'
+++ cut -d : -f1
+++ grep '[0-1024]'
++ REDIS_SLAVES=
++ IFS='
'
++ echo ''
+ SLAVES=
+ [[ -n '' ]]
+ (( i++  ))
+ (( i<1 ))
+ unset
+ for s in '$LIST'
++ echo 'root:/usr/local/redis/bin/redis-server:*:6381'
++ sed 's/*/127.0.0.1/g'
++ cut -d: -f3
+ HOST=127.0.0.1
++ echo 'root:/usr/local/redis/bin/redis-server:*:6381'
++ sed 's/*/127.0.0.1/g'
++ cut -d: -f4
+ PORT=6381
+ [[ 1 -ne 0 ]]
+ (( i=0 ))
+ (( i<1 ))
+ PASSWORD=debug
++ discover_redis_instance 127.0.0.1 6381 debug
++ HOST=127.0.0.1
++ PORT=6381
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug info
+++ grep config_file
+++ sed s/.conf//g
+++ rev
+++ cut -d / -f1
+++ rev
+++ tr -d '[:space:]'
+++ tr w '[:upper:]'
tr: [:upper:] 和/或[:lower:] 的结构对齐不完整
++ INSTANCE=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug config get dir grub2-mknetdir mkdir mkfontdir rmdir ttmkfdir vdir
++ INSTANCE_RDB_PATH=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug config get '*dbfilename'
++ INSTANCE_RDB_FILE=dump_6381.rdb
++ echo
+ INSTANCE=
++ discover_redis_rdb_database 127.0.0.1 6381 debug
++ HOST=127.0.0.1
++ PORT=6381
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug config get dir grub2-mknetdir mkdir mkfontdir rmdir ttmkfdir vdir
++ INSTANCE_RDB_PATH=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug config get '*dbfilename'
++ INSTANCE_RDB_FILE=dump_6381.rdb
++ echo /dump_6381.rdb
+ RDB_PATH=/dump_6381.rdb
++ discover_redis_avalable_commands 127.0.0.1 6381 debug
++ HOST=127.0.0.1
++ PORT=6381
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug info all
+++ grep cmdstat
+++ cut -d: -f1
++ REDIS_COMMANDS='cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
++ IFS='
'
++ echo 'cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
+ COMMANDS='cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
++ discover_redis_avalable_slaves 127.0.0.1 6381 debug
++ HOST=127.0.0.1
++ PORT=6381
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6381 -a debug info all
+++ grep '^slave'
+++ cut -d : -f1
+++ grep '[0-1024]'
++ REDIS_SLAVES=
++ IFS='
'
++ echo ''
+ SLAVES=
+ [[ -n '' ]]
+ (( i++  ))
+ (( i<1 ))
+ unset
+ for s in '$LIST'
++ echo 'root:/usr/local/redis/bin/redis-server:*:6382'
++ sed 's/*/127.0.0.1/g'
++ cut -d: -f3
+ HOST=127.0.0.1
++ echo 'root:/usr/local/redis/bin/redis-server:*:6382'
++ sed 's/*/127.0.0.1/g'
++ cut -d: -f4
+ PORT=6382
+ [[ 1 -ne 0 ]]
+ (( i=0 ))
+ (( i<1 ))
+ PASSWORD=debug
++ discover_redis_instance 127.0.0.1 6382 debug
++ HOST=127.0.0.1
++ PORT=6382
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug info
+++ grep config_file
+++ sed s/.conf//g
+++ rev
+++ cut -d / -f1
+++ rev
+++ tr -d '[:space:]'
+++ tr w '[:upper:]'
tr: [:upper:] 和/或[:lower:] 的结构对齐不完整
++ INSTANCE=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug config get dir grub2-mknetdir mkdir mkfontdir rmdir ttmkfdir vdir
++ INSTANCE_RDB_PATH=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug config get '*dbfilename'
++ INSTANCE_RDB_FILE=dump_6382.rdb
++ echo
+ INSTANCE=
++ discover_redis_rdb_database 127.0.0.1 6382 debug
++ HOST=127.0.0.1
++ PORT=6382
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug config get dir grub2-mknetdir mkdir mkfontdir rmdir ttmkfdir vdir
++ INSTANCE_RDB_PATH=
+++ cut -d ' ' -f2
+++ sed -n 2p
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug config get '*dbfilename'
++ INSTANCE_RDB_FILE=dump_6382.rdb
++ echo /dump_6382.rdb
+ RDB_PATH=/dump_6382.rdb
++ discover_redis_avalable_commands 127.0.0.1 6382 debug
++ HOST=127.0.0.1
++ PORT=6382
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug info all
+++ grep cmdstat
+++ cut -d: -f1
++ REDIS_COMMANDS='cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
++ IFS='
'
++ echo 'cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
+ COMMANDS='cmdstat_auth
cmdstat_ping
cmdstat_info
cmdstat_config'
++ discover_redis_avalable_slaves 127.0.0.1 6382 debug
++ HOST=127.0.0.1
++ PORT=6382
++ PASSWORD=debug
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug ping
++ ALIVE=PONG
++ [[ PONG != \P\O\N\G ]]
+++ /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug info all
+++ grep '^slave'
+++ cut -d : -f1
+++ grep '[0-1024]'
++ REDIS_SLAVES=
++ IFS='
'
++ echo ''
+ SLAVES=
+ [[ -n '' ]]
+ (( i++  ))
+ (( i<1 ))
+ unset
+ echo -n ']}'
]}+ echo ''

+ unset IFS
pavelnemirovsky commented 7 years ago

i see the problem: change your config name to be in english and in following format: config_file:/opt/redis/redis.instance1.conf

fireice009 commented 7 years ago

Which config file? There is no file or folder in /opt. All file path in /data/codis/conf are english. But has -, e.g. codis-server-127.0.0.1-17000.conf.

pavelnemirovsky commented 7 years ago

If so your INSTANCE name should work and be called:

echo "codis-server-127.0.0.1-17000.conf" | sed 's/.conf//g' | rev | cut -d "/" -f1 | rev | tr -d [:space:] | tr [:lower:] [:upper:]
CODIS-SERVER-127.0.0.1-17000
pavelnemirovsky commented 7 years ago

can u send me an output of this command? /data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug info

fireice009 commented 7 years ago

echo "codis-server-127.0.0.1-17000.conf" | sed 's/.conf//g' | rev | cut -d "/" -f1 | rev | tr -d [:space:] | tr [:lower:] [:upper:] CODIS-SERVER-127.0.0.1-17000 output: CODIS-SERVER-127.0.0.1-17000

/data/codis/redis/bin/redis-cli -h 127.0.0.1 -p 6382 -a debug info output:

# Server
redis_version:3.0.7
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:9f556a5210787dc6
redis_mode:standalone
os:Linux 3.10.0-327.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.5
process_id:29754
run_id:39a526234df3b8899b1bfed85a52140f9c9df71c
tcp_port:6382
uptime_in_seconds:1344147
uptime_in_days:15
hz:10
lru_clock:12540447
config_file:/usr/local/redis/etc/redis_6382.conf

# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:814936
used_memory_human:795.84K
used_memory_rss:8044544
used_memory_peak:816000
used_memory_peak_human:796.88K
used_memory_lua:36864
mem_fragmentation_ratio:9.87
mem_allocator:jemalloc-3.6.0

# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1487591308
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok

# Stats
total_connections_received:543
total_commands_processed:598
instantaneous_ops_per_sec:0
total_net_input_bytes:10182
total_net_output_bytes:986668
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0

# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:1056.52
used_cpu_user:442.59
used_cpu_sys_children:0.00
used_cpu_user_children:0.00

# Cluster
cluster_enabled:0

# Keyspace
pavelnemirovsky commented 7 years ago

Can u send me your config ? redis_6382.conf ?

pavelnemirovsky commented 7 years ago

i have strange feeling that your redis don't have a config_file defined. can u please restart redis-server instance and make sure that config file is defined. Thx

pavelnemirovsky commented 7 years ago

I created new debugging branch please run following command again: bx_redis_discovery.sh general debug

pavelnemirovsky commented 7 years ago

https://github.com/pavelnemirovsky/zabbix-redis-template/tree/debuging