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

Running remote command on zabbix app server strips json formatting from arguments

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Won't fix
    • Icon: Trivial Trivial
    • None
    • None
    • None
    • None

      I have configured my agent installers so that it adds a json formatted metadata string to the config file like the one shown below.

      HostMetadata="{"version":"rhel7","account":363748,"os":"RHEL-Cent","osfamily":"Linux","datacenter":"dal13","evault":"true","type":"VSI","objectid":89956126}"

      In my auto registration, I have an action (with no criteria defined to it will run on all hosts as they auto register) defined that runs a remote command locally on the zabbix server. This remote command passes the

      {HOST.HOST}

      ,

      {HOST.IP}

      , and

      {HOST.METADATA}

      to a script that dumps the current time stamp and the variables passed to a log file so I can easily track the autoregistration process.

      #!/bin/bash
      timestamp=`date +%s`
      echo $timestamp `date ` $@ >> /tmp/autoreg.log
      

      The issue that I found is that although the zabbix server receives and saves the full json object to the database

      |          53042 |        12142 | 363748VN51RP001                    | 10.73.223.158  |       10050 |                                | {"version":"rhel7","account":363748,"os":"RHEL-Cent","osfamily":"Linux","datacenter":"dal13","evault":"true","type":"VSI","objectid":89956126}                                                   |

      when it passes the metedata to the script, it strips out the json formatting. (See the output from the log used in the script above)

      1569165618 Sun Sep 22 10:20:18 CDT 2019 1.1 363748VN51RP001 10.73.223.158 version:rhel7 account:363748 os:RHEL-Cent osfamily:Linux datacenter:dal13 evault:true type:VSI objectid:89956126

      This in turn negates the useful nature of preformatting this data so that I can post process it on the zabbix server during auto registration.

            zabbix.support Zabbix Support Team
            cdslaughter Carl Slaughter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: