| Server IP : 68.178.202.69 / Your IP : 216.73.216.174 Web Server : Apache System : Linux 69.202.178.68.host.secureserver.net 3.10.0-1160.139.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Nov 3 13:30:41 UTC 2025 x86_64 User : ikioworld ( 1005) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/fm-agent/plugins/ |
Upload File : |
import agent_util
class PostfixPlugin(agent_util.Plugin):
textkey = "postfix"
label = "Postfix"
@classmethod
def get_metadata(self, config):
status = agent_util.SUPPORTED
msg = None
# check if mailq is even installed
installed = agent_util.which("mailq")
if not installed:
self.log.info("mailq binaries not found")
status = agent_util.UNSUPPORTED
msg = "mailq not found"
return {}
if status is agent_util.SUPPORTED:
try:
ret, output = agent_util.execute_command("mailq")
if ret != 0:
raise Exception
except:
self.log.error("couldn't get postfix status")
status = agent_util.MISCONFIGURED
msg = "Couldn't get postfix status, make sure mail system is running "
return {}
data = {
"postfix.queue_size": {
"label": "Postfix queue size",
"options": None,
"status": status,
"error_message": msg,
"unit": "kB",
},
"postfix.requests": {
"label": "Number of requests",
"options": None,
"status": status,
"error_message": msg,
"unit": "requsts",
},
}
return data
def check(self, textkey, data, config):
try:
res = 0
ret, output = agent_util.execute_command("mailq | tail -n 1")
self.log.debug("mailq | tail -n 1: %s" % str(output))
if ret == 0:
output = output.strip().replace("--", "").replace(".", "")
if textkey == "postfix.queue_size":
res = output.split("Kbytes")[0]
else:
res = output.split("in")[-1].split("Request")[0]
res = int(res)
except:
res = 0
return res