CentOS7安装Prometheus(二进制)
一、概述
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(二进制)的更多相关文章
- CentOS7安装Node_exporter(二进制)
一.概述 Node_exporter是可以在* Nix和Linux系统上运行的计算机度量标准的导出器.Node_exporter 主要用于暴露 metrics 给 Prometheus,其中 metr ...
- CentOS7安装MySQL的方法之通用二进制格式
CentOS7安装MySQL的方法之通用二进制格式
- centos7下docker二进制安装
问题描述: 内网离线环境下,安装docker.二进制来的还是快点,或者内网搭建yum的epel仓库! 环境: centos7.x docker-18.9.0 x86_64 static //二进制 ...
- CentOS7安装部署Prometheus+Grafana (转)
转自:https://www.jianshu.com/p/967cb76cd5ca 作为监控系统的后起之秀,prometheus的安装可谓非常简单,不需要第三方的依赖(数据库.缓存.PHP之类的).下 ...
- [CentOs7]安装mysql(2)
摘要 之前安装过一次mysql,最后配置,发现在本地无法连接,重启服务的时候一直卡在那里不动,感觉是安装的过程出问题,最后没办法还是卸载了,然后重新安装一下. [CentOs7]安装mysql Mys ...
- centos7安装kubeadm
安装配置docker v1.9.0版本推荐使用docker v1.12, v1.11, v1.13, 17.03也可以使用,再高版本的docker可能无法正常使用. 测试发现17.09无法正常使用,不 ...
- centos7安装配置tomcat9
什么是Tomcat Tomcat是由Apache软件基金会下属的Jakarta项目开发的一个Servlet容器,按照Sun Microsystems提供的技术规范,实现了对Servlet和JavaSe ...
- CentOS7安装配置Bacula yum方法
参考: https://www.baidu.com/link?url=o2QIy2YZWjsJPAFJuYFhrH3nPvtyRkSe-o5Q_FqFZ5E1EMOsIOmGeKm0HAonwHOw8 ...
- Centos7 安装Nodejs
使用EPEL安装 EPEL(Extra Packages for Enterprise Linux)企业版Linux的额外软件包,是Fedora小组维护的一个软件仓库项目,为RHEL/CentOS提供 ...
随机推荐
- vue中的scoped分析以及在element-UI和vux中的应用
vue使用了单文件组件方式来解耦视图即.vue后缀文件名 单文件组件组成部分: <template> </template> <script> </scrip ...
- saltstack自动化运维工具搭建个人笔记
至于为什么选择saltstack,因为Puppet.Chef基于Ruby开发,而ansible.saltstack基于python开发,便于后期二次,良好的可移植性. 又,ansible基于SSH协议 ...
- 面试官问我:平常如何对你的 Java 程序进行调优?
阅读本文大概需要 10 分钟. 作者:张俊城, 郭理勇, 刘建来源:http://t.cn/AiCTERJz Java 应用性能优化是一个老生常谈的话题,典型的性能问题如页面响应慢.接口超时,服务器负 ...
- ios手机竖屏拍照图片旋转90°问题解决方法
手机拍照会给图片添加一个Orientaion信息(即拍照方向),如下: 用ios手机拍照,系统会给图片加上一个方向的属性, ios相机默认的拍照方向是后摄Home键在右为正,前摄Home键在左为正. ...
- 初识RSA
基础知识:http://www.guideep.com/read?guide=5676830073815040# python实现:https://blog.csdn.net/bian_h_f6127 ...
- linux驱动由浅入深系列:高通sensor架构实例分析之二(驱动代码结构)【转】
本文转载自:https://blog.csdn.net/radianceblau/article/details/73498303 本系列导航: linux驱动由浅入深系列:高通sensor架构实例分 ...
- NioEventLoopGroup源码分析与线程设定
我的以Netty Socket编程的代码为例, 1.EventLoopGroup 进入EventLoopGroup,这是一个特殊的EventExecutorGroup,在事件循环中,在selectio ...
- 修改jar包中的文件
1.用WinRAR压缩软件打开jar包 2.将修改过的文件直接拖拽并覆盖被替换的文件即可
- Linux下如何测试网速
本文链接:https://blog.csdn.net/Beyond_F4/article/details/80497118在Linux下如何测量下载和上传的速度? 这里用到一个Python工具spee ...
- SoapUI: 设置case的属性变量
琐碎的东西也想一点一滴的记下来