zabbix_export:
  version: '6.4'
  template_groups:
    - uuid: c6d908d09e8b418db434076bd2db05d1
      name: 'Glaber processes info'
  templates:
    - uuid: ddedc8e8d17649c697657e885228f37c
      template: 'Glaber process info'
      name: 'Glaber process info'
      description: |
        information about Glaber processes:
        - heap_usage size
      groups:
        - name: 'Glaber processes info'
      items:
        - uuid: 568682d95eaa461b90cefda0a482b7ba
          name: 'Process full info'
          type: INTERNAL
          key: 'internal[proc_stat]'
          history: '0'
          value_type: TEXT
        - uuid: 87580cd3ed984aa8b17e3a787959db6b
          name: 'Proc stat by proc name'
          type: DEPENDENT
          key: proc_stat_by_proc
          delay: '0'
          history: '0'
          value_type: TEXT
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var objs = JSON.parse(value);
                  var result_stat = {};
                  
                  for (i = 0, n = objs.length; i < n; i++) {
                     val = objs[i];
                     procid = val['procid'];
                     result_stat[procid] = objs[i];
                  }
                  
                  return JSON.stringify(result_stat);
                  
          master_item:
            key: 'internal[proc_stat]'
      discovery_rules:
        - uuid: 5f494c1f3e2346d2bb6d1e9e0d724e3f
          name: 'Processes discovery'
          type: DEPENDENT
          key: procs_discovery
          delay: '0'
          lifetime: 1h
          item_prototypes:
            - uuid: 32f838eb00e346fda197dcfa69f9eed0
              name: '{#PROCID} heap usage'
              type: DEPENDENT
              key: 'heap_usage[{#PROCID}]'
              delay: '0'
              history: '3600'
              trends: '86400'
              units: b
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.{#PROCID}.heap_usage'
              master_item:
                key: proc_stat_by_proc
          master_item:
            key: 'internal[proc_stat]'
          lld_macro_paths:
            - lld_macro: '{#PROCID}'
              path: $.procid
