hawkular / hawkular-openshift-agent

A Hawkular feed that collects metrics from Prometheus and/or Jolokia endpoints deployed in one or more pods within an OpenShift node.
16 stars 21 forks source link

No MBean with pattern found for reading attributes #158

Closed ljuaneda closed 7 years ago

ljuaneda commented 7 years ago

Patten is a great improvement, still I've found some errors with some metric definitions.

Metrics definition :

      - name: jboss.as:deployment=cicseci.rar,subsystem=resource-adapters,statistics=statistics,connection-definitions=*/ActiveCount
        type: gauge
        description: JCA ${connection-definitions} ActiveCount
        tags:
          resource_id: jca
      - name: jboss.as:subsystem=datasources,data-source=*,statistics=pool/ActiveCount
        type: gauge
        description: JDBC ${data-source} ActiveCount
        tags:
          resource_id: jdbc

HOSA logs:

W0323 15:54:57.123773       1 jolokia_metrics_collector.go:128] Failed to collect metric [jboss.as:deployment=cicseci.rar,subsystem=resource-adapters,statistics=statistics,connection-definitions=*/ActiveCount] from Jolokia endpoint [https://10.130.5.77:8778/jolokia/]. err=javax.management.InstanceNotFoundException/javax.management.InstanceNotFoundException : No MBean with pattern jboss.as:deployment=cicseci.rar,subsystem=resource-adapters,statistics=statistics,connection-definitions=*/ActiveCount found for reading attributes
W0323 15:54:57.123824       1 jolokia_metrics_collector.go:128] Failed to collect metric [jboss.as:subsystem=datasources,data-source=*,statistics=pool/ActiveCount] from Jolokia endpoint [https://10.130.5.77:8778/jolokia/]. err=javax.management.InstanceNotFoundException/javax.management.InstanceNotFoundException : No MBean with pattern jboss.as:subsystem=datasources,data-source=*,statistics=pool/ActiveCount found for reading attributes

Same request with cUrl:

[root@siy05ez1:~]# curl -ks -H "Authorization: Bearer $(oc sa get-token management-admin -n management-infra)" -H "Content-Type: application/json" --cert /etc/origin/master/master.proxy-client.crt --key /etc/origin/master/master.proxy-client.key "https://10.130.5.77:8778/jolokia/read/jboss.as:deployment=cicseci.rar,subsystem=resource-adapters,statistics=statistics,connection-definitions=*/ActiveCount" | jq
{
  "request": {
    "mbean": "jboss.as:connection-definitions=*,deployment=cicseci.rar,statistics=statistics,subsystem=resource-adapters",
    "attribute": "ActiveCount",
    "type": "read"
  },
  "value": {
    "jboss.as:connection-definitions=\"java:jboss/resources/ref/ECIHOST_RNX\",deployment=cicseci.rar,statistics=statistics,subsystem=resource-adapters": {
      "ActiveCount": 0
    }
  },
  "timestamp": 1490284755,
  "status": 200
}
[root@siy05ez1:~]# curl -ks -H "Authorization: Bearer $(oc sa get-token management-admin -n management-infra)" -H "Content-Type: application/json" --cert /etc/origin/master/master.proxy-client.crt --key /etc/origin/master/master.proxy-client.key "https://10.130.5.77:8778/jolokia/read/jboss.as:subsystem=datasources,data-source=*,statistics=pool/ActiveCount" | jq
{
  "request": {
    "mbean": "jboss.as:data-source=*,statistics=pool,subsystem=datasources",
    "attribute": "ActiveCount",
    "type": "read"
  },
  "value": {
    "jboss.as:data-source=BDD_RNX,statistics=pool,subsystem=datasources": {
      "ActiveCount": 0
    },
    "jboss.as:data-source=BDD_RNXQG1,statistics=pool,subsystem=datasources": {
      "ActiveCount": 0
    },
    "jboss.as:data-source=BDD_RNXUV_,statistics=pool,subsystem=datasources": {
      "ActiveCount": 0
    },
    "jboss.as:data-source=ExampleDS,statistics=pool,subsystem=datasources": {
      "ActiveCount": 0
    },
    "jboss.as:data-source=BDD_RNXK61,statistics=pool,subsystem=datasources": {
      "ActiveCount": 0
    }
  },
  "timestamp": 1490284692,
  "status": 200
}
jmazzitelli commented 7 years ago

Your configuration is incorrect. Remember, HOSA asks that you define your jolokia metric names in the following format:

object-name#attribute[#optional-inner-path]

You are using "/" instead of "#" as the separator:

   - name: jboss.as:deployment=cicseci.rar,subsystem=resource-adapters,statistics=statistics,connection-definitions=*/ActiveCount
   ...
   - name: jboss.as:subsystem=datasources,data-source=*,statistics=pool/ActiveCount

Instead of "/ActiveCount" you should be using "#ActiveCount"

ljuaneda commented 7 years ago

Oups sorry Don't know how I've missed that