-
Problem report
-
Resolution: Duplicate
-
Trivial
-
None
-
5.0.5, 5.2.1
-
None
-
ubuntu 18.04, amd64
Description
According official documentation about userparameters
To use positional references unaltered, specify a double dollar sign - for example, awk '{print $$2}'. In this case $$2 will actually turn into $2 when executing the command.
in agent v1 it works as documented, but in the agent v2 it doesn't work
userparemeter looks like:
UserParameter=redis_v1.status[*], redis-cli -h 127.0.0.1 -p 6379 info | grep -v _human | awk -F: '/$1/\{print $$2}'
snippet from debug log:
2020/11/11 15:37:07.099587 [1] created direct exporter task for plugin 'UserParameter' itemid:0 key 'redis_v1.status[evicted_keys]' 2020/11/11 15:37:07.099706 executing direct exporter task for key 'redis_v1.status[evicted_keys]' 2020/11/11 15:37:07.099731 [UserParameter] executing command:' redis-cli -h 127.0.0.1 -p 6379 info | grep -v _human | awk -F: '/evicted_keys/\{print $$2}'' 2020/11/11 15:37:07.103809 [UserParameter] command:' redis-cli -h 127.0.0.1 -p 6379 info | grep -v _human | awk -F: '/evicted_keys/\{print $$2}'' length:14 output:'evicted_keys:0' 2020/11/11 15:37:07.103832 executed direct exporter task for key 'redis_v1.status[evicted_keys]'
p.s. I know about built-in redis plugin in agent v2, this is only example for issue.
- duplicates
-
ZBX-18568 Bad handling of double dollar ($$) in user parameters
- Closed