zabbix_export: version: '7.0' template_groups: - uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6 name: Templates/Applications templates: - uuid: de38542cf4f24fafab33520677f392c4 template: 'Website certificate by Zabbix agent 2 active' name: 'Website certificate by Zabbix agent 2 active' description: | The template to monitor TLS/SSL certificate on the website by Zabbix agent 2 that works without any external scripts. Zabbix agent 2 with the WebCertificate plugin requests certificate using the web.certificate.get key and returns JSON with certificate attributes. You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/428309-discussion-thread-for-official-zabbix-template-tls-ssl-certificates-monitoring Generated by official Zabbix template tool "Templator" vendor: name: Zabbix version: 7.0-1 groups: - name: Templates/Applications items: - uuid: adad17766cd84e6cb5966b26c79bebbc name: 'Subject alternative name' type: DEPENDENT key: cert.alternative_names delay: '0' value_type: TEXT trends: '0' description: 'The subject alternative name extension allows identities to be bound to the subject of the certificate. These identities may be included in addition to or in place of the identity in the subject field of the certificate. Defined options include an Internet electronic mail address, a DNS name, an IP address, and a Uniform Resource Identifier (URI).' preprocessing: - type: JSONPATH parameters: - $.x509.alternative_names master_item: key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' tags: - tag: component value: cert - uuid: 7095e5e326ae4f29b86e281d8fc24afc name: Issuer type: DEPENDENT key: cert.issuer delay: '0' value_type: TEXT trends: '0' description: 'The field identifies the entity that has signed and issued the certificate.' preprocessing: - type: JSONPATH parameters: - $.x509.issuer master_item: key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' tags: - tag: component value: cert - uuid: dd0cdc1cf7d0430cb3e7601a68df1aed name: 'Last validation status' type: DEPENDENT key: cert.message delay: '0' value_type: TEXT trends: '0' description: 'Last check result message.' preprocessing: - type: JSONPATH parameters: - $.result.message master_item: key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' tags: - tag: component value: cert - uuid: 4a1b4f5d6bb64e0389c6a206b0d3749e name: 'Expires on' type: DEPENDENT key: cert.not_after delay: '0' units: unixtime description: 'The date on which the certificate validity period ends.' preprocessing: - type: JSONPATH parameters: - $.x509.not_after.timestamp master_item: key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' tags: - tag: component value: cert triggers: - uuid: 1f7fc868d3ad428f8114278a4f27c77e expression: '(last(/Website certificate by Zabbix agent 2 active/cert.not_after) - now()) / 86400 < {$CERT.EXPIRY.WARN}' name: 'Certificate: SSL certificate expires soon' event_name: 'Certificate: SSL certificate expires soon (less than {$CERT.EXPIRY.WARN} days)' priority: WARNING description: 'The SSL certificate should be updated or it will become untrusted.' dependencies: - name: 'Certificate: SSL certificate is invalid' expression: 'find(/Website certificate by Zabbix agent 2 active/cert.validation,,"like","invalid")=1' tags: - tag: scope value: notice - uuid: 3df42217148c45888f9cda3e8a273ad6 name: 'Valid from' type: DEPENDENT key: cert.not_before delay: '0' units: unixtime description: 'The date on which the certificate validity period begins.' preprocessing: - type: JSONPATH parameters: - $.x509.not_before.timestamp master_item: key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' tags: - tag: component value: cert - uuid: d4f08f2bcb104036bede781b3c693ce4 name: 'Public key algorithm' type: DEPENDENT key: cert.public_key_algorithm delay: '0' value_type: CHAR trends: '0' description: 'The digital signature algorithm is used to verify the signature of a certificate.' preprocessing: - type: JSONPATH parameters: - $.x509.public_key_algorithm master_item: key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' tags: - tag: component value: cert - uuid: b799fe9cde49472996debe89e32f9161 name: 'Serial number' type: DEPENDENT key: cert.serial_number delay: '0' value_type: CHAR trends: '0' description: 'The serial number is a positive integer assigned by the CA to each certificate. It is unique for each certificate issued by a given CA. Non-conforming CAs may issue certificates with serial numbers that are negative or zero.' preprocessing: - type: JSONPATH parameters: - $.x509.serial_number master_item: key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' tags: - tag: component value: cert - uuid: bb13668b3dac4ef789ab90eb6e04da1f name: Fingerprint type: DEPENDENT key: cert.sha1_fingerprint delay: '0' value_type: CHAR trends: '0' description: 'The Certificate Signature (SHA1 Fingerprint or Thumbprint) is the hash of the entire certificate in DER form.' preprocessing: - type: JSONPATH parameters: - $.sha1_fingerprint master_item: key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' tags: - tag: component value: cert triggers: - uuid: 59089233c1ed4aa2b9316ccd9e443c49 expression: 'last(/Website certificate by Zabbix agent 2 active/cert.sha1_fingerprint) <> last(/Website certificate by Zabbix agent 2 active/cert.sha1_fingerprint,#2)' name: 'Certificate: Fingerprint has changed' event_name: 'Certificate: Fingerprint has changed (new version: {ITEM.VALUE})' priority: INFO description: | The SSL certificate fingerprint has changed. If you did not update the certificate, it may mean your certificate has been hacked. Acknowledge to close the problem manually. There could be multiple valid certificates on some installations. In this case, the trigger will have a false positive. You can ignore it or disable the trigger. manual_close: 'YES' tags: - tag: scope value: notice - uuid: 42c021f833e344ff86fd75d5fcc67f23 name: 'Signature algorithm' type: DEPENDENT key: cert.signature_algorithm delay: '0' value_type: CHAR trends: '0' description: 'The algorithm identifier for the algorithm used by the CA to sign the certificate.' preprocessing: - type: JSONPATH parameters: - $.x509.signature_algorithm master_item: key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' tags: - tag: component value: cert - uuid: 4ce885041af04d52943dbc137a419c04 name: Subject type: DEPENDENT key: cert.subject delay: '0' value_type: TEXT trends: '0' description: 'The field identifies the entity associated with the public key stored in the subject public key field.' preprocessing: - type: JSONPATH parameters: - $.x509.subject master_item: key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' tags: - tag: component value: cert - uuid: 5722c8d0794a4f948cec737a80a2f646 name: 'Validation result' type: DEPENDENT key: cert.validation delay: '0' value_type: CHAR trends: '0' description: 'The certificate validation result. Possible values: valid/invalid/valid-but-self-signed' preprocessing: - type: JSONPATH parameters: - $.result.value master_item: key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' tags: - tag: component value: cert triggers: - uuid: faccfa7095aa4708bf6e1d60b2b57b1b expression: 'find(/Website certificate by Zabbix agent 2 active/cert.validation,,"like","invalid")=1' name: 'Certificate: SSL certificate is invalid' priority: HIGH description: 'SSL certificate has expired or it is issued for another domain.' tags: - tag: scope value: security - uuid: 5f7e2edfa6e24fd0a8608b8a2423b183 name: Version type: DEPENDENT key: cert.version delay: '0' value_type: CHAR trends: '0' description: 'The version of the encoded certificate.' preprocessing: - type: JSONPATH parameters: - $.x509.version master_item: key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' tags: - tag: component value: cert - uuid: cfc056393df34d3ab8f66f1d1bfc7c0b name: Get type: ZABBIX_ACTIVE key: 'web.certificate.get[{$CERT.WEBSITE.HOSTNAME},{$CERT.WEBSITE.PORT},{$CERT.WEBSITE.IP}]' delay: 15m history: '0' value_type: TEXT trends: '0' description: 'Returns the JSON with attributes of a certificate of the requested site.' preprocessing: - type: DISCARD_UNCHANGED_HEARTBEAT parameters: - 6h tags: - tag: component value: raw tags: - tag: class value: software - tag: target value: certificate macros: - macro: '{$CERT.EXPIRY.WARN}' value: '7' description: 'Number of days until the certificate expires.' - macro: '{$CERT.WEBSITE.HOSTNAME}' value: '' description: 'The website DNS name for the connection.' - macro: '{$CERT.WEBSITE.IP}' description: 'The website IP address for the connection.' - macro: '{$CERT.WEBSITE.PORT}' value: '443' description: 'The TLS/SSL port number of the website.'