首页
赞助
统计与资源监控
直播
工作性价比
人生模拟器
友联
疫情
更多
留言
版本迭代
推荐
院长技术团队
Search
1
院长技术
426,223 阅读
2
本站QQ官方群:645072509------|院长诚邀各位大佬的入驻
425,876 阅读
3
云+社区---年度最佳作者奖
419,020 阅读
4
暂停,待修复:院长一键部署K8s---Kubeadm,支持多版本
359,688 阅读
5
院长导航站---很有范的导航
228,017 阅读
Windows
Linux
虚拟化
Xen
Esxi
Kvm
Docker
Podman
Kubernetes
OpenStack
数据库
Redis
Oracle
MySQL
Access
MariaDB
MongoDB
SQLserver
Cassandra
Memcached
编程
Go
CSS
PHP
HTML
Java
Shell
Python
jQuery
JavaScript
监控
Zabbix
Cacti
Nagios
Grafana
RabbitMQ
Prometheus
Open_Falcon
存储
Ceph
DRBD
NFS
DevOps
Git
LVS
Istio
KALI
Helm
Kafka
CI/CD
Gitlab
Maven
Harbor
Kibana
Jenkins
Ansible
Logstash
Saltstack
E [FL] K
Keepalived
ElasticSearch
JumpServer
大杂烩
工具箱
短视频
音乐鉴赏
精选壁纸
新冠肺炎
杂货技术
关于院长
登录
/
注册
Search
标签搜索
虚拟化
Ceph
RabbitMq
双机热备
Linux
数据库
程序员常见职业病列表
院长Dean
累计撰写
840
篇文章
累计收到
265
条评论
首页
栏目
Windows
Linux
虚拟化
Xen
Esxi
Kvm
Docker
Podman
Kubernetes
OpenStack
数据库
Redis
Oracle
MySQL
Access
MariaDB
MongoDB
SQLserver
Cassandra
Memcached
编程
Go
CSS
PHP
HTML
Java
Shell
Python
jQuery
JavaScript
监控
Zabbix
Cacti
Nagios
Grafana
RabbitMQ
Prometheus
Open_Falcon
存储
Ceph
DRBD
NFS
DevOps
Git
LVS
Istio
KALI
Helm
Kafka
CI/CD
Gitlab
Maven
Harbor
Kibana
Jenkins
Ansible
Logstash
Saltstack
E [FL] K
Keepalived
ElasticSearch
JumpServer
大杂烩
工具箱
短视频
音乐鉴赏
精选壁纸
新冠肺炎
杂货技术
关于院长
页面
赞助
统计与资源监控
直播
工作性价比
人生模拟器
友联
疫情
留言
版本迭代
推荐
院长技术团队
搜索到
3
篇与
Prometheus
的结果
2021-02-02
K8s---Prometheus+Altermanager钉钉报警
一、添加钉钉机器人参考钉钉官方文档:https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq二、在k8s上部署钉钉告警deployment,这里我们引用第三方的插件。[root@cn-hongkong webhook-dingtalk]# cat webhook-dingtalk.yaml apiVersion: apps/v1beta2 kind: Deployment metadata: labels: app: webhook-dingtalk name: webhook-dingtalk namespace: monitoring #需要和alertmanager在同一个namespace spec: replicas: 1 selector: matchLabels: app: webhook-dingtalk template: metadata: labels: app: webhook-dingtalk spec: containers: - image: billy98/webhook-dingtalk:latest name: webhook-dingtalk args: - "https://oapi.dingtalk.com/robot/send?access_token=1fd59067ab85bea575122a5e4f05cefd6609d9d3e41a725e46a90c2fad9b3" #上面创建的钉钉机器人hook ports: - containerPort: 8080 protocol: TCP resources: requests: cpu: 100m memory: 100Mi limits: cpu: 500m memory: 500Mi livenessProbe: failureThreshold: 3 initialDelaySeconds: 30 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 tcpSocket: port: 8080 readinessProbe: failureThreshold: 3 initialDelaySeconds: 30 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 httpGet: port: 8080 path: / imagePullSecrets: - name: IfNotPresent --- apiVersion: v1 kind: Service metadata: labels: app: webhook-dingtalk name: webhook-dingtalk namespace: monitoring #需要和alertmanager在同一个namespace spec: ports: - name: http port: 80 protocol: TCP targetPort: 8080 selector: app: webhook-dingtalk type: ClusterIP三、alertmanager添加钉钉告警类型config: global: resolve_timeout: 5m route: group_by: ['job','severity'] group_wait: 30s group_interval: 5m repeat_interval: 12h receiver: default receiver: webhook routes: - match: filesystem: node receiver: webhook receivers: - name: webhook webhook_configs: - url: http://webhook-dingtalk/dingtalk/send/ send_resolved: true四、查看告警信息
2021年02月02日
298 阅读
0 评论
2 点赞
2020-06-07
Prometheus监控OpenStack
安装dockerLatest Docker master images: docker pull quay.io/niedbalski/openstack-exporter-linux-amd64:master docker pull quay.io/niedbalski/openstack-exporter-linux-arm64:master Latest Docker release images: docker pull quay.io/niedbalski/openstack-exporter-linux-amd64:v0.9.0 docker pull quay.io/niedbalski/openstack-exporter-linux-arm64:v0.9.0二进制https://github.com/openstack-exporter/openstack-exporter/releases命令sage: openstack-exporter [<flags>] <cloud> Flags: -h, --help Show context-sensitive help (also try --help-long and --help-man). --web.listen-address=":9180" address:port to listen on --web.telemetry-path="/metrics" uri path to expose metrics --os-client-config="/etc/openstack/clouds.yaml" Path to the cloud configuration file --prefix="openstack" Prefix for metrics --endpoint-type="public" openstack endpoint type to use (i.e: public, internal, admin) -d, --disable-metric= ... multiple --disable-metric can be specified in the format: service-metric (i.e: cinder-snapshots) --disable-service.network Disable the network service exporter --disable-service.compute Disable the compute service exporter --disable-service.image Disable the image service exporter --disable-service.volume Disable the volume service exporter --disable-service.identity Disable the identity service exporter Args: <cloud> name or id of the cloud to gather metrics fromOpenStack configurationclouds: default: region_name: {{ openstack_region_name }} identity_api_version: 3 identity_interface: internal auth: username: {{ keystone_admin_user }} password: {{ keystone_admin_password }} project_name: {{ keystone_admin_project }} project_domain_name: 'Default' user_domain_name: 'Default' auth_url: {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }}/v3对接grafanahttps://grafana.com/grafana/dashboards/9701
2020年06月07日
773 阅读
0 评论
0 点赞
2020-06-07
Prometheus查询
表达式语言数据类型在Prometheus的表达式语言中,任何表达式或者子表达式都可以归为四种类型:即时向量(instant vector) 包含每个时间序列的单个样本的一组时间序列,共享相同的时间戳。 范围向量(Range vector) 包含每个时间序列随时间变化的数据点的一组时间序列。 标量(Scalar) 一个简单的数字浮点值 字符串(String) 一个简单的字符串值(目前未被使用)根据使用情况(例如绘图或者显示表达式的输出),这些类型中只有一些是由用户指定的表达式产生的结果而有效的,例如,即时向量表达式是可以绘图的唯一类型。字符串字符串可以用单引号、双引号或者反引号表示PromQL遵循与Go相同的转义规则。在单引号,双引号中,反斜杠成为了转义字符,后面可以跟着a, b, f, n, r, t, v或者。 可以使用八进制(nnn)或者十六进制(xnn, unnnn和Unnnnnnnn)提供特定字符。在反引号内不处理转义字符。与Go不同,Prom不会丢弃反引号中的换行符。例如:"this is a string" 'these are unescaped: \n \\ \t' `these are not unescaped: \n ' " \t`浮点数标量浮点值可以直接写成形式-[.(digits)]。-2.43时间序列选择器即时向量选择器瞬时向量选择器可以对一组时间序列数据进行筛选,并给出结果中的每个结果键值对(时间戳-样本值): 最简单的形式是,只有一个度量名称被指定。在一个瞬时向量中这个结果包含有这个度量指标名称的所有样本数据键值对。下面这个例子选择所有时间序列度量名称为http_requests_total的样本数据:http_requests_total通过在度量指标后面增加{}一组标签可以进一步地过滤这些时间序列数据。下面这个例子选择了度量指标名称为http_requests_total,且一组标签为job=prometheus, group=canary:http_requests_total{job=”prometheus”,group=”canary”}可以采用不匹配的标签值也是可以的,或者用正则表达式不匹配标签。标签匹配操作如下所示:=: 精确地匹配标签给定的值!=: 不等于给定的标签值=~: 正则表达匹配给定的标签值!=: 给定的标签值不符合正则表达式例如:度量指标名称为http_requests_total,正则表达式匹配标签environment为staging, testing, development的值,且http请求方法不等于GET。http_requests_total{environment=~”staging|testing|development”, method!=”GET”}匹配空标签值的标签匹配器也可以选择没有设置任何标签的所有时间序列数据。正则表达式完全匹配。向量选择器必须指定一个度量指标名称或者至少不能为空字符串的标签值。以下表达式是非法的:{job=~”.*”} #Bad!上面这个例子既没有度量指标名称,标签选择器也可以正则匹配空标签值,所以不符合向量选择器的条件相反地,下面这些表达式是有效的,第一个一定有一个字符。第二个有一个有用的标签method{job=~”.+”} # Good!{job=~”.*”, method=”get”} # Good!标签匹配器能够被应用到度量指标名称,使用__name__标签筛选度量指标名称。例如:表达式http_requests_total等价于{__name__="http_requests_total"}。 其他的匹配器,如:= ( !=, =~, !~)都可以使用。下面的表达式选择了度量指标名称以job:开头的时间序列数据:{name=~”^job:.*”} #范围向量选择器范围向量类似瞬时向量, 不同在于,它们从当前实例选择样本范围区间。在语法上,时间长度被追加在向量选择器尾部的方括号[]中,用以指定对于每个样本范围区间中的每个元素应该抓取的时间范围样本区间。时间长度有一个数值决定,后面可以跟下面的单位:s - seconds m - minutes h - hours d - days w - weeks y - years在下面这个例子中, 选择过去5分钟内,度量指标名称为http_requests_total, 标签为job="prometheus"的时间序列数据:http_requests_total{job=”prometheus”}[5m]偏移修饰符这个offset偏移修饰符允许在查询中改变单个瞬时向量和范围向量中的时间偏移例如,下面的表达式返回相对于当前时间的前5分钟时的时刻, 度量指标名称为http_requests_total的时间序列数据:http_requests_total offset 5m注意:offset偏移修饰符必须直接跟在选择器后面,例如:sum(http_requests_total{method=”GET”} offset 5m) // GOOD.然而,下面这种情况是不正确的sum(http_requests_total{method=”GET”}) offset 5m // INVALID.offset偏移修饰符在范围向量上和瞬时向量用法一样的。下面这个返回了相对于当前时间的前一周时,过去5分钟的度量指标名称为http_requests_total的速率:rate(http_requests_total[5m] offset 1w)参考链接https://prometheus.io/docs/prometheus/latest/querying/functions/
2020年06月07日
196 阅读
0 评论
0 点赞