MSV FM

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

import agent_util
import logging
from agent_util import float

try:
    # Python 2.x
    from urllib2 import urlopen
except ImportError:
    from urllib.request import urlopen

logger = logging.getLogger(__name__)


class OpCachePlugin(agent_util.Plugin):
    textkey = "opcache"
    label = "PHP OpCache"

    @classmethod
    def update_metrics(self, config):
        # Make initial call to opcache.py using url set in config
        metric = {}
        r = urlopen(config['opcache_url'])
        reply = r.read()
        reply = reply.strip().strip(';').split(';')
        for item in reply:
            if 'time' in item: continue
            # So we can strip out the duplicate entries from the metadata like the duplicate free/used_memory stats
            # did this because the first metric it returns is the actual correct one, the second is the default
            elif item.split(':')[0] in  metric.keys(): continue
            elif 'Array' in item: continue
            else:
                metric_name = item.split(':')[0]
                metric_value = item.split(':')[-1]
                metric[metric_name] = float(metric_value)
        return metric

    @classmethod
    def get_metadata(self, config):
        status = agent_util.MISCONFIGURED
        msg = 'Missing/incorrect data in [opcache] block!'

        if "opcache_url" in config:
            url = config['opcache_url']
            status = agent_util.SUPPORTED
            msg = None
        else:
            return {}

        metadata = {}
        metrics = self.update_metrics(config)

        options = []

        for textkey in metrics:
            if textkey == 'Array': continue
            metadata[textkey] = {
                    "label": textkey.replace('_',' ').title(),
                    "options": options,
                    "status": status,
                    "error_message": msg
                }
        return metadata

    def check(self, textkey, data, config):
        tmp = self.update_metrics(config)
        if textkey in tmp:
            # Adjusting for MB since it outputs in bytes
            if 'memory' in textkey or 'buffer' in textkey:
                return float(tmp[str(textkey)])/1048576
            else:
                return tmp[str(textkey)]
        else:
            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 *