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提供 ...
随机推荐
- 中国大学生计算机系统与程序设计竞赛 CCF-CCSP-2016 选座( ticket_chooser )
选座( ticket_chooser ) 不会正解,欢迎讨论 //60分 #include<cstdio> #define max(a,b) (a)>(b)?a:b #define ...
- spring注解式参数校验列表
校验注释列表: @AssertFalse Boolean,boolean 验证注解的元素值是false @AssertTrue Boolean,boolean 验证注解的元素值是true @NotNu ...
- nginx 配置虚拟主机( 基于域名 )
一.创建网站目录及文件: [root@localhost data]# tree /data /data └── wwwroot ├── www..com │ └── index.html └── ...
- Shell 逐行读取文件的4中方法
方法1:while循环中执行效率最高,最常用的方法. function while_read_LINE_bottm(){ While read LINE do echo $LINE done < ...
- 关于org.apache.lucene.queryParser.ParseException: Encountered "" 解决方法
现象: org.apache.lucene.queryParser.ParseException: Encountered "<EOF>" at line 1, col ...
- 【Beta】Scrum Meeting 10 & 发布链接
目录 前言 任务分配 燃尽图 会议照片 签入记录 发布链接(5.17更新) 前言 第10次会议于5月15日22:00在一公寓三楼召开. 交流确认了各自的任务进度,确定了Beta阶段发布的相关事宜.时长 ...
- Exit 与 Goto :eof 在批处理中的区别【转】
在 CMD 命令提示符窗口直接运行: 1.) 运行 Goto :eof 后,CMD 返回并将等待下一命令. 2.) 运行 Exit 后,CMD 将直接关闭并返回到曾启动 Cmd.exe 的程序或返回到 ...
- Sublime Text 3.2.1详细安装破解教程,附最新激活码license(全网独家可用有效)
title: "Sublime Text 3.2.1详细安装破解教程,附最新激活码license(全网独家可用有效)" categories: soft tags: soft au ...
- BIO,NIO,AIO到NETTY
NIO 近期接触了几个产品都触及NIO,要么应用,要么改造项目,听多了也有些了解,但仍然不能真正理解,工期比较赶,还是要潜心下来看看. NIO是什么呢,应该是NOT-BLOCKING IO的意思,不阻 ...
- k8s记录-kubeam方式部署k8s
参考:https://blog.csdn.net/networken/article/details/84991940 # k8s工具部署方案 # 1.集群规划 | **服务器** | || ---- ...