Comments (3)
原生支持的http_basic认证,如下:
http_basic_auth_example:
prober: http
timeout: 5s
http:
method: POST
headers:
Host: "login.example.com"
basic_auth:
username: "username"
password: "mysecret"
如果不支持http basic,也可以考虑在headers中传递token之类的方式。
from prometheus-book.
我的blackbox.yml的配置:如下
modules:
http_basic_auth_eureka:
prober: http
timeout: 50s
http:
preferred_ip_protocol: "ip4"
#valid_status_codes: [200,301]
method: POST
headers:
Host: "192.168.11:11:8888"
Cache-Control: no-cache
#Content-Type: application/xhtml+xml
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
basic_auth:
username: 'eureka'
password: '********'
浏览器输入http://192.168.11.10:9115/probe?module=http_basic_auth_eureka&target=192.168.11.11:8888&debug=true
返回的结果
Logs for the probe:
ts=2018-10-14T13:44:05.812604029Z caller=main.go:116 module=http_basic_auth_eureka target=192.168.11.11:8889 level=info msg="Beginning probe" probe=http timeout_seconds=9.5
ts=2018-10-14T13:44:05.812991876Z caller=utils.go:42 module=http_basic_auth_eureka target=192.168.11.11:8889 level=info msg="Resolving target address" preferred_ip_protocol=ip4
ts=2018-10-14T13:44:05.813048814Z caller=utils.go:65 module=http_basic_auth_eureka target=192.168.11.11:8889 level=info msg="Resolved target address" ip=192.168.11.11
ts=2018-10-14T13:44:05.813133583Z caller=http.go:282 module=http_basic_auth_eureka target=192.168.11.11:8889 level=info msg="Making HTTP request" url=http://192.168.11.11:8889 host=192.168.11:11:8888
ts=2018-10-14T13:44:05.815049201Z caller=http.go:300 module=http_basic_auth_eureka target=192.168.11.11:8889 level=info msg="Received HTTP response" status_code=400
ts=2018-10-14T13:44:05.815126856Z caller=http.go:315 module=http_basic_auth_eureka target=192.168.11.11:8889 level=info msg="Invalid HTTP response status code, wanted 2xx" status_code=400
ts=2018-10-14T13:44:05.815197566Z caller=http.go:354 module=http_basic_auth_eureka target=192.168.11.11:8889 level=info msg="Response timings for roundtrip" roundtrip=0 start=2018-10-14T21:44:05.81340103+08:00 dnsDone=2018-10-14T21:44:05.81340103+08:00 connectDone=2018-10-14T21:44:05.813792176+08:00 gotConn=2018-10-14T21:44:05.813820583+08:00 responseStart=2018-10-14T21:44:05.814958826+08:00 end=2018-10-14T21:44:05.815028447+08:00
ts=2018-10-14T13:44:05.815457064Z caller=main.go:129 module=http_basic_auth_eureka target=192.168.11.11:8889 level=error msg="Probe failed" duration_seconds=0.00269175
返回的http code 为400,我的username和password是正确了,那里出问题了?大佬
from prometheus-book.
并没返回403的错误码,400是Bad Request。 检查一下你服务的日志呢
from prometheus-book.
Related Issues (20)
- https://yunlzheng.gitbook.io/prometheus-book/ 在线文档应该挂掉了;请问是不维护了吗?
- 使用手机微信 GitHub 小程序便捷查看该教程 HOT 4
- "最佳实践:4个黄金指标和USE方法 "能否附上一个配置实例? HOT 1
- 添加grafana图表时, 变量如何匹配? HOT 2
- 有几处小的书写错误
- 请问:怎么返回多个指标的值(显示为一行),并可以根据其中一个指标的值来排序? HOT 2
- 请教一个关于企业微信的alertmanager问题 HOT 4
- 第5章 数据与可视化
- 第3章告警处理的“屏蔽告警通知”表述有严重问题 HOT 1
- Alertmanager 高可用章节给了错误的配置范例
- 如何实现跟zabbix一样设置维护时间段的功能?
- please update the test data , many metrics are gone or upgraded HOT 1
- Use 'apps/v1' to replace 'extensions/v1beta1' for example-app deployment HOT 1
- ”Alertmanager高可用”章节搭建案例问题
- current value: {{ $value }} 报警恢复的时候,这个值不准确,怎么办? HOT 2
- gitbook页面优化
- grafana模板变量不能获取集群信息
- docker安装prometheus有误 HOT 2
- 饱和度问题
- 请问使用client_java 自定义的exporter 如何实现账号密码登录后可见? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prometheus-book.