zabbix_export:
  version: '6.0'
  date: '2023-10-17T20:27:11Z'
  groups:
    - uuid: 22941f4e01294888a9bed3aae15f6ef9
      name: Templates/AWNET
  templates:
    - uuid: d9ed1ecc0bc14cafb7fcbd309ad9a944
      template: 'AWNET Linux Template'
      name: 'AWNET Linux Template'
      groups:
        - name: Templates/AWNET
      items:
        - uuid: 85da57ac953f48c5a1e08f74fb2b65d5
          name: 'Пакеты к обновлению'
          key: aw.linux.apt.updatable
          delay: 15m
          trends: '0'
          value_type: TEXT
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var buf = value.split('\n');
                  var res = "";
                     
                  var re_test = [
                    /^WARNING:/,
                    /^Вывод списка/,
                    /^Listing\.\.\./,
                  ];
                  
                  var flag;
                  for (var i in buf) {
                    flag = true;
                    for (var j in re_test) {
                      if (re_test[j].test(buf[i])) {
                        flag = false
                        break;
                      }
                    }
                    
                    if (flag && buf[i].length > 0) {
                      res += buf[i] + "\n";
                    }
                  }
                  
                  return res
            - type: NOT_MATCHES_REGEX
              parameters:
                - '^ *$'
              error_handler: DISCARD_VALUE
          tags:
            - tag: Module
              value: 'Система пакетов'
          triggers:
            - uuid: 9a2fbf76b8f44d45b8a987c1997de212
              expression: 'nodata(/AWNET Linux Template/aw.linux.apt.updatable,30m)=0'
              name: 'Появились обновления системы'
              opdata: '{ITEM.VALUE}'
              priority: WARNING
        - uuid: 33c23ce59f3c49068057013b35ffb849
          name: 'Ошибка в системном журнале'
          key: 'aw.linux.journalctl[2]'
          delay: 2m
          trends: '0'
          value_type: TEXT
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var buf = value.split('\n');
                  var res = "";
                     
                  var re_test = [
                    new RegExp('^-- Journal begins'),
                    new RegExp('^-- No entries --'),
                    new RegExp('[0-9]{2} [0-9:]{8} [a-zA-Z0-9._-]* sudo\[[0-9]*\]: '),
                    new RegExp('CONFIG: restrict nopeer ignored'),
                    new RegExp('statistics directory /var/log/ntpsec/ does not exist or is unwriteable, error No such file or directory'),
                    new RegExp('error\: kex_exchange_identification\: Connection closed by remote host'),
                    new RegExp('error\: maximum authentication attempts exceeded for [^ ]* from [a-f0-9.:-]* port [0-9]+ ssh[0-9]*'),
                    new RegExp('error\: kex_exchange_identification\: client sent invalid protocol identifier "[^"]*"'),
                    new RegExp('error\: beginning MaxStartups throttling'),
                    new RegExp('error\: kex_exchange_identification\: read\: Connection reset by peer'),
                    new RegExp('fatal\: Timeout before authentication for [a-zA-Z.:0-9-]+ port [0-9]+'),
                    new RegExp('error\: kex_exchange_identification\: banner line contains invalid characters'),
                    new RegExp('error\: maximum authentication attempts exceeded for invalid user [a-zA-Z0-9_.-]+ from [0-9a-f:.]+ port [0-9]+ ssh[0-9]*'),
                    new RegExp('fatal\: userauth_pubkey\: parse request failed: incomplete message'),
                    new RegExp('sshd\[[0-9]*\]\: error\: Protocol major versions differ\: [0-9]+ vs\. [0-9]+'),
                    new RegExp('sshd\[[0-9]*\]\: fatal\: userauth_finish\: Broken pipe \\[preauth\\]'),
                    new RegExp('openvpn\[[0-9]*\]\: [0-9.:a-fA-F]* Connection reset, restarting \\[[0-9]\\]'),
                    new RegExp('/system\.journal\: Journal header limits reached or header out-of-date, rotating\.'),
                  ];
                  
                  var flag;
                  for (var i in buf) {
                    flag = true;
                    for (var j in re_test) {
                      if (re_test[j].test(buf[i])) {
                        flag = false
                        break;
                      }
                    }
                    
                    if (flag) {
                      res += buf[i] + "\n";
                    }
                  }
                  
                  return res
            - type: NOT_MATCHES_REGEX
              parameters:
                - '^ *$'
              error_handler: DISCARD_VALUE
          tags:
            - tag: Module
              value: 'Системный журнал'
          triggers:
            - uuid: e8001f72a356424ea8e83abfd2a83c63
              expression: 'nodata(/AWNET Linux Template/aw.linux.journalctl[2],5m)=0'
              name: 'Ошибки в системном журнале'
              opdata: '{ITEM.VALUE}'
              priority: WARNING
