MSV FM

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

import agent_util


class ElasticSearchPlugin(agent_util.Plugin):
    textkey = "elasticsearch"
    label = "Elastic Search"

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

        if not config:
            self.log.info(
                "The [elasticsearch] config block not found in the config file")
            return {}

        if not "hostname" in config or not "port" in config:
            self.log.info(
                "The [elasticsearch] config block does not contain variables for hostname and/or port")
            return {}

        if not agent_util.which("curl", exc=False):
            self.log.info('curl not found!')
            status = agent_util.UNSUPPORTED
            msg = "Curl is not installed - please install"
            return {}

        options = []

        data = {
            "number_of_nodes": {
                "label": "Total number of nodes in cluster",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "number_of_data_nodes": {
                "label": "Number of data nodes in cluster",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "active_primary_shards": {
                "label": "Number of active primary shards",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "active_shards": {
                "label": "Total number of shards",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "relocating_shards": {
                "label": "Number of shards getting relocated",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "initializing_shards": {
                "label": "Number of initializing shards",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "unassigned_shards": {
                "label": "Number of unassigned shards",
                "options": None,
                "status": status,
                "error_message": msg
            }
        }
        return data

    def check(self, textkey, data, config):

        user_string = ""
        if config.get('username') and config.get('password'):
            user_string = "--user %s:%s" % (config.get('username'),
                                            config.get('password'))

        cmd = 'curl %s %s:%s/_cluster/health' % (
            user_string, config['hostname'], config['port'])
        ret, output = agent_util.execute_command(cmd)
        reply = agent_util.json_loads(output)
        return int(reply[textkey])
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 *