time_zone: 'Asia/Shanghai' 这样,Prometheus就会使用上海的时区作为默认时区。接下来,我们需要确保在查询和图表中正确显示时间。这可以通过在查询中使用now()函数来实现。now()函数将返回当前的时间戳,以本地时区为基准。例如: sum(rate({__name__=~“job:requests:rate1m”}[1m])) by (instance) 在这个查...
官方Prometheus镜像,使用的不是咱们上海的时区,我们可以用上海时区文件创建一个configmap,然后挂载到启动的Prometheus容器里: kubectl create configmap prometheus-time-zone --from-file=/usr/share/zoneinfo/Asia/Shanghai 然后挂载: volumeMounts: - name: prometheus-time-zone mountPath: /etc/localtime subPath: ...
kubectl create configmap prometheus-time-zone --from-file=/usr/share/zoneinfo/Asia/Shanghai 然后挂载:volumeMounts:- name: prometheus-time-zone mountPath: /etc/localtime subPath: Shanghai 然后可以把容器⾥的时区改成上海时区,东⼋区 ⽤date 验证时间是本地时间了 但这个只是改了Prometheus容器得...
-loggerTimezone Asia/Shanghai#设置时区 -retentionPeriod 3#数据保留时间,默认1m(一个月),支持:h、d、w、m、y vmstorage: -vminsertAddr :8400#允许vminsert访问的端口 -vmselectAddr :8401#允许vmselect访问的端口 vminsert: -storageNode 2.2.2.15:8400,2.2.2.25:8400,2.2.2.35:8400#vmstorage节点 -repli...
timedatectl set-timezone Asia/Shanghai * * * * * ntpdate -u cn.pool.ntp.org 直接执行./prometheus,即运行起来了。端口默认监控9090,直接在浏览器访问127.0.0.1:9090即可。默认没有账号密码验证,可以采用基础http验证,类似于httpass。 prometheus配置文件 ...
- /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro command: -'--config.file=/etc/prometheus/prometheus.yml' -'--storage.tsdb.path=/prometheus' depends_on: - node-exporter environment: - TZ=Asia/Shanghai networks: ...
发现修改变量TZ=Asia/Shanghai,修改/etc/localtime 文件都无法修改时区,均失败了。 那么解决办法,就只有自己封装prometheus镜像了。 二、启动prometheus 环境说明 操作系统:centos 7.6 docker版本:19.03.5 ip地址:192.168.31.229 封装prometheus 目录结构 新建目录/opt/myprometheus,目录结构如下: ...
timedatectl set-timezone Asia/Shanghai ntpdate -u 1.cn.pool.ntp.org systemctl enable ntpd systemctl enable ntpdate 1. 2. 3. 4. 第一prometheus告警项目资料地址 github: https:///feiyu563/PrometheusAlert 1. 国内: https://gitee.com/feiyu563/PrometheusAlert ...
//mirror.centos.org/centos/\$releasever|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/$minorver|g" \ -i.bak \ /etc/yum.repos.d/CentOS-*.repoyum makecache# 时间和时区yum install ntpdate# 设置时区timedatectl set-timezone Asia/Shanghaintpdate ntp.aliyun.com# 查看时间date...
DST active: n/a#或# ll /etc/localtimelrwxrwxrwx. 1 root root 35 Nov 3 15:46 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai 2. 设置时区 # timedatectl set-timezone Asia/Shanghai#或# rm -f /etc/localtime# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ...