Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /opt/prometheus-monitoring-scripts/lib/python3.10/site-packages/custom_exporters/mailq/ |
Upload File : |
import os from ..base import BaseExporter POSTFIX_QUEUES = ["active", "bounce", "deferred", "incoming", "maildrop"] class CustomExporter(BaseExporter): def metric_config(self): return { "postfix_queue_size": {"type": "Gauge", "labels": ["queue"]}, } def generate(self): postfix_queue_size = self.metrics.get('postfix_queue_size') for queue in POSTFIX_QUEUES: path = os.path.join("/var/spool/postfix", queue) count = sum(len(files) for _, _, files in os.walk(path)) postfix_queue_size.labels(queue).set(count)