Name: mackerel-plugin-json
Owner: Mackerel
Description: null
Created: 2018-01-10 02:31:48.0
Updated: 2018-01-10 02:46:43.0
Pushed: 2018-02-22 07:02:30.0
Homepage: null
Size: 12
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Json custom metrics plugin for mackerel.io agent.
erel-plugin-json -url=<url to get JSON> [-prefix=<prefix for a metric name>] [-insecure] [-include=<expression>] [-exclude=<expression>]
-url
always needs to be specified.-insecure
.-include
. If you want to get only ones that doesn't match an expression, use -exclude
.null
, etc.) are omitted.custom.elements.0.xxx
, custom.elements.1.xxx
and so on.mkr plugin install mackerelio/mackerel-plugin-json
gin.metrics.jolokia]
and = mackerel-plugin-json -url='http://127.0.0.1:8778/jolokia/read/java.lang:type=Memory' -include='HeapMemoryUsage' -prefix='custom.jolokia'
Given the following JSON:
-s http://127.0.0.1:8778/jolokia/read/java.lang:type=Memory | jq .
equest": {
"mbean": "java.lang:type=Memory",
"type": "read"
alue": {
"ObjectPendingFinalizationCount": 0,
"Verbose": false,
"HeapMemoryUsage": {
"init": 1073741824,
"committed": 1069023232,
"max": 1069023232,
"used": 994632048
},
"NonHeapMemoryUsage": {
"init": 2555904,
"committed": 44040192,
"max": 1350565888,
"used": 43070016
},
"ObjectName": {
"objectName": "java.lang:type=Memory"
}
imestamp": 1455079714,
tatus": 200
The output should be:
tion : -url='http://127.0.0.1:8778/jolokia/read/java.lang:type=Memory'
om.value.HeapMemoryUsage.used 994632048.000000 1503586907
om.value.HeapMemoryUsage.init 1073741824.000000 1503586907
om.value.HeapMemoryUsage.max 1069023232.000000 1503586907
om.timestamp 1455079714.000000 1503586907
om.status 200.000000 1503586907
om.value.NonHeapMemoryUsage.committed 44040192.000000 1503586907
om.value.NonHeapMemoryUsage.max 1350565888.000000 1503586907
om.value.NonHeapMemoryUsage.used 43070016.000000 1503586907
om.value.NonHeapMemoryUsage.init 2555904.000000 1503586907
om.value.HeapMemoryUsage.committed 1069023232.000000 1503586907
tion : -url='http://127.0.0.1:8778/jolokia/read/java.lang:type=Memory' -include='\.HeapMemoryUsage'
om.value.HeapMemoryUsage.init 1073741824.000000 1503587081
om.value.HeapMemoryUsage.committed 1069023232.000000 1503587081
om.value.HeapMemoryUsage.max 1069023232.000000 1503587081
om.value.HeapMemoryUsage.used 994632048.000000 1503587081
tion : -url='http://127.0.0.1:8778/jolokia/read/java.lang:type=Memory' -exclude='(timestamp|status)'
om.value.HeapMemoryUsage.init 1073741824.000000 1503587166
om.value.HeapMemoryUsage.committed 1069023232.000000 1503587166
om.value.HeapMemoryUsage.max 1069023232.000000 1503587166
om.value.HeapMemoryUsage.used 994632048.000000 1503587166
om.value.NonHeapMemoryUsage.max 1350565888.000000 1503587166
om.value.NonHeapMemoryUsage.used 43070016.000000 1503587166
om.value.NonHeapMemoryUsage.init 2555904.000000 1503587166
om.value.NonHeapMemoryUsage.committed 44040192.000000 1503587166
You can also get metrics from any APIs that returns a JSON. For example:
tion : -url='https://[your-github-token]@api.github.com/repos/doublemarket/private-repo' -include='(_count|watchers|issues)' -prefix='custom.github.some-private-repo'
om.github.private-repo.open_issues_count 1171.000000 1503587879
om.github.private-repo.open_issues 1171.000000 1503587879
om.github.private-repo.network_count 15042.000000 1503587879
om.github.private-repo.forks_count 15042.000000 1503587879
om.github.private-repo.stargazers_count 36733.000000 1503587879
om.github.private-repo.subscribers_count 2444.000000 1503587879
om.github.private-repo.watchers_count 36733.000000 1503587879
om.github.private-repo.watchers 36733.000000 1503587879