Details
-
Type:
Problem report
-
Status: Closed
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: 4.4.8
-
Fix Version/s: 5.0.8rc1, 5.2.4rc1, 5.4.0alpha1, 5.4 (plan)
-
Component/s: Agent (G)
-
Labels:None
-
Environment:Centos 7/8
-
Team:Team A
-
Sprint:Sprint 71 (Dec 2020), Sprint 72 (Jan 2021)
-
Story Points:1
Description
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.
Attachments
Issue Links
- is duplicated by
-
ZBX-18568 Bad handling of double dollar ($$) in user parameters
-
- Closed
-