Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-7925

Trapper item doesn't work with user macros in parameters

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.2.0, 2.2.1
    • Server (S)

      When setting up a Zabbix trapper item, it looks like macros in the key parameters are not expanded properly to match.

      Example:
      Name: traptest
      User macros: {$TESTMACRO} = macro
      (see zabbix01_Configuration_of_hosts_-_2014-03-10_17.19.29.png & zabbix01_Configuration_of_hosts_-_2014-03-10_17.20.05.png)
      Items:
      Name: Trapper test - fixed
      Type: Zabbix trapper
      Key: trap.test[fixed]
      Type of information: Numeric (unsigned)
      Application: Trapper Tests
      (see abbix01_Configuration_of_items_-_2014-03-10_17.20.51.png)
      Name: Trapper test - macro
      Type: Zabbix trapper
      Key: trap.test[{$TESTMACRO}]
      Type of information: Numeric (unsigned)
      Application: Trapper Tests
      (see zabbix01_Configuration_of_items_-_2014-03-10_17.21.01.png)
      

      When I send data to the server for these traps, the fixed one works and the macro-based one fails:

      $ zabbix_sender -z 172.16.70.50 -k trap.test[fixed] -o 1 -s trapstest -vv
      zabbix_sender [2864]: DEBUG: answer [{
              "response":"success",
              "info":"processed: 1; failed: 0; total: 1; seconds spent: 0.000115"}]
      info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000115"
      sent: 1; skipped: 0; total: 1
      

      Server debug log:

      22722:20140310:145106.981 trapper #2 [processing data]
       22722:20140310:145106.983 Trapper got [{
              "request":"sender data",
              "data":[
                      {
                              "host":"trapstest",
                              "key":"trap.test[fixed]",
                              "value":"1"}]}] len 111
       22722:20140310:145106.983 In recv_agenthistory()
       22722:20140310:145106.983 In process_hist_data()
       22722:20140310:145106.983 In process_mass_data()
       22722:20140310:145106.983 In substitute_simple_macros() data:EMPTY
       22722:20140310:145106.983 End of process_mass_data()
       22722:20140310:145106.983 End of process_hist_data():SUCCEED
       22722:20140310:145106.983 In zbx_send_response()
       22722:20140310:145106.983 zbx_send_response() '{
              "response":"success",
              "info":"processed: 1; failed: 0; total: 1; seconds spent: 0.000115"}'
       22722:20140310:145106.983 End of zbx_send_response():SUCCEED
       22722:20140310:145106.984 End of recv_agenthistory()
       22722:20140310:145106.984 trapper #2 [processed data in 0.002810 sec, waiting for connection]
      
      $ zabbix_sender -z 172.16.70.50 -k trap.test[macro] -o 1 -s trapstest -vv
      zabbix_sender [2892]: DEBUG: answer [{
              "response":"success",
              "info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000062"}]
      info from server: "processed: 0; failed: 1; total: 1; seconds spent: 0.000062"
      sent: 1; skipped: 0; total: 1
      

      Server debug log:

      22722:20140310:145126.037 trapper #2 [processing data]
       22722:20140310:145126.039 Trapper got [{
              "request":"sender data",
              "data":[
                      {
                              "host":"trapstest",
                              "key":"trap.test[macro]",
                              "value":"1"}]}] len 111
       22722:20140310:145126.039 In recv_agenthistory()
       22722:20140310:145126.039 In process_hist_data()
       22722:20140310:145126.039 In process_mass_data()
       22722:20140310:145126.039 End of process_mass_data()
       22722:20140310:145126.039 End of process_hist_data():SUCCEED
       22722:20140310:145126.039 In zbx_send_response()
       22722:20140310:145126.039 zbx_send_response() '{
              "response":"success",
              "info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000062"}'
       22722:20140310:145126.039 End of zbx_send_response():SUCCEED
       22722:20140310:145126.039 End of recv_agenthistory()
       22722:20140310:145126.039 trapper #2 [processed data in 0.002319 sec, waiting for connection]
      

      If I change the trapper item to use the key "trap.test[macro]", the second zabbix_sender command works.

            Unassigned Unassigned
            fontim Tim Jones
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: