如何将api指标推送到pushgateway或node_exporter?
我在prometheus.yml文件中放置了以下内容:
global:
scrape_interval: 1s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'pushgateway'
static_configs:
- targets: ['localhost:9091']
- job_name: 'api-server'
metrics_path: /nifi-api/system-diagnostics
static_configs:
- targets: ['localhost:19090']
但是我遇到以下错误:
level = warn ts = 2019-09-26T12:15:20.732Z呼叫者= scrape.go:930 component =“ scrape manager” scrape_pool = api-server target = http://localhost:19090/nifi-api/system-diagnostics msg =“ append failed” err =“ \” INVALID \“不是有效的开始令牌”
我的api就是这样的http://localhost:19090/nifi-api/system-diagnostics
{
"systemDiagnostics":{
"aggregateSnapshot":{
"totalNonHeap":"158.5 MB",
"totalNonHeapBytes":166199296,
"usedNonHeap":"147.66 MB",
"usedNonHeapBytes":154831352,
"freeNonHeap":"10.84 MB",
"freeNonHeapBytes":11367944,
"maxNonHeap":"-1 bytes",
"maxNonHeapBytes":-1,
"totalHeap":"512 MB",
"totalHeapBytes":536870912,
"usedHeap":"238 MB",
"usedHeapBytes":249561088,
"freeHeap":"274 MB",
"freeHeapBytes":287309824,
"maxHeap":"512 MB",
"maxHeapBytes":536870912,
"heapUtilization":"46.0%",
"availableProcessors":4,
"processorLoadAverage":0.01,
"totalThreads":69,
"daemonThreads":30,
"uptime":"00:40:57.197",
"flowFileRepositoryStorageUsage":{
"freeSpace":"36.08 GB",
"totalSpace":"42.22 GB",
"usedSpace":"6.14 GB",
"freeSpaceBytes":38741389312,
"totalSpaceBytes":45335056384,
"usedSpaceBytes":6593667072,
"utilization":"15.0%"
},
"contentRepositoryStorageUsage":[
{
"identifier":"default",
"freeSpace":"36.08 GB",
"totalSpace":"42.22 GB",
"usedSpace":"6.14 GB",
"freeSpaceBytes":38741389312,
"totalSpaceBytes":45335056384,
"usedSpaceBytes":6593667072,
"utilization":"15.0%"
}
],
"provenanceRepositoryStorageUsage":[
{
"identifier":"default",
"freeSpace":"36.08 GB",
"totalSpace":"42.22 GB",
"usedSpace":"6.14 GB",
"freeSpaceBytes":38741389312,
"totalSpaceBytes":45335056384,
"usedSpaceBytes":6593667072,
"utilization":"15.0%"
}
],
"garbageCollection":[
{
"name":"G1 Young Generation",
"collectionCount":32,
"collectionTime":"00:00:00.974",
"collectionMillis":974
},
{
"name":"G1 Old Generation",
"collectionCount":0,
"collectionTime":"00:00:00.000",
"collectionMillis":0
}
],
"statsLastRefreshed":"17:52:11 IST",
"versionInfo":{
"niFiVersion":"1.9.0.1.0.0.0-90",
"javaVendor":"Oracle Corporation",
"javaVersion":"1.8.0_131",
"osName":"Linux",
"osVersion":"3.10.0-1062.1.2.el7.x86_64",
"osArchitecture":"amd64",
"buildTag":"nifi-1.9.0-RC2",
"buildRevision":"af31e41",
"buildBranch":"UNKNOWN",
"buildTimestamp":"03/29/2019 16:40:44 IST"
}
}
}
}
我想将api指标公开给普罗米修斯。
有人可以帮助我找到此解决方案吗?