MSV FM

[email protected]: ~ $
Path : /lib/fm-agent/plugins/
File Upload :
Current < : //lib/fm-agent/plugins/postfix.py

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


Bethany
Bethany
0%

THE FINEST HOTEL NEAR LAKE KIVU

The Perfect Base For You

Required fields are followed by *





EC1A68011

About Us

Delicious Interior With The Pinch Of Everything

Bethany Investment group is Presbyterian church in Rwanda(EPR) company that manage Hotel and Guest house in Karongi (Bethany Hotel), ISANO branch in GIKONDO(Kigali), Kiyovu branch(Kigali), AMIZERO branch(Nyagatare-East) and Gisenyi Branch(Rubavu).

Accomodation

Get a Comfortable Room
Feel The Comfort

Get a comfortable room and feel our hotel’s comfort. Bethany Hotel features a variety of fully furnished rooms with extra space, Executive rooms, Deluxe rooms with a beautiful lake view and garden space, Deluxe rooms, comfort rooms, family rooms and standard rooms at your service.

Standard Single

Services

We Provide Top Class Facility
Especially For You

Beach BBQ Party

Kick back on the beach& and enjoy our berbecue from our masterchef

Breakfast

Kick back at our hotels& enjoy our breakfast from our masterchef

Conference Hall

Kick back at our hotels& enjoy our conference halls from all bethany branches

Enjoy with your partner

Honeymoon Package

80%

Get In Touch

Don’t Miss Any Update

    +

    Search your Room

    Required fields are followed by *