错误-“ INVALID”不是有效的开始令牌

时间:2019-09-06 14:21:58

标签: weblogic prometheus

我可以看到目标状态为down,并且在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呼叫者= scrape.go:937 component =“ scrape manager” scrape_pool = weblogic1 target = http:// ********** 。 *。****。* :7001 / wls-exporter msg =“追加失败” err =“ \” INVALID \“不是有效的开始令牌”

$session = new AppSessionHandler();
$session->start();
$_SESSION['msg'] = 'This data should be encrypted';`

2 个答案:

答案 0 :(得分:0)

当Prometheus期望OpenMetric format却得到其他东西时,通常会遇到错误""INVALID" is not a valid start token"。在这种情况下,如果您在网址的en处省略了/metrics,或者如果出口商报告了一个错误页面(401 - Authentication required,则出口商的登录页面。

查看the relevant source code,似乎Prometheus发送给导出器的身份验证令牌已转发到Weblogic API。 Prometheus配置应如下所示:

- job_name: 'weblogic'
  ...
  basic_auth:
    username: weblogic
    password: friend

您可以使用带有相关参数的curl对其进行测试:

curl -u 'weblogic:friend' http://**********.***.****.***:7001/wls-exporter/metrics | promtool check metrics

答案 1 :(得分:0)

在我的情况下,我的/metrics端点意外地有一个\ufeff字节序标记(因为在C#.Net中,我叫new StreamWriter(httpListenerResponse.OutputStream, Encoding.UTF8)而不是new UTF8Encoding(false))。因此,请仔细检查以确保在获取指标端点(例如curl localhost:8080/metrics | hexdump -c)时,它们都是ASCII,并且文档看起来像prometheus exposition format