错误 - “INVALID”不是有效的启动令牌

sat*_*tya 8 weblogic prometheus

我可以看到目标状态为关闭,并且错误“INVALID”不是普罗米修斯控制台中的有效启动令牌。

我按照以下步骤操作:

  1. 在 linux1 机器上安装 Prometheus。
  2. 在 linux2 机器上安装 weblogic。
  3. 在weblogic服务器上部署jar文件
  4. 验证仪表
  5. 在 prometheus.yml 中添加 weblogic 服务器条目
  6. 重新启动普罗米修斯服务。

以下是详细信息——

普罗米修斯日志:

level=warn ts=2019-09-06T11:42:42.187Z caller=scrape.go:937 组件=“抓取管理器” scrape_pool=weblogic1 target=http://************。*.****.* :7001/wls-exporter msg="追加失败" err="\"INVALID\" 不是有效的启动令牌"

curl output1 :-
-bash-4.2$ curl http://**********.***.****.***:7001/wls-exporter | promtool check metrics
-bash: promtool: command not found
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1783  100  1783    0     0   323k      0 --:--:-- --:--:-- --:--:--  348k
(23) Failed writing body
-bash-4.2$

curl output2 :-
-bash-4.2$ curl -v --noproxy '*' 'http://**********.***.****.***:7001/wls-exporter'
* About to connect() to **********.***.****.*** port 7001 (#0)
*   Trying **.**.***.***...
* Connected to **********.***.****.*** (**.**.***.***) port 7001 (#0)
> GET /wls-exporter HTTP/1.1
> User-Agent: curl/7.29.0
> Host: **********.***.****.***:7001
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 06 Sep 2019 11:27:23 GMT
< Content-Length: 1783
<
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Weblogic Monitoring Exporter</title>
</head>
<body>
<h2>This is the WebLogic Monitoring Exporter.</h2>
<p>The metrics are found at <a href="/wls-exporter/metrics">
metrics</a> relative to this location.
</p>
<h2>Configuration</h2>
<p>To change the configuration:</p>
<form action="/wls-exporter/configure" method="post" enctype="multipart/form-data">
    <input type="radio" name="effect" value="append">Append
    <input type="radio" name="effect" value="replace" checked="checked">Replace
    <br><input type="file" name="configuration">
    <br><input type="submit">
</form>
<p>Current Configuration</p>
<p><code><pre>
host: **********.***.****.***
port: 7001
query_sync:
  url: http://coordinator:8999/
  refreshInterval: 5
metricsNameSnakeCase: true
domainQualifier: true
restPort: 7001
queries:
- key: name
  keyName: server
  applicationRuntimes:
    key: name
    keyName: app
    componentRuntimes:
      type: WebAppComponentRuntime
      prefix: webapp_config_
      key: name
      values: [deploymentState, contextRoot, sourceInfo, openSessionsHighCount, openSessionsCurrentCount, sessionsOpenedTotalCount, sessionCookieMaxAgeSecs, sessionInvalidationIntervalSecs, sessionTimeoutSecs, singleThreadedServletPoolSize, sessionIDLength, servletReloadCheckSecs, jSPPageCheckSecs]
      servlets:
        prefix: weblogic_servlet_
        key: servletName
        values: [invocationTotalCount, reloadTotal, executionTimeAverage, poolMaxCapacity, executionTimeTotal, reloadTotalCount, executionTimeHigh, executionTimeLow]
- JVMRuntime:
    prefix: jvm_
    key: name
    values: [heapFreeCurrent, heapFreePercent, heapSizeCurrent, heapSizeMax, uptime, processCpuLoad]
</pre></code></p>
* Connection #0 to host **********.***.****.*** left intact
-bash-4.2$
Run Code Online (Sandbox Code Playgroud)

Mic*_*bez 7

当 Prometheus 需要OpenMetric 格式但得到其他格式""INVALID" is not a valid start token"时,通常会遇到该错误。在这种情况下,如果您省略URL 末尾的 或导出器报告错误页面 ( ./metrics401 - Authentication required

查看相关源代码,Prometheus发送给导出器的身份验证令牌似乎被转发到Weblogic API。普罗米修斯配置应如下所示:

- job_name: 'weblogic'
  ...
  basic_auth:
    username: weblogic
    password: friend
Run Code Online (Sandbox Code Playgroud)

curl您可以使用相关参数进行测试:

curl -u 'weblogic:friend' http://**********.***.****.***:7001/wls-exporter/metrics | promtool check metrics
Run Code Online (Sandbox Code Playgroud)