zabbix_export: version: '5.4' date: '2021-11-21T21:34:24Z' groups: - uuid: 0e60ac85bc3941e2a1d66a048ff164da name: UPS templates: - uuid: a1a794b4d2ba494c80d164e30bb1bc3e template: 'APC Smart-UPS through apcupsd and ssh' name: 'APC Smart-UPS through apcupsd and ssh' description: | ## Overview This template is for situation when you have apcupsd, but cannot install zabbix agent. Tested with Centos 6.x. You have to install apcupsd and configure it, configure ssh access for user by certificate. Provides: Items: model, serial number, number of switching (xfers), name (set in apcupsd config), status (ONLINE and etc), charge level, timeleft. Triggers: minimal timeleft is equal or less then {$APC\_SMARTUPS\_MINIMAL\_TIMELEFT}, status is not ONLINE. Requires macroses: {$UPS\_GET\_MAININFO\_PERIOD} - period of getting model and etc. {$UPS\_GET\_STATUS\_PERIOD} – period of getting status, timeleft, status. {$APC\_SMARTUPS\_MINIMAL\_TIMELEFT} –minimal timeleft for trigger. {$SSH\_CONNECT\_USERNAME} – user for connecting by ssh. If you have any ideas to make this template better, comment, please. groups: - name: UPS items: - uuid: 0a8dff2e99bd4c559f8f8acc7ba5cb6c name: 'apc battery charge level' type: DEPENDENT key: apc_battery.chargelevel delay: '0' history: 30d trends: 90d preprocessing: - type: REGEX parameters: - 'BCHARGE\s*:(\s*)+(\d+)' - \2 master_item: key: 'ssh.run[apc_device.statusinfo]' tags: - tag: Application value: 'APC UPC Battery Info' - uuid: 55938541241446dca811e621c9409cc4 name: 'apc battery timeleft' type: DEPENDENT key: apc_battery.timeleft delay: '0' history: 30d trends: 90d preprocessing: - type: REGEX parameters: - 'TIMELEFT\s*:(\s*)+(\d+)' - \2 master_item: key: 'ssh.run[apc_device.statusinfo]' tags: - tag: Application value: 'APC UPC Battery Info' triggers: - uuid: 0abb87a62b3f4483809a38a9dcb8aaad expression: 'last(/APC Smart-UPS through apcupsd and ssh/apc_battery.timeleft)={$APC_SMARTUPS_MINIMAL_TIMELEFT} or last(/APC Smart-UPS through apcupsd and ssh/apc_battery.timeleft)<{$APC_SMARTUPS_MINIMAL_TIMELEFT}' name: 'apc timeleft is {ITEM.LASTVALUE} on {HOST.HOST}' priority: HIGH manual_close: 'YES' - uuid: e7236226f78347ae8c759e6d37e5b1e7 name: 'apc device model' type: DEPENDENT key: apc_device.model delay: '0' history: 30d trends: '0' value_type: TEXT preprocessing: - type: REGEX parameters: - 'MODEL\s*:(\s*)+(.+)' - \2 master_item: key: 'ssh.run[apc_device.info]' tags: - tag: Application value: 'APC UPC Device Info' - uuid: 57f8cd9d59ef4a479c8bd7e2bf6b9b9a name: 'apc device name' type: DEPENDENT key: apc_device.name delay: '0' history: 30d trends: '0' value_type: TEXT inventory_link: SITE_NOTES preprocessing: - type: REGEX parameters: - 'UPSNAME\s*:(\s*)+(.+)' - \2 master_item: key: 'ssh.run[apc_device.info]' tags: - tag: Application value: 'APC UPC Device Info' - uuid: f8a8b3e34216414f809969e8fc6bfa5c name: 'apc device numxfers' type: DEPENDENT key: apc_device.numxfers delay: '0' history: 30d trends: 90d preprocessing: - type: REGEX parameters: - 'NUMXFERS\s*:(\s*)+(.+)' - \2 master_item: key: 'ssh.run[apc_device.info]' tags: - tag: Application value: 'APC UPC Device Info' - uuid: 1324ba0d31e44931a0eb1a8ae33a9e15 name: 'apc device serial number' type: DEPENDENT key: apc_device.sn delay: '0' history: 30d trends: '0' value_type: TEXT preprocessing: - type: REGEX parameters: - 'SERIALNO\s*:(\s*)+(.+)' - \2 master_item: key: 'ssh.run[apc_device.info]' tags: - tag: Application value: 'APC UPC Device Info' - uuid: bdbb37859dd649e2a88d3a379882a16b name: 'apc device status' type: DEPENDENT key: apc_device.status delay: '0' history: 30d trends: '0' value_type: TEXT preprocessing: - type: REGEX parameters: - 'STATUS\s*:(\s*)+(.+)' - \2 master_item: key: 'ssh.run[apc_device.statusinfo]' tags: - tag: Application value: 'APC UPC Device Info' triggers: - uuid: 37d74c3bc29b45ff808ecb3ea88f55e3 expression: 'find(/APC Smart-UPS through apcupsd and ssh/apc_device.status,,"like","ONLINE")<>1' name: 'apc status is {ITEM.LASTVALUE} on {HOST.HOST}' priority: HIGH manual_close: 'YES' - uuid: 67224e433f3c4606987f8b68f42765f7 name: 'apc device info' type: SSH key: 'ssh.run[apc_device.info]' delay: '{$UPS_GET_MAININFO_PERIOD}' history: 0d trends: '0' value_type: TEXT params: '/sbin/apcaccess | /bin/egrep ''STATUS :|BCHARGE :|TIMELEFT :|UPSNAME''' authtype: PUBLIC_KEY username: '{$SSH_CONNECT_USERNAME}' publickey: id_rsa.pub privatekey: id_rsa tags: - tag: Application value: 'APC UPC Device Info' - uuid: 86ed710d66ce4c98844a4f13dacd0fd2 name: 'apc device status info' type: SSH key: 'ssh.run[apc_device.statusinfo]' delay: '{$UPS_GET_STATUS_PERIOD}' history: 0d trends: '0' value_type: TEXT params: '/sbin/apcaccess | /bin/egrep ''STATUS :|BCHARGE :|TIMELEFT :''' authtype: PUBLIC_KEY username: '{$SSH_CONNECT_USERNAME}' publickey: id_rsa.pub privatekey: id_rsa tags: - tag: Application value: 'APC UPC Device Info'