[ZBXNEXT-2008] Triggers with user macro not correctly transmitted to script Created: 2013 Apr 24 Updated: 2016 Mar 22 |
|
Status: | Reopened |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Agent (G), Frontend (F), Server (S) |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Change Request | Priority: | Critical |
Reporter: | Andrei Gushchin (Inactive) | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 1 |
Labels: | actions, trigger, usermacros | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Zabbix 2.0.6, Mysql server |
Issue Links: |
|
Description |
I have follow trigger with User Macro in name:
All logs see in comments. |
Comments |
Comment by Andrei Gushchin (Inactive) [ 2013 Apr 24 ] |
On Server log: 31628:20130424:181051.289 In substitute_simple_macros() data:'/usr/local/share/zabbix/externalscripts/test1.py "Trigger name: {TRIGGER.NAME.ORIG}"' 31628:20130424:181051.289 End substitute_simple_macros() data:'/usr/local/share/zabbix/externalscripts/test1.py "Trigger name: name {$TEST1}"' 31628:20130424:181051.289 In zbx_execute_script() 31628:20130424:181051.289 In zbx_execute_script_on_agent() 31628:20130424:181051.289 In substitute_simple_macros() data:'10050' 31628:20130424:181051.289 In get_value_agent() host:'Zabbix server' addr:'127.0.0.1' key:'system.run["/usr/local/share/zabbix/externalscripts/test1.py \"Trigger name: name {$TEST1}\"","nowait"]' 31628:20130424:181051.289 Sending [system.run["/usr/local/share/zabbix/externalscripts/test1.py \"Trigger name: name {$TEST1}\"","nowait"] ] 31628:20130424:181051.291 get value from agent result: '1' 31628:20130424:181051.291 End of zbx_execute_script_on_agent():SUCCEED 31628:20130424:181051.291 End of zbx_execute_script():SUCCEED 31628:20130424:181051.291 In add_command_alert() 31628:20130424:181051.291 In DCget_nextid() table:'alerts' num:1 31628:20130424:181051.291 End of DCget_nextid() table:'alerts' [29:29] 31628:20130424:181051.291 query [txnlev:1] [insert into alerts (alertid,actionid,eventid,clock,message,status,error,alerttype,esc_step) values (29,5,14462,1366805451,'Zabbix server:/usr/local/share/zabbix/externalscripts/test1.py "Trigger name: name {$TEST1}"',1,'',1,1)] If i run script throw zabbix server 12631:20130424:221255.657 In substitute_simple_macros() data:'/usr/local/share/zabbix/externalscripts/test1.py "Trigger name: {TRIGGER.NAME.ORIG}"' 12631:20130424:221255.657 End substitute_simple_macros() data:'/usr/local/share/zabbix/externalscripts/test1.py "Trigger name: name {$TEST1}"' 12631:20130424:221255.657 In zbx_execute_script() 12631:20130424:221255.657 In zbx_popen() command:'/usr/local/share/zabbix/externalscripts/test1.py "Trigger name: name {$TEST1}"' 12631:20130424:221255.658 End of zbx_popen():6 12631:20130424:221255.658 In zbx_waitpid() 13741:20130424:221255.658 zbx_popen(): executing script 12631:20130424:221255.668 zbx_waitpid() exited, status:0 If I run script throw zabbix agent 10379:20130424:181051.289 Processing request. 10379:20130424:181051.289 Requested [system.run["/usr/local/share/zabbix/externalscripts/test1.py \"Trigger name: name {$TEST1}\"","nowait"]] 10379:20130424:181051.289 Executing command '/usr/local/share/zabbix/externalscripts/test1.py "Trigger name: name {$TEST1}"' 10379:20130424:181051.290 Sending back [1] Actually args in script output(simple script write itself args to file): ['/usr/local/share/zabbix/externalscripts/test1.py', 'Trigger name: name {}' As you can see macros was lost when zabbix server(agent) execute script. |
Comment by Andrei Gushchin (Inactive) [ 2013 Apr 24 ] |
This problem is related from |
Comment by richlv [ 2013 Apr 24 ] |
what's the deal with usermacros {$TEST1} vs {$TEST} ? |
Comment by Andrei Gushchin (Inactive) [ 2013 Apr 24 ] |
Sorry it was typo. Actually {$TEST1} |
Comment by Alexander Vladishev [ 2013 Apr 25 ] |
Andrei, User Macro equal {$TEST1} -> gantest This information is related to this problem? I didn't understand it. |
Comment by Andrei Gushchin (Inactive) [ 2013 Apr 25 ] |
Alexander, Yes it is value of Macros $TEST1. Additional information I change name in trigger to {$$TEST1} ['/usr/local/share/zabbix/externalscripts/test1.py', 'Trigger name: name {26139TEST1}'] As I inderstand it is number of pid. |
Comment by Alexander Vladishev [ 2013 Apr 25 ] |
But, the user macro should remain as is here. I.e. all macros from trigger name should be sent to script without any changes. |
Comment by Andrei Gushchin (Inactive) [ 2013 Apr 25 ] |
I found where was problem.
/usr/bin/python /usr/local/share/zabbix/externalscripts/test1.py 'Trigger name: {TRIGGER.NAME.ORIG}'
And it is work good ['/usr/local/share/zabbix/externalscripts/test1.py', 'Trigger name: name {$TEST1}'] I'll closing this issue, It isn't bug. Thanks. |
Comment by Andrei Gushchin (Inactive) [ 2013 Apr 25 ] |
If expression uses in action throw the script, there is a some problem. action message: Trigger name: ''{TRIGGER.NAME.ORIG}'' in server log when send message: 9664:20130425:172034.832 In zbx_popen() command:'/usr/local/share/zabbix/alertscripts/test.sh "123" "PROBLEM: name gantest" "Trigger name: name {$TEST1}"' shell get it how string with variables, {$TEST1} disappeared in output Trigger name: ''name {}'' I found it in code and do some changes, and It will work: alerter.c: 103: -- zbx_snprintf_alloc(&cmd, &cmd_alloc, &cmd_offset, " \"%s\" \"%s\" \"%s\"", send_to, subject, message); ++ zbx_snprintf_alloc(&cmd, &cmd_alloc, &cmd_offset, " \'%s\' \'%s\' \'%s\'", send_to, subject, message); after in server log: 27816:20130425:183849.634 In zbx_popen() command:'/usr/local/share/zabbix/alertscripts/test.sh '123' 'PROBLEM: name gantest' 'Trigger name: ''name {$TEST1}'''' and output Trigger name: name {$TEST1} I think need more deep testing about this patch. |
Comment by Andrei Gushchin (Inactive) [ 2013 Apr 26 ] |
I have tested shells but it was without result. (zsh,tcsh,ksh) |
Comment by richlv [ 2016 Mar 22 ] |
what's the current state, is there anything to fix or improve in zabbix ? |