MSV FM

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

import agent_util


class SendmailPlugin(agent_util.Plugin):
    textkey = "sendmail"
    label = "Sendmail"

    @classmethod
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        sendmail_bin = agent_util.which("sendmail")

        # in case sendmail is not in default path for the agent
        if not sendmail_bin:
            sendmail_bin = agent_util.which("/usr/sbin/sendmail")

        if not sendmail_bin:
            self.log.info("couldn't find sendmail binary")
            status = agent_util.UNSUPPORTED
            msg = "Couldn't find sendmail binary"

        # if they have configured sudo, try it first
        if sendmail_bin and config.get("use_sudo", 0):
            if not agent_util.execute_command("sudo -n %s -bp" % sendmail_bin)[0] == 0:
                self.log.error(
                    'Insufficient permission - Enable sudo access for agent user on sendmail.')
                status = agent_util.UNSUPPORTED
                msg = "SUDO access not configured for fm-agent user"

        data = {
            "queue_depth": {
                "label": "Sendmail queue depth",
                "options": None,
                "status": status,
                "error_message": msg
            }
        }

        return data

    def check(self, textkey, data, config={}):

        sendmail_bin = agent_util.which("sendmail", exc=True)

        # in case sendmail is not in default path for the agent
        if not sendmail_bin:
            sendmail_bin = agent_util.which("/usr/sbin/sendmail", exc=True)

        if config.get("use_sudo", 0):
            sudo_string = "sudo -n "
        else:
            sudo_string = ""

        retcode, output = agent_util.execute_command(
            "%s%s -bp" % (sudo_string, sendmail_bin))
        self.log.debug("sendmail -bp output: %s" % str(output))

        # sample output
        # dev@wlocalhost:/# sendmail -bpc
        # /var/spool/mqueue is empty
        # Total requests: 0

        output = output.splitlines()

        for line in output:
            if line.strip().startswith("Total requests:"):
                try:
                    return int(line.strip().split("Total requests:")[1].strip())
                except:
                    self.log.debug("Failed parsing line: '%s'" % line)
                    return None

        self.log.debug("No lines matched Total requests string")
        return None
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 *