一、概述

Prometheus是由SoundCloud开发的开源监控报警系统和时序列数据库(TSDB)。Prometheus使用Go语言开发,是Google BorgMon监控系统的开源版本。

环境说明

操作系统:centos 7.6
ip地址:192.168.31.150

下载包

https://prometheus.io/download/
目前最新版是:2.14.0
下载链接:
https://github.com/prometheus/prometheus/releases/download/v2.14.0/prometheus-2.14.0.linux-amd64.tar.gz

二、安装

useradd prometheus -s /sbin/nologin
tar zxvf prometheus-2.14..linux-amd64.tar.gz -C /data
mv /data/prometheus-2.14..linux-amd64 /data/prometheus
chown prometheus:prometheus -R /data/prometheus

封装service

vi /etc/systemd/system/prometheus.service

内容如下:

[Unit]
Description=Prometheus
After=network.target
[Service]
ExecStart=/data/prometheus/prometheus --config.file=/data/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheus/data
User=prometheus
[Install]
WantedBy=multi-user.target

注意:主要修改ExecStart和User

设置开机自启动

systemctl daemon-reload
systemctl enable prometheus
systemctl start prometheus

查看端口

# ss -tunlp|grep prometheus
tcp LISTEN ::: :::* users:(("prometheus",pid=,fd=))

如果是centos 6.x系统,需要自己写一个启动脚本。

vi /etc/init.d/prometheus

内容如下:

#!/bin/bash
# auditd Start jar package
# chkconfig: 2345 14 87
# description: This is admin project
#define var
PROJECT_SERVICE="prometheus"
PORT=""
. /etc/init.d/functions
export START="nohup /data/prometheus/prometheus --config.file=/data/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheus/data &"
#服务脚本
start(){
echo "${PROJECT_SERVICE} starting....."
cd /data/${PROJECT_SERVICE} && eval $START
if [ $? -eq 0 ];then
action "$PROJECT_SERVICE is starting" /bin/true
else
action "$PROJECT_SERVICE is starting" /bin/false
fi
}
stop(){
kill -9 `lsof -t -i:${PORT}`
if [ $? -eq 0 ];then
action "$PROJECT_SERVICE is stoping" /bin/true
else
action "$PROJECT_SERVICE is stoping" /bin/false
fi
}
status(){
if [ `ss -tunlp|grep ${PROJECT_SERVICE}|awk '{print $5}'|cut -d: -f4` = ${PORT} ];then
echo "${PROJECT_SERVICE} is running....."
else
echo "${PROJECT_SERVICE} is stopping....."
fi
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "$0 <start|stop|restart>"
esac

添加权限,并启动

chmod 755 /etc/init.d/prometheus
/etc/init.d/prometheus start

三、访问页面

访问targets
http://192.168.31.150:9090/targets

到这里,安装就结束了。

CentOS7安装Prometheus(二进制)的更多相关文章

  1. CentOS7安装Node_exporter(二进制)

    一.概述 Node_exporter是可以在* Nix和Linux系统上运行的计算机度量标准的导出器.Node_exporter 主要用于暴露 metrics 给 Prometheus,其中 metr ...

  2. CentOS7安装MySQL的方法之通用二进制格式

      CentOS7安装MySQL的方法之通用二进制格式          

  3. centos7下docker二进制安装

    问题描述: 内网离线环境下,安装docker.二进制来的还是快点,或者内网搭建yum的epel仓库! 环境: centos7.x docker-18.9.0 x86_64  static //二进制 ...

  4. CentOS7安装部署Prometheus+Grafana (转)

    转自:https://www.jianshu.com/p/967cb76cd5ca 作为监控系统的后起之秀,prometheus的安装可谓非常简单,不需要第三方的依赖(数据库.缓存.PHP之类的).下 ...

  5. [CentOs7]安装mysql(2)

    摘要 之前安装过一次mysql,最后配置,发现在本地无法连接,重启服务的时候一直卡在那里不动,感觉是安装的过程出问题,最后没办法还是卸载了,然后重新安装一下. [CentOs7]安装mysql Mys ...

  6. centos7安装kubeadm

    安装配置docker v1.9.0版本推荐使用docker v1.12, v1.11, v1.13, 17.03也可以使用,再高版本的docker可能无法正常使用. 测试发现17.09无法正常使用,不 ...

  7. centos7安装配置tomcat9

    什么是Tomcat Tomcat是由Apache软件基金会下属的Jakarta项目开发的一个Servlet容器,按照Sun Microsystems提供的技术规范,实现了对Servlet和JavaSe ...

  8. CentOS7安装配置Bacula yum方法

    参考: https://www.baidu.com/link?url=o2QIy2YZWjsJPAFJuYFhrH3nPvtyRkSe-o5Q_FqFZ5E1EMOsIOmGeKm0HAonwHOw8 ...

  9. Centos7 安装Nodejs

    使用EPEL安装 EPEL(Extra Packages for Enterprise Linux)企业版Linux的额外软件包,是Fedora小组维护的一个软件仓库项目,为RHEL/CentOS提供 ...

随机推荐

  1. [golang][hugo]使用Hugo搭建静态站点

    使用Hugo搭建静态站点 hugo下载地址:https://github.com/gohugoio/hugo 模板列表:https://github.com/gohugoio/hugoThemes 开 ...

  2. join的用法

    var array = ['周欢', '周圆圈'] var str = array.join(' ') console.log(str) // 周欢 周圆圈 join()的括号里面的表示的是分隔符号

  3. android常见错误之 No resource found that matches the given name

    新手上路,还希望大神多多照顾,刚自学android,遇到很多困难.其中就有这个问题,不知道你们遇到过没有,反正我是很头痛. No resource found that matches the giv ...

  4. (转) 中断处理程序&中断服务例程

             关于中断处理程序和中断服务例程ISR的区别及联系,之前一直搞混,今天抽时间将两者关系弄弄清楚.ok,下面进入主题.       首先中断处理程序(Interrupt Handler) ...

  5. DNS域名解析失败 和 何时会查询下一个nameserver

    阿里DNS:域名解析失败的那些事:https://zhuanlan.zhihu.com/p/40659713 只有第一个nameserver响应超时,才会请求下一个nameserver. 收到 NOD ...

  6. uniapp - 富文本编辑器editor(仅支持App和微信小程序)

    uniapp - editor富文本编辑器用法示例 丢几个图,用心看下去(-.-) 这里使用了https://ext.dcloud.net.cn/plugin?id=412 插件,用于选择字体颜色.其 ...

  7. Anaconda更新失败简单解决[CondaHTTPError: HTTP 000 CONNECTION FAILED for url]

    问题:conda无法安装更新,报错内容如下:参考链接:conda httperror http none none for url none Anaconda更新失败 conda create -n ...

  8. NPU TPU

    https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet

  9. kotlin基础 密封类

    密封类 密封类用来表示受限的类继承结构:当一个值为有限几种的类型, 而不能有任何其他类型时.在某种意义上,他们是枚举类的扩展:枚举类型的值集合 也是受限的,但每个枚举常量只存在一个实例,而密封类 的一 ...

  10. Could not create connection to database server. Attempted reconnect 3 times. Giving up.

    报出这个错误,可能原因: 1.检查MySQL数据库服务是否正常(包含检查服务名和密码),如果不正常,修复至正常为止: 2.maven工程中导入的mysql的jar版本和你的MySQL版本不相符,必须相 ...