-
Problem report
-
Resolution: Fixed
-
Trivial
-
4.4.8
-
None
-
Centos 7/8
-
Sprint 71 (Dec 2020), Sprint 72 (Jan 2021)
-
1
Steps to reproduce:
- Use a UserParameter as follows:
UserParameter=a.b.c[*],psql -h $1 -U $2 -d $2 -c 'SELECT count(*) FROM x.y WHERE "Type" IN ($4)' -x | grep count | awk '{print $$3}'
- In this way awk used to filter out only the resulting number of the sql-count.
- As you can see, I used a double $$ to 'escape' the awk variable, as this variable number overlaps with the number of variables sent to the UserParameter
- This worked fine in the old agent, but not anymore in agent2
Result:
The result when using
awk '{print $$3}'
is that awk isn't invoked and I get the complete row, as filtered by grep: "count | 123".
The result when using
awk '{print \$3}'
is that I get the actual password sent to the UserParameter, which is the $3-parameter.
Expected:
I'd expect similar behaviour of agent2 when working with external variables in UserParameters.
If the way of escaping has changed, I expect to see a notification of this change + the proper way of escaping in the documentation.
- is duplicated by
-
ZBX-18568 Bad handling of double dollar ($$) in user parameters
- Closed