Пример #1
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        # check if sysctl is even installed
        installed = agent_util.which("sysctl")
        if not installed:
            self.log.info("sysctl binaries not found")
            status = agent_util.UNSUPPORTED
            msg = "sysctl binaries not found"
            return {}

        metadata = {}
        if status is agent_util.SUPPORTED:
            metadata = get_sysctl_dict()

        data = {} 
        for m in metadata.keys():
            data[m] = {
                "label": m,
                "options": None,
                "status": status,
                "error_message": msg,
            }

        return data
Пример #2
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        iostat_bin = agent_util.which("iostat")
        if not iostat_bin:
            self.log.info("iostat not found")
            status = agent_util.MISCONFIGURED
            msg = "Install iostat."
            return {}

        # get our devices to monitor
        devices = []

        if 'freebsd' in platform:
            ret_code, output = agent_util.execute_command("%s -dx" % iostat_bin)
            output = output.splitlines()
            if config.get("debug", False):
                self.log.debug('#####################################################')
                self.log.debug("IO stats command '%s -dx' output:" % iostat_bin)
                self.log.debug(str(output))
                self.log.debug('#####################################################')
            for line in output[2:]:
                try: dev, f2, f3, f4, f5, f6, f7, f8 = line.strip().split()
                except: continue

                dev = dev.strip()
                devices.append(dev)

        else:
            ret_code, output = agent_util.execute_command("%s -d" % iostat_bin)
            output = output.splitlines()
            if config.get("debug", False):
                self.log.debug('#####################################################')
                self.log.debug("IO stats command '%s -d' output:" % iostat_bin)
                self.log.debug(str(output))
                self.log.debug('#####################################################')

            for line in output[3:]:
                try: dev, tps, blk_reads, blk_writes, blk_read, blk_write = line.strip().split()
                except: continue

                dev = dev.strip()
                devices.append(dev)

        # no devices?  no resources to monitor then
        if not devices:
            status = agent_util.MISCONFIGURED
            msg = "No devices found from iostat."

        data = {
            "stats.util": {
                "label": "Percentage of CPU time during which I/O requests were issued to the device",
                "options": devices,
                "status": status,
                "error_message": msg
            }
        }
        return data
Пример #3
0
    def check(self, textkey, data, config={}):
        exim_bin = agent_util.which("exim", exc=True)
        retcode, output = agent_util.execute_command("%s -bpc" % exim_bin)
        self.log.debug("exim -bpc output: %s" % str(output))
        output = output.splitlines()
        fields = output[0].split()

        return int(fields[0])
Пример #4
0
 def check(self, textkey, data, config):
     stat_binary_path = agent_util.which("varnishstat")
     query = '%s -1 -f %s'
     if "extended_metric" in textkey:
         result = execute_query(query % (stat_binary_path, textkey.replace("extended_metric.", "")))
     else:
         result = execute_query(query % (stat_binary_path, textkey))
     fields = result.split()
     try:
         return int(fields[1])
     except:
         return 0
         self.log.debug("%s: %s" % (textkey.replace("extended_metric.", "").title(), str(result)))
Пример #5
0
def execute_query(config, query):
    cmd = agent_util.which("psql", exc=True)
    if "username" in config: cmd += " -U %s" % config["username"]    
    cmd += " -d %s" % config.get("database", "postgres").strip()
    cmd += (" -c %r" % query)
    cmd = 'su - %s -c "%s"' % (config.get("username", "postgres"), cmd)
    if "password" in config and config["password"].strip():
        cmd = "PGPASSWORD=%s %s" % (config["password"].strip(), cmd)
    status, output = agent_util.execute_command(cmd)
    if status != 0: raise Exception(output)

    output = agent_util.StringIO(output)
    parsed_output = list(csv.reader(output, delimiter="|"))
    return parsed_output
Пример #6
0
def execute_query(config, query):
    cmd = agent_util.which("mysql", exc=True)
    if "username" in config: cmd += " -u %s" % config["username"]
    if "password" in config and config["password"].strip():
        cmd += " -p%s" % config["password"].strip()
    cmd += (" -Be %r" % str(query))
    if "database" in config:
        cmd += " %s" % config["database"].strip()
    status, output = agent_util.execute_command(cmd)
    if status != 0: raise Exception(output)

    output = agent_util.StringIO(output)
    parsed_output = list(csv.reader(output, delimiter="\t"))
    return parsed_output
Пример #7
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        mongo = agent_util.which("mongo")
        if not mongo:
            self.log.info("mongo binary not found")
            status = agent_util.UNSUPPORTED
            msg = "mongo binary not found"
            return {}

        if status is agent_util.SUPPORTED:
            try: 
                output = execute_query("rs.status()", config)
                if config.get("debug", False):
                    self.log.debug('#####################################################')
                    self.log.debug("Mongo command 'rs.status()' output:")
                    self.log.debug(str(output))
                    self.log.debug('#####################################################')
            # if "rs" is undefined...no replica set queries available
            except:
                self.log.exception("error running mongo query")
                status = agent_util.MISCONFIGURED
                msg = "Check your Mongo connection settings."

        data = {
            "replica_set.status": {
                "label": "MongoDB replica set's status",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "replica_set.primary_optime_date_difference": {
                "label": "Difference of primary node's optime date and realtime",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "replica_set.max_members_ping_ms_difference": {
                "label": "Maximum difference of members' ping ms from primary node's ping ms",
                "options": None,
                "status": status,
                "error_message": msg
            },
        }
        return data
Пример #8
0
def execute_query(query, config):
    mongo = agent_util.which("mongo", exc=True)

    query = "printjson(%s)" % query
    cmd = "%s --eval %r" % (mongo, query)

    if "username" in config: cmd += " -u %s" % config["username"]
    if "password" in config and config["password"].strip():
        cmd += " -p%s" % config["password"].strip()

    status, output = agent_util.execute_command(cmd)
    if status != 0: raise Exception(output)

    result = "\n".join(output.split("\n")[2:])
    result = re.sub("Timestamp\((.*?), (.*?)\)", r'{"__timestamp__": {"t": \1, "i": \2}}', result)
    result = re.sub("ISODate\((.*?)\)", r'{"__datetime__": \1}', result)

    result = json.loads(result, object_hook=custom_json_converter)
    return result
Пример #9
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        # check if oracle weblogic is installed, running, and on path      
        set_env_command = ("source %s; " % os.path.join(config['wl_home'], "server/bin/setWLSEnv.sh")) if 'wl_home' in config else ""
        installed = agent_util.which("java") and agent_util.execute_command(set_env_command + "java weblogic.Admin")
        if not installed:
            self.log.info("oracle weblogic not installed or not on path")
            status = agent_util.UNSUPPORTED
            msg = "oracle weblogic not installed or not on path"
            return {}

        if not ("wl_home" in config and "username" in config and "password" in config):
            self.log.info("Weblogic configuration parameters missing")
            return {}

        if not os.path.exists(os.path.join(config['wl_home'], "server/bin/setWLSEnv.sh")):
            self.log.info("Weblogic setWLSEnv.sh script not found")
            return {}

        if status is agent_util.SUPPORTED:
            try: output = get_metric(config, "ApplicationRuntime")
            except:
                self.log.exception("error getting weblogic metric")
                status = agent_util.MISCONFIGURED
                msg = "Double check your Weblogic login username and password as well as wl_home."
                
        data = {}
        for type, vals in metrics.items():
            try: output = get_metric(config, vals["type"])
            except: continue
            for property, meta in vals["metrics"].items():
                textkey = "%s.%s" % (type, property)
                data[textkey] = {
                    "label": meta["label"],
                    "options": meta.get('options', None),
                    "status": status,
                    "error_message": msg
                }
                if "unit" in meta: data[textkey]["unit"] = meta["unit"]
        return data
Пример #10
0
    def check(self, textkey, device, config):
        iostat_bin = agent_util.which("iostat")
        ret, output = agent_util.execute_command("%s -dx %s 1 2" % (iostat_bin, device))
        if config.get("debug", False):
            self.log.debug('#####################################################')
            self.log.debug("IO stats command '%s -dx %s 1 2' output:" % (iostat_bin, device))
            self.log.debug(str(output))
            self.log.debug('#####################################################')

        self.log.debug("iostat -dx output: %s" % str(output))

        if 'freebsd' in platform:
            output = output.splitlines()
            output = output[3].strip().split()
            util = float(output[7].strip())

        else:
            output = output.splitlines()
            output = output[6].strip().split()
            util = float(output[11].strip())

        return util
Пример #11
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None


        exim_bin = agent_util.which("exim")
        if not exim_bin:
            self.log.info("couldn't find exim binary")
            status = agent_util.UNSUPPORTED
            msg = "couldn't find exim binary"
            return {}

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

        return data
Пример #12
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        # check if mysql is even installed
        installed = agent_util.which("mysql") and (agent_util.which("mysqld_safe") or agent_util.which("mysqld"))
        if not installed:
            self.log.info("mysql and mysqld binaries not found")
            status = agent_util.UNSUPPORTED
            msg = "mysql and mysqld binaries not found"
            return {}

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

        if not "username" in config or not "password" in config:
            self.log.info("The required [mysql] config is not found in the config file")
            return {}

        if status is agent_util.SUPPORTED:
            try: 
                output = execute_query(config, "SHOW DATABASES")
                if config.get("debug", False):
                    self.log.debug('#####################################################')
                    self.log.debug("Mysql command 'SHOW DATABASES' output:")
                    self.log.debug(str(output))
                    self.log.debug('#####################################################')

            except:
                self.log.exception("error running mysql query")
                status = agent_util.MISCONFIGURED
                msg = "Double check your MySQL login username and password."

        data = {
            # basic
            "query_cache.percent_free": {
                "label": "MySQL query cache percent free",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "percent"
            },
            "query_cache.kb_free": {
                "label": "MySQL query cache amount free (kB)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "kB"
            },
            "connections": {
                "label": "MySQL connections",
                "options": None,
                "status": status,
                "error_message": msg,
            },

            # replication
            "slave.running": {
                "label": "MySQL Slave server is replicating",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "slave.io_running": {
                "label": "MySQL Slave server is connected to the Master",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "slave.latency": {
                "label": "MySQL Slave server latency (seconds)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "seconds"
            },
        }
        if "extended_metrics" in config:
            extended_metrics = [m.strip().lower() for m in config["extended_metrics"].split(',')]
            for m in extended_metrics:
                data["extended_metric.%s" % m] = {
                    "label": "MySQL %s" % m.replace('_'," "),
                    "options": None,
                    "status": status,
                    "error_message": msg
                }
                
        return data
Пример #13
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None
        interfaces = set()

        if 'freebsd' in sys.platform:
            if not agent_util.which("netstat"):
                self.log.info("netstat not found")
                status = agent_util.UNSUPPORTED
                msg = "Please install netstat."
                return {}

            if status is agent_util.SUPPORTED:
                ret, output = agent_util.execute_command("netstat -ib")
                if config.get("debug", False):
                    self.log.debug('#####################################################')
                    self.log.debug("Bandwidth command 'netstat -ib' output:")
                    self.log.debug(output)
                    self.log.debug('#####################################################')

                output = output.splitlines()[1:]
                for line in output:
                    stuff = line.strip().split()
                    iface = stuff[0]
                    interfaces.add(iface)

        elif 'aix' in sys.platform:
            if not agent_util.which("netstat"):
                self.log.info("netstat not found")
                status = agent_util.UNSUPPORTED
                msg = "Please install netstat."
                return {}

            # Get the list of network devices
            interfaces = []
            ret, output = agent_util.execute_command("netstat -v | grep 'ETHERNET STATISTICS'")
            output = output.strip().split('\n')
            for line in output:
                fields = line.split()
                try:
                    interfaces.append(fields[2].strip('(').strip(')'))
                except:
                    pass

            metadata = {}
            metadata["bandwidth.kbytes.in"] = {
                "label": "Kilobytes IN per second",
                "options": interfaces,
                "status": status,
                "error_message": msg,
                "unit": "kB"
            }

            metadata["bandwidth.kbytes.out"] = {
                "label": "Kilobytes OUT per second",
                "options": interfaces,
                "status": status,
                "error_message": msg,
                "unit": "kB"
            }

            metadata["bandwidth.packets.in"] = {
                "label": "Packets IN per second",
                "options": interfaces,
                "status": status,
                "error_message": msg,
                "unit": "packets"
            }

            metadata["bandwidth.packets.out"] = {
                "label": "Packets OUT per second",
                "options": interfaces,
                "status": status,
                "error_message": msg,
                "unit": "packets"
            }

            return metadata

        elif 'sunos' in sys.platform:
            if not agent_util.which("netstat"):
                self.log.info("netstat not found")
                status = agent_util.UNSUPPORTED
                msg = "Please install netstat."
                return {}

            # Get the list of network devices
            interfaces = []
            ret, output = agent_util.execute_command("netstat -i")
            output = output.strip().split('\n')
            for line in output:
                fields = line.split()
                if fields[0] in ('lo', 'inet', 'ether', 'Name'): continue
                try:
                    interfaces.append(fields[0])
                except:
                    pass

            metadata = {}
            metadata["bandwidth.kbytes.in"] = {
                "label": "Kilobytes IN per second",
                "options": interfaces,
                "status": status,
                "error_message": msg,
                "unit": "kB"
            }

            metadata["bandwidth.kbytes.out"] = {
                "label": "Kilobytes OUT per second",
                "options": interfaces,
                "status": status,
                "error_message": msg,
                "unit": "kB"
            }

            metadata["bandwidth.packets.in"] = {
                "label": "Packets IN per second",
                "options": interfaces,                "status": status,
                "error_message": msg,
                "unit": "packets"
            }

            metadata["bandwidth.packets.out"] = {
                "label": "Packets OUT per second",
                "options": interfaces,
                "status": status,
                "error_message": msg,
                "unit": "packets"
            }

            return metadata

        else:
            # Default Linux options
            if not os.path.exists("/proc/net/dev"):
                self.log.info("/proc/net/dev not found")
                status = agent_util.UNSUPPORTED
                msg = "/proc/net/dev not found"
                return {}

            if status is agent_util.SUPPORTED:
                # get the interfaces
                output = open("/proc/net/dev", "r").read()
                output = output.splitlines()
                if config.get("debug", False):
                    self.log.debug('#####################################################')
                    self.log.debug("Content of file '/proc/net/dev':")
                    self.log.debug(str(output))
                    self.log.debug('#####################################################')

                for line in output[2:]:
                    stuff = line.strip().split()
                    iface, bytes_read = stuff[0].split(":")
                    interfaces.add(iface)

        interfaces = list(interfaces)
        interfaces.sort()

        if status is agent_util.SUPPORTED and not interfaces:
            status = agent_util.MISCONFIGURED
            msg = "No network interfaces found."

        metadata = {}
        metadata["bandwidth.kbytes.in"] = {
            "label": "Kilobytes IN per second",
            "options": interfaces,
            "status": status,
            "error_message": msg,
            "unit": "kB"
        }

        metadata["bandwidth.kbytes.out"] = {
            "label": "Kilobytes OUT per second",
            "options": interfaces,
            "status": status,
            "error_message": msg,
            "unit": "kB"
        }

        metadata["bandwidth.packets.in"] = {
            "label": "Packets IN per second",
            "options": interfaces,
            "status": status,
            "error_message": msg,
            "unit": "packets"
        }

        metadata["bandwidth.packets.out"] = {
            "label": "Packets OUT per second",
            "options": interfaces,
            "status": status,
            "error_message": msg,
            "unit": "packets"
        }

        if 'freebsd' not in sys.platform:
            metadata["bandwidth.monthly.in"] = {
                "label": "Kilobytes IN for the month",
                "options": interfaces,
                "status": status,
                "error_message": msg,
                "unit": "kB"
            }
            metadata["bandwidth.monthly.out"] = {
                "label": "Kilobytes OUT for the month",
                "options": interfaces,
                "status": status,
                "error_message": msg,
                "unit": "kB"
            }

        return metadata
Пример #14
0
    def get_metadata(self, config):
        if 'freebsd' in sys.platform:
            status = agent_util.SUPPORTED
            msg = None

            if not agent_util.which("sysctl"):
                self.log.info("sysctl binary not found")
                status = agent_util.UNSUPPORTED
                msg = "sysctl binary not found"
                return {}

            if status is agent_util.SUPPORTED:
                ret, output = agent_util.execute_command("sysctl -a")
                if config.get("debug", False):
                    self.log.debug('#####################################################')
                    self.log.debug("Memory Usage command 'sysctl -a' output:")
                    self.log.debug(str(output))
                    self.log.debug('#####################################################')
                if ret != 0 or not output:
                    status = agent_util.UNSUPPORTED
                    msg = "error executing 'sysctl -a'"

                if status is agent_util.SUPPORTED:
                    d = self._parse_sysctl(output)

                    required_keys = (
                        "hw.pagesize",
                        "hw.physmem",
                        "vfs.bufspace",
                        "vm.stats.vm.v_inactive_count",
                        "vm.stats.vm.v_active_count",
                        "vm.stats.vm.v_cache_count",
                        "vm.stats.vm.v_free_count"
                    )

                    # here we're making sure the set of all the keys we need
                    # are in the set of all keys (subset)
                    if not set(d.keys()).issubset(set(required_keys)):
                        status = agent_util.UNSUPPORTED
                        msg = "could not find all the required sysctl keys"

            data = {
                "ram.percent": {
                    "label": "RAM percent usage",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "percent"
                },
                "ram.kb_used": {
                    "label": "RAM used (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
                "ram.kb_buffer": {
                    "label": "RAM buffer (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
                "ram.kb_active": {
                    "label": "RAM active (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
                "ram.kb_inactive": {
                    "label": "RAM inactive (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
                "ram.kb_cached": {
                    "label": "RAM cached (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
            }
            return data

        elif 'aix' in sys.platform:
            status = agent_util.SUPPORTED
            msg = None
            data = {
                "ram.percent": {
                    "label": "RAM percent usage",
                    "options": None,
                    "status": status,
                    "error_message": msg
                },
                "ram.kb_used": {
                    "label": "RAM used (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
                "swap.percent": {
                    "label": "Swap percent usage",
                    "options": None,
                    "status": status,
                    "error_message": msg
                },
                "swap.kb_used": {
                    "label": "Swap used (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
            }
            return data

        elif 'sunos' in sys.platform:
            status = agent_util.SUPPORTED
            msg = None
            data = {
                "ram.percent": {
                    "label": "RAM percent usage",
                    "options": None,
                    "status": status,
                    "error_message": msg
                },
                "ram.kb_used": {
                    "label": "RAM used (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
            }
            return data

        else:
            # Default Linux logic
            status = agent_util.SUPPORTED
            msg = None
            if not os.path.exists("/proc/meminfo"):
                status = agent_util.MISCONFIGURED
                msg = "Enable procfs."

            data = {
                "ram.percent": {
                    "label": "RAM percent usage",
                    "options": None,
                    "status": status,
                    "error_message": msg
                },
                "ram.kb_used": {
                    "label": "RAM used (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
                "ram.kb_buffer": {
                    "label": "RAM buffer (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
                "swap.percent": {
                    "label": "Swap percent usage",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "percent",
                },
                "swap.kb_used": {
                    "label": "Swap used (Kb)",
                    "options": None,
                    "status": status,
                    "error_message": msg
                },
                "ram.kb_active": {
                    "label": "RAM active (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
                "ram.kb_inactive": {
                    "label": "RAM inactive (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
                "ram.kb_cached": {
                    "label": "RAM cached (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                },
                "swap.kb_cached": {
                    "label": "Swap cached (kB)",
                    "options": None,
                    "status": status,
                    "error_message": msg,
                    "unit": "kB"
                }
            }
            return data
Пример #15
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        # check for nginx configuration block
        if ("console_url" not in config):
            self.log.info("Nginx is not configured")
            status = agent_util.MISCONFIGURED
            msg = "nginx is not configured properly"
            return {}

        # check if nginx is even installed or running
        installed = agent_util.which("nginx")
        if not installed:
            self.log.info("nginx binary not found")
            status = agent_util.UNSUPPORTED
            msg = "nginx binary not found"
            return {}

        query = 'wget -qO- "%s/nginx_status" | cat' % config['console_url']
        nginxStatus = execute_query(query)
        if config.get("debug", False):
            self.log.debug('#####################################################')
            self.log.debug("Nginx command '%s' output:" % query)
            self.log.debug(str(nginxStatus))
            self.log.debug('#####################################################')

        if status is agent_util.SUPPORTED and not nginxStatus:
            status = agent_util.MISCONFIGURED
            msg = "The nginx_status path is not configured."

        data = {
            "active_connections": {
                "label": "Number of open connections",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "accepted_connections": {
                "label": "Number of accepted connections",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "handled_connections": {
                "label": "Number of handled connections",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "handles_request": {
                "label": "Number of request handles",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "requests_per_connection": {
                "label": "Number of requests per connection",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "nginx_reading": {
                "label": "Read request header",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "nginx_writing": {
                "label": "Read request body",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "nginx_waiting": {
                "label": "Keep alive connections",
                "options": None,
                "status": status,
                "error_message": msg
            },

        }

        return data
Пример #16
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        # check if postgresql is even installed
        installed = agent_util.which("psql")
        if not installed:
            self.log.info("psql binary not found")
            status = agent_util.UNSUPPORTED
            msg = "psql binary not found"
            return {}

        if status is agent_util.SUPPORTED:
            try: output = execute_query(config, "select datname from pg_database where datistemplate = false")
            except:
                self.log.exception("error running postgresql query")
                status = agent_util.MISCONFIGURED
                msg = "Double check your PostgreSQL login username and password."

        data = {
            "rows_select_idx": {
                "label": "SELECTs (from index) (rows/second)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "rows/second"
            },
            "rows_select_scan": {
                "label": "SELECTs (from scans) (rows/second)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "rows/second"
            },
            "rows_insert": {
                "label": "INSERTs (rows/second)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "rows/second"
            },
            "rows_update": {
                "label": "UPDATEs (rows/second)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "rows/second"
            },
            "rows_delete": {
                "label": "DELETEs (rows/second)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "rows/second"
            },
            "rows_total": {
                "label": "Total queries (rows/second)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "rows/second"
            },
            "numbackends": {
                "label": "Number of active backends",
                "options": None,
                "status": status,
                "error_message": msg,
            },
            "xact_commit": {
                "label": "Transactions committed (txn/second)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "txn/second"
            },
            "xact_rollback": {
                "label": "Transactions rolled back (txn/second)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "txn/second"
            },
            "xact_total": {
                "label": "Total transactions (txn/second)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "txn/second"
            },
            "blks_read": {
                "label": "Blocks read from disk (blocks/second)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "blocks/second"
            },
            "blks_hit": {
                "label": "Blocks read from buffer cache (blocks/second)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "blocks/second"
            },
            "blks_cache_pc": {
                "label": "Buffer cache hit rate (%)",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "percent"
            }
        }
        return data
Пример #17
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None
        socket_cfg_file = "/var/run/haproxy.sock"
        if "socket_cfg_file" in config: socket_cfg_file = config["socket_cfg_file"]

        # check if haproxy is even installed
        installed = agent_util.which("haproxy")
        if not installed:
            self.log.info("haproxy binary not found")
            status = agent_util.UNSUPPORTED
            msg = "haproxy binary not found"
            return {}

        pxservers = set()
        if status is agent_util.SUPPORTED:
            if config.get("debug", False):
                self.log.debug("HAProxy socket file path %s" % socket_cfg_file)
            if not os.access(socket_cfg_file, os.W_OK):
                status = agent_util.MISCONFIGURED
                self.log.error("Agent does not have permission to access the HAProxy socket file. Please adjust permissions.")
                msg = "Agent does not have permission to access the HAProxy socket file. Please adjust permissions." 
           
        if status is agent_util.SUPPORTED:
            try:
                stats = HAProxyStats(socket_cfg_file)
                output = stats.execute('show stat')
                if config.get("debug", False):
                    self.log.debug('#####################################################')
                    self.log.debug("HAProxy command 'show stat' output:")
                    self.log.debug(output)
                    self.log.debug('#####################################################')

                metric_values = get_status_headers(config)
                for values in metric_values:
                    pxname = values['# pxname']
                    svname = values['svname']
                    pxservers.add(pxname + ' ' + svname )

            except:
                status = agent_util.MISCONFIGURED
                self.log.error("couldn't get haproxy status")
                msg = "Couldn't get haproxy status, make sure haproxy is running, haproxy configuration file is valid and the status module is enabled"   

        pxservers = list(pxservers)
        pxservers.sort()

        if status is agent_util.SUPPORTED and not pxservers:
            status = agent_util.MISCONFIGURED
            msg = "No Proxy servers found."

        metadata = {
            "status": {
                "label": "HAProxy service status(UP/OPEN=1, DOWN/NOLB/MAINT/MAINT(via)...=0)",
                "options": pxservers,
                "status": status,
                "error_message": msg
            },
            "qcur": {
                "label": "Current HAProxy service queued requests ",
                "options": pxservers,
                "status": status,
                "error_message": msg
            },
            "scur": {
                "label": "Current HAProxy service sessions",
                "options": pxservers,
                "status": status,
                "error_message": msg
            },
            "stot": {
                "label": "Total HAProxy service sessions",
                "options": pxservers,
                "status": status,
                "error_message": msg
            },
            "bin": {
                "label": "Bytes In of HAProxy service",
                "options": pxservers,
                "status": status,
                "error_message": msg
            },
            "bout": {
                "label": "Bytes Out of HAProxy service",
                "options": pxservers,
                "status": status,
                "error_message": msg
            },
            "ereq": {
                "label": "HAProxy service error requests",
                "options": pxservers,
                "status": status,
                "error_message": msg
            },
            "eresp": {
                "label": "HAProxy service response errors",
                "options": pxservers,
                "status": status,
                "error_message": msg
            },
            "econ": {
                "label": "HAProxy service connection errors",
                "options": pxservers,
                "status": status,
                "error_message": msg
            },
            "act": {
                "label": "Number of HAProxy service active servers",
                "options": pxservers,
                "status": status,
                "error_message": msg
            },
            "bck": {
                "label": "Number of HAProxy service backup servers",
                "options": pxservers,
                "status": status,
                "error_message": msg
            }
        }
        return metadata
Пример #18
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        if not agent_util.which("df", exc=False):
            self.log.info("df binary not found")
            status = agent_util.UNSUPPORTED
            msg = "df binary not found"
            return {}

        devices = []
        if status is agent_util.SUPPORTED:
            ret_code, output = agent_util.execute_command(get_df_cmd())
            output = output.splitlines()
            if config.get("debug", False):
                self.log.debug('#####################################################')
                self.log.debug("Disk command '%s' output :" % get_df_cmd())
                self.log.debug(str(output))
                self.log.debug('#####################################################')

            if "aix" in sys.platform or "sunos" in sys.platform:
                self.device_ignore_list = self.device_ignore_list + ("proc", "swap")
 
            for line in output[1:]:
                line = line.strip()

                try:
                    device, blocks, used, available, capacity, mounted = line.split()
                    if device in self.device_ignore_list: continue
                    devices.append("%s mounted at %s" % (device, mounted))
                except:
                    self.log.error("Unable to parse df output: %s" % line)
                    continue

        if status is agent_util.SUPPORTED and not devices:
            status = agent_util.MISCONFIGURED
            msg = "No disks found (or none visible from df)."

        data = {
            "usage.percent_used": {
                "label": "Percentage of disk used",
                "options": devices,
                "status": status,
                "error_message": msg,
                "unit": "percent",
            },
            "usage.kb_available": {
                "label": "Disk space available",
                "options": devices,
                "status": status,
                "error_message": msg,
                "unit": "kB"
            },
            "filesystem.mounted": {
                "label": "Filesystem mounted",
                "options": devices,
                "status": status,
                "error_message": msg,
            },
        }
        return data
Пример #19
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        # check if varnish is even installed or running
        installed = agent_util.which("varnishd")
        if not installed:
            self.log.info("varnishd binary not found")
            status = agent_util.UNSUPPORTED
            msg = "varnish binary not found"
            return {}

        data = {
            "client_conn": {
                "label": "Client connections accepted",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "client_req": {
                "label": "Client requests received",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "cache_hit": {
                "label": "Cache hits",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "cache_hitpass": {
                "label": "Cache hits for pass",
                "options": None,
                "status": status,
                "error_message": msg
            },

            "backend_fail": {
                "label": "Backend conn. failures",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "cache_miss": {
                "label": "Cache misses",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "n_object": {
                "label": "Nstruct object",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "n_wrk": {
                "label": "Nworker threads",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "n_wrk_create": {
                "label": "Nworker threads created",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "n_wrk_failed": {
                "label": "Nworker threads not created",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "n_wrk_max": {
                "label": "Nworker threads limited",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "n_wrk_drop": {
                "label": "Ndropped work requests",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "n_lru_nuked": {
                "label": "NLRU nuked objects",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "esi_errors": {
                "label": "ESI parse errors (unlock)",
                "options": None,
                "status": status,
                "error_message": msg
            },
            "n_expired": {
                "label": "Nexpired objects",
                "options": None,
                "status": status,
                "error_message": msg
            },
        }
        if "extended_metrics" in config:
            extended_metrics = [m.strip().lower() for m in config["extended_metrics"].split(',')]
            for m in extended_metrics:
                data["extended_metric.%s" % m] = {
                    "label": "Varnish %s" % m.replace('_', " "),
                    "options": None,
                    "status": status,
                    "error_message": msg
                }
        return data
#from dateutil.parser import parse
#from dateutil.relativedelta import relativedelta
from datetime import datetime, date
import time
import gzip
import os
import agent_util

DEBIAN = 1
REDHAT = 2

IS_DEBIAN = agent_util.which("/usr/bin/apt-get") is not None
IS_REDHAT = agent_util.which("/usr/bin/yum") is not None

class PackageUpgradePlugin(agent_util.Plugin):
    textkey = "package_upgrade"
    label = "Package Upgrades"

    @classmethod
    def get_metadata(self, config):
        package_count_status = agent_util.UNSUPPORTED
        package_date_status = agent_util.UNSUPPORTED
        package_count_msg = None
        package_date_msg = None

        if IS_DEBIAN or IS_REDHAT:
            package_date_status = agent_util.SUPPORTED
            if IS_DEBIAN:
                try: 
                    import apt_check
                    if agent_util.execute_command("sudo /usr/bin/apt-get")[0] == 0:
Пример #21
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        if 'aix' in sys.platform:
            status = agent_util.SUPPORTED
            data = {'load_average.1': {'label': '1 minute CPU load average',
                                       'options': None,
                                       'status': status,
                                       'error_message': msg,
                                       'unit': 'avg'},
                    'load_average.5': {'label': '5 minute CPU load average',
                                       'options': None,
                                       'status': status,
                                       'error_message': msg,
                                       'unit': 'avg'},                                       
                    'load_average.15': {'label': '15 minute CPU load average',
                                        'options': None,
                                        'status': status,
                                        'error_message': msg,
                                        'unit': 'avg'},                                       
                    "usage_percentage": {"label": "Usage percentage",
                                         "options": get_cpu_metrics(self).keys(),
                                         "status": status,
                                         "error_message": msg,
                                         "unit": "percent"},
                    "user_usage_percentage": {"label": "User usage percentage",
                                              "options": None,
                                              "status": status,
                                              "error_message": msg,
                                              "unit": "avg"},
                    "system_usage_percentage": {"label": "System usage percentage",
                                                "options": None,
                                                "status": status,
                                                "error_message": msg,
                                                "unit": "avg"},
                    "idle_usage_percentage": {"label": "Idle usage percentage",
                                              "options": None,
                                              "status": status,
                                              "error_message": msg,
                                              "unit": "avg"},
                    "iowait_usage_percentage": {"label": "I/O Wait usage percentage",
                                                "options": None,
                                                "status": status,
                                                "error_message": msg,
                                                "unit": "avg"},
                    "cpu_entitlement_percentage": {"label": "CPU entitlement percentage",
                                                   "options": None,
                                                   "status": status,
                                                   "error_message": msg,
                                                   "unit": "%"},
                    }
            return data

        elif 'sunos' in sys.platform:
            status = agent_util.SUPPORTED
            data = {"usage_percentage": {"label": "Usage percentage",
                                         "options": get_cpu_metrics(self).keys(),
                                         "status": status,
                                         "error_message": msg,
                                         "unit": "percent"},
                    "user_usage_percentage": {"label": "User usage percentage",
                                              "options": None,
                                              "status": status,
                                              "error_message": msg,
                                              "unit": "avg"},
                    "system_usage_percentage": {"label": "System usage percentage",
                                                "options": None,
                                                "status": status,
                                                "error_message": msg,
                                                "unit": "avg"},
                    "idle_usage_percentage": {"label": "Idle usage percentage",
                                              "options": None,
                                              "status": status,
                                              "error_message": msg,
                                              "unit": "avg"},
                    "iowait_usage_percentage": {"label": "I/O Wait usage percentage",
                                                "options": None,
                                                "status": status,
                                                "error_message": msg,
                                                "unit": "avg"},
                    }
            return data

        # Core Linux/FreeBSD support
        if not agent_util.which("top", exc=False):
            self.log.info("top binary not found")
            status = agent_util.UNSUPPORTED
            msg = "top binary not found"
            return {}

        metadata = {
            "load_average.1": {
                "label": "1 minute CPU load average",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "avg"
            },
            "load_average.5": {
                "label": "5 minute CPU load average",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "avg"
            },
            "load_average.15": {
                "label": "15 minute CPU load average",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "avg"
            },
            "usage_percentage": {
                "label": "Usage percentage",
                "options": get_cpu_metrics(self).keys(),
                "status": status,
                "error_message": msg,
                "unit": "percent"
            },
            "user_usage_percentage": {
                "label": "User usage percentage",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "avg"
            },
            "system_usage_percentage": {
                "label": "System usage percentage",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "avg"
            },
            "idle_usage_percentage": {
                "label": "Idle usage percentage",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "avg"
            },
            "iowait_usage_percentage": {
                "label": "I/O Wait usage percentage",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "avg"
            },
            "irq_usage_percentage": {
                "label": "Hardware IRQ usage percentage",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "avg"
            },
            "softirg_usage_percentage": {
                "label": "Software IRQ usage percentage",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "avg"
            },
            "stealtime_usage_percentage": {
                "label": "Steal Time usage percentage",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "avg"
            },
            "nice_usage_percentage": {
                "label": "Nice usage percentage",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "avg"
            }
        }

        return metadata
Пример #22
0
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        self.log.info("looking for apache2ctl")
        apache_bin = agent_util.which("apache2ctl")
        if not apache_bin:
            self.log.info("couldn't find apache2ctl, looking for apachectl")
            apache_bin = agent_util.which("apachectl")

        if not apache_bin:
            self.log.info("couldn't find apachectl or apache2ctl")
            status = agent_util.UNSUPPORTED
            msg = "Couldn't find apachectl or apache2ctl"
            return {}

        if 'freebsd' in platform:
            if not agent_util.which("lynx"):
                status = agent_util.MISCONFIGURED
                msg = "Lynx required."

        if status is agent_util.SUPPORTED:
            ret, output = agent_util.execute_command("%s status" % apache_bin)
            if config.get("debug", False):
                self.log.info('#####################################################')
                self.log.info("Apache command '%s status' output:" % apache_bin)
                self.log.info(output)
                self.log.info('#####################################################')

            if ret != 0 or "Can't load" in output or "failed" in output or "not found" in output:
                self.log.error("couldn't get apache status")
                status = agent_util.MISCONFIGURED
                msg = "Couldn't get apache status, make sure Apache is running and the status module is enabled"        

        metadata = {
            "apache.workers_used": {
                "label": "Workers - percent serving requests",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "%"
            },
            "apache.workers_idle": {
                "label": "Workers - percent idle",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "%"
            },
            "apache.workers_used_count": {
                "label": "Workers - count serving requests",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "workers"
            },
            "apache.workers_idle_count": {
                "label": "Workers - count idle",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "workers"
            },
            "apache.uptime": {
                "label": "Server uptime",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "seconds"
            }
        }
        
        # other require an extended status enabled
        if self.get_data("apache.total_accesses") == None:
            ret, output = agent_util.execute_command("%s -V" % apache_bin)
            match = re.search("HTTPD_ROOT=\"(.+?)\"", output)
            try: server_root = match.group(1)
            except: server_root = ""
            match = re.search("SERVER_CONFIG_FILE=\"(.+?)\"", output)
            try: server_config_file = os.path.join(server_root, match.group(1))
            except: server_config_file = "Apache server config file"
            status = agent_util.MISCONFIGURED
            msg = "Enable 'ExtendedStatus On' in %s" % server_config_file 
                
        metadata.update({   
            "apache.total_accesses": {
                "label": "Request count",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "requests"
            },
            "apache.total_traffic": {
                "label": "Total content served",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "MB"
            },  
            "apache.cpu_load": {
                "label": "Percentage of CPU used by all workers",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": None
            },       
            "apache.connections": {
                "label": "Requests per second",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "requests"
            },
            "apache.transfer_rate": {
                "label": "Transfer rate",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "MB/s"
            },
            "apache.avg_request_size": {
                "label": "Request size average",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "MB"
            }
        })
            
        return metadata
Пример #23
0
    def get_data(self, textkey):
        apache_bin = agent_util.which("apache2ctl")
        self.log.debug("apache_bin: %s" % str(apache_bin))
        if not apache_bin: apache_bin = agent_util.which("apachectl", exc=True)

        ret, output = agent_util.execute_command("%s status" % apache_bin)
            
        if textkey == "apache.uptime":
            if output.find("Server uptime: ") == -1: return None
            output = output[output.index("Server uptime: "):]
            uptime = output[:output.index("\n")].replace("Server uptime: ", "").strip()
            uptime = uptime.replace(" seconds", "*1").replace(" second", "*1") \
                           .replace(" minutes", "*60").replace(" minute", "*60") \
                           .replace(" hours", "*60*60").replace(" hour", "*60*60") \
                           .replace(" days", "*60*60*24").replace(" day", "*60*60*24") \
                           .replace(" ", "+")
            uptime = eval(uptime)
            return uptime
            
        elif textkey in ("apache.total_accesses", "apache.total_traffic"):
            for line in output.lower().split('\n'):
                if "total accesses" in line:
                    fields = line.split()
                    accesses = int(fields[2])
                    traffic = float(fields[-2])
                    units = fields[-1]

                    # Convert from various units to megabytes
                    if units == 'b': traffic = traffic / (1024 * 1024)
                    elif units == 'kb': traffic = traffic / 1024
                    elif units == 'gb': traffic = traffic * 1024
                    elif units == 'tb': traffic = traffic * 1024 * 1024

                    if textkey == "apache.total_accesses": return accesses
                    else: return traffic
            return None

        elif textkey == "apache.cpu_load":
            for line in output.lower().split('\n'):
                if "cpu usage" in line:
                    fields = line.split()
                    cpu_load = float(fields[-3].rstrip('%'))
                    return cpu_load              
            return None

        elif textkey in ("apache.connections", "apache.transfer_rate", "apache.avg_request_size"):
            for line in output.lower().split('\n'):
                if "requests/sec" in line:
                    fields = line.split()

                    if textkey == "apache.connections":
                        return float(fields[0])
                    elif textkey == "apache.transfer_rate":
                        value = float(fields[3])
                        units = fields[4].split('/')[0]

                        if units == 'b': value = value / (1024 * 1024)
                        elif units == 'kb': value = value / 1024
                        elif units == 'gb': value = value * 1024
                        elif units == 'tb': value = value * 1024 * 1024

                        return value

                    elif textkey == "apache.avg_request_size":
                        value = float(fields[-2])
                        units = fields[-1].split('/')[0]

                        if units == 'b': value = value / (1024 * 1024)
                        elif units == 'kb': value = value / 1024
                        elif units == 'gb': value = value * 1024
                        elif units == 'tb': value = value * 1024 * 1024

                        return value
            
        elif textkey in ("apache.workers_used", "apache.workers_idle", "apache.workers_used_count", "apache.workers_idle_count"):
            for line in output.lower().split('\n'):
                if "requests currently being processed" in line:
                    fields = line.split()

                    workers = int(fields[0])
                    idle = int(fields[-3])
                    total = workers + idle

                    if total == 0: return 0

                    if textkey == "apache.workers_used":
                        return float(100. * workers / total)
                    elif textkey == "apache.workers_idle": 
                        return float(100. * idle / total)
                    elif textkey == "apache.workers_used_count":
                        return workers
                    elif textkey == "apache.workers_idle_count":
                        return idle

            return None
Пример #24
0
    def get_metadata(self, config):

        status = agent_util.SUPPORTED
        msg = None
        
        if 'aix' in sys.platform:
            status = agent_util.SUPPORTED
            msg = None
        elif not os.path.exists("/proc"):
            self.log.info("/proc not found")
            status = agent_util.UNSUPPORTED
            msg = "Enable procfs."
            return {}
        elif not agent_util.which("pgrep", exc=False):
            self.log.info("pgrep binary not found")
            status = agent_util.UNSUPPORTED
            msg = "pgrep binary not found"
            return {}

        metadata = {
            "process.running_count": {
                "label": "Number of processes running",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "processes"
            },
            "process.named_count": {
                "label": "Number of processes - name",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "processes",
                "option_string": True
            },
            "process.named_memory_percentage": {
                "label": "Memory percentage of processes - name",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "percent",
                "option_string": True
            },
            "process.named_cpu_percentage": {
                "label": "CPU percentage of processes - name",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "percent",
                "option_string": True
            },
            "process.exists": {
                "label": "Process is running",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "boolean",
                "option_string": True
            },
            "process.named_count.full": {
                "label": "Number of processes - full command line",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "processes",
                "option_string": True
            },
            "process.named_memory_percentage.full": {
                "label": "Memory percentage of processes - full command line",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "percent",
                "option_string": True
            },
            "process.named_cpu_percentage.full": {
                "label": "CPU percentage of processes - full command line",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "percent",
                "option_string": True
            },
            "process.exists.full": {
                "label": "Process is running - full command line",
                "options": None,
                "status": status,
                "error_message": msg,
                "unit": "boolean",
                "option_string": True
            }
        }
        return metadata
Пример #25
0
def check_for_curl_installation():
    result = agent_util.which('curl')
    if result != 'None':
        return True
    return False