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

LC_ALL=en_US.UTF-8 locale on server causes issue for vmware monitoring - Cannot parse DateTime value

XMLWordPrintable

    • Sprint 46, Nov 2018
    • 0.125

      Zabbix server generates an request, having these XML tags:

      <ns0:startTime>2018-11-06T08:14:33 AMZ</ns0:startTime>
      

      which causes lots of such errors:

       10763:20181106:111434.165 vmware_service_retrieve_perf_counters() SOAP response: <?xml version="1.0" encoding="UTF-8"?>
      <soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
       xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
      <soapenv:Fault><faultcode>ServerFaultCode</faultcode><faultstring>
      Cannot parse &quot;2018-11-06T08:14:33 AMZ&quot; as a DateTime value
      
      while parsing serialized value of type vmodl.DateTime
      at line 1, column 415
      
      while parsing property &quot;startTime&quot; of static type dateTime
      
      while parsing serialized DataObject of type vim.PerformanceManager.QuerySpec
      at line 1, column 345
      
      while parsing call information for method QueryPerf
      at line 1, column 274
      
      while parsing SOAP body
      at line 1, column 264
      
      while parsing SOAP envelope
      at line 1, column 38
      
      while parsing HTTP request for method queryStats
      on object of type vim.PerformanceManager
      at line 1, column 0</faultstring><detail><InvalidRequestFault xmlns="urn:vim25" xsi:type="InvalidRequest"></InvalidRequestFault></detail></soapenv:Fault>
      </soapenv:Body>
      </soapenv:Envelope>
       10763:20181106:111434.166 End of vmware_service_retrieve_perf_counters()
      

      It was a puzzle what the AMZ timezone is. Later we spot that it changed to PMZ and we understood that it's related to en_US locale, where we know about AM/PM.

      Yes, our zabbix server is configured to have LC_ALL=en_US.UTF-8 locale

      Related code is:

      			{
      				time_t	st_raw;
      				struct	tm st;
      				char	st_str[ZBX_XML_DATETIME];
      
      				/* add startTime for entity performance counter request for decrease XML data load */
      				st_raw = zbx_time() - SEC_PER_HOUR;
      				st = *gmtime(&st_raw);
      				strftime(st_str, sizeof(st_str), "%Y-%m-%dT%XZ", &st);
      				zbx_snprintf_alloc(&tmp, &tmp_alloc, &tmp_offset, "<ns0:startTime>%s</ns0:startTime>",
      						st_str);
      			}
      

      where %X is probably a mistake, better option would be %T to have timestamp in  ISO 8601
      http://man7.org/linux/man-pages/man3/strftime.3.html

      mentioned code was implemented in -ZBX-12990-

      We changed in is sources (changing %X to %T), recompiled and it resolved our issue.

       

      The fix tested on VMware 6.0 and 6.7

            MVekslers Michael Veksler
            zalex_ua Oleksii Zagorskyi
            Team A
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: