[Hawkular-dev] platform resources/metrics

John Mazzitelli mazz at redhat.com
Mon Oct 5 11:01:09 EDT 2015


After a talk with John D. last week, he mentioned we really need some basic platform metrics collected by our wildfly agent. While it is true the agent can collect "some" platform metrics via WildFly like system load average (/core-service=platform-mbean/type=operating-system/:read-attribute(name=system-load-average)) its very limited (in fact, system load average is the only one I found).

So I put together a new pull request to help: https://github.com/hawkular/hawkular-agent/pull/70

This utilizes a third party library Heiko pointed out to me - Oshi (https://github.com/dblock/oshi) - which just does the basics but it has what we want, I believe. It is JNA-based and doesn't require JNI native libraries to be shipped with the product like sigar does. It supports Linux, Windows, and MacOS. It collects basic metrics for four simple resource types - Memory, File Stores (i.e. disks/partitions), Processors, and Power Sources (i.e. batteries).

I have it discovering/inventories those four basic types of resources (along with the parent "OS" resource) and collecting the metrics for them.

The metrics collected are:

A. Memory:
 1. Memory Available
 2. Memory Total

B. File Stores:
 1. Total Disk Space
 2. Available Disk Space

C. Processors
 1. CPU Usage (this is CPU load between 0% and 100%)

D. Power Sources
 1. Remaining Capacity (0% to 100% (fully drained vs. fully charged)
 2. Time Remaining (time left before power source is fully drained)

Here's what the inventory looks like (taken from inventory's REST API results):

The top root of the platform resource tree is the "Operating System" resource (Oshi has no metrics per se for the OS resource):

http://127.0.0.1:8080/hawkular/inventory/test/mazztower/resources/

[ {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;Operating%20System",
    "properties" : {
      "name" : "Operating System"
    },
    "id" : "Operating System"
  },
  "properties" : {
    "name" : "GNU/Linux Fedora 21 (Twenty One)"
  },
  "id" : "GNU/Linux Fedora 21 (Twenty One)"
}

Its children are the four types of child resources (Memory, File Stores, Processors, PowerSources (of which I have none)):

http://127.0.0.1:8080/hawkular/inventory/test/mazztower/resources/GNU%2FLinux Fedora 21 (Twenty One)/children

[ {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;File%20Store%20%5B%2F%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;File%20Store",
    "properties" : {
      "name" : "File Store"
    },
    "id" : "File Store"
  },
  "properties" : {
    "name" : "File Store [/]"
  },
  "id" : "File Store [/]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;File%20Store%20%5Btmpfs%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;File%20Store",
    "properties" : {
      "name" : "File Store"
    },
    "id" : "File Store"
  },
  "properties" : {
    "name" : "File Store [tmpfs]"
  },
  "id" : "File Store [tmpfs]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;File%20Store%20%5Bmqueue%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;File%20Store",
    "properties" : {
      "name" : "File Store"
    },
    "id" : "File Store"
  },
  "properties" : {
    "name" : "File Store [mqueue]"
  },
  "id" : "File Store [mqueue]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;File%20Store%20%5Bhugetlbfs%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;File%20Store",
    "properties" : {
      "name" : "File Store"
    },
    "id" : "File Store"
  },
  "properties" : {
    "name" : "File Store [hugetlbfs]"
  },
  "id" : "File Store [hugetlbfs]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;File%20Store%20%5Bsunrpc%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;File%20Store",
    "properties" : {
      "name" : "File Store"
    },
    "id" : "File Store"
  },
  "properties" : {
    "name" : "File Store [sunrpc]"
  },
  "id" : "File Store [sunrpc]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;File%20Store%20%5B%2Fdev%2Fsda1%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;File%20Store",
    "properties" : {
      "name" : "File Store"
    },
    "id" : "File Store"
  },
  "properties" : {
    "name" : "File Store [/dev/sda1]"
  },
  "id" : "File Store [/dev/sda1]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;File%20Store%20%5B%2Fdev%2Fmapper%2Fvg_mazztower-lv_home2%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;File%20Store",
    "properties" : {
      "name" : "File Store"
    },
    "id" : "File Store"
  },
  "properties" : {
    "name" : "File Store [/dev/mapper/vg_mazztower-lv_home2]"
  },
  "id" : "File Store [/dev/mapper/vg_mazztower-lv_home2]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;File%20Store%20%5B%2Fdev%2Fmapper%2Fvg_mazztower-lv_home%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;File%20Store",
    "properties" : {
      "name" : "File Store"
    },
    "id" : "File Store"
  },
  "properties" : {
    "name" : "File Store [/dev/mapper/vg_mazztower-lv_home]"
  },
  "id" : "File Store [/dev/mapper/vg_mazztower-lv_home]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;File%20Store%20%5B%2Fdev%2Fmapper%2Fvg_mazztower-lv_root%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;File%20Store",
    "properties" : {
      "name" : "File Store"
    },
    "id" : "File Store"
  },
  "properties" : {
    "name" : "File Store [/dev/mapper/vg_mazztower-lv_root]"
  },
  "id" : "File Store [/dev/mapper/vg_mazztower-lv_root]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;Processor%20%5B0%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;Processor",
    "properties" : {
      "name" : "Processor"
    },
    "id" : "Processor"
  },
  "properties" : {
    "name" : "Processor [0]"
  },
  "id" : "Processor [0]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;Processor%20%5B1%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;Processor",
    "properties" : {
      "name" : "Processor"
    },
    "id" : "Processor"
  },
  "properties" : {
    "name" : "Processor [1]"
  },
  "id" : "Processor [1]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;Processor%20%5B2%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;Processor",
    "properties" : {
      "name" : "Processor"
    },
    "id" : "Processor"
  },
  "properties" : {
    "name" : "Processor [2]"
  },
  "id" : "Processor [2]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;Processor%20%5B3%5D",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;Processor",
    "properties" : {
      "name" : "Processor"
    },
    "id" : "Processor"
  },
  "properties" : {
    "name" : "Processor [3]"
  },
  "id" : "Processor [3]"
}, {
  "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/r;GNU%2FLinux%20Fedora%2021%20(Twenty%20One)/r;Memory",
  "type" : {
    "path" : "/t;28026b36-8fe4-4332-84c8-524e173a68bf/e;test/f;mazztower/rt;Memory",
    "properties" : {
      "name" : "Memory"
    },
    "id" : "Memory"
  },
  "properties" : {
    "name" : "Memory"
  },
  "id" : "Memory"
} ]


More information about the hawkular-dev mailing list