How to use the discover.provides function in discover

To help you get started, we’ve selected a few discover examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Mirantis / disk_perf_test_tool / sensors / sensors / psram_sensors.py View on Github external
@provides("perprocess-ram")
def psram_stat(disallowed_prefixes=None, allowed_prefixes=None):
    results = {}
    pid_list = get_pid_list(disallowed_prefixes, allowed_prefixes)
    print pid_list
    for pid in pid_list:
        try:
            dev_name = get_pid_name(pid)

            private, shared = get_mem_stats(pid)
            total = private + shared
            sys_total = get_ram_size()
            usage = float(total) / float(sys_total)

            sensor_name = "{0}.{1}".format(dev_name, pid)

            results[sensor_name + ".private_mem"] = SensorInfo(private, False)