prometheus、node_exporter设置开机自启动
方法一、写入rc.local
在/etc/rc.local文件中编辑需要执行的脚本或者命令,我个人习惯用这个,因人而异,有的项目可能需要热加载配置文件,用服务会更好
#普罗米修斯启动,需要后面接config配置文件路径选项
nohup /root/linux_jiankong/prometheus/prometheus --config.file=/root/linux_jiankong/prometheus/prometheus.yml & #node_exporte启动
nohup /root/linux_jiankong/node_exporter/node_exporter --web.listen-address=:9100 & #启动influxdb数据库
influxd -config influxdb.conf #启动grafana
systemctl start grafana-server.service
方法二、设置为服务,使用systemctl来管理
prometheus
- 创建node_exporter组和用户,用于运行node_exporter和prometheus(也可以不创建,不影响的)
- 创建一个node_exporter.service文件
- 启动,并配置开机启动
创建Prometheus组和用户(非必须步骤)
sudo groupadd -r prometheus
sudo useradd -r -g prometheus -s /sbin/nologin -M -c "prometheus Daemons" prometheus
创建services服务文件
如果没创建prometheus组合用户,则Service的User就不用写
cat > /etc/systemd/system/prometheus.service <<EOF
[Unit]
Description=prometheus
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=自己本地路径/prometheus --config.file=/自己本地路径/prometheus.yml --storage.tsdb.path=自己本地路径声明的data目录/data
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
启动Prometheus,将服务设置为开机自启动
systemctl daemon-reload
systemctl start prometheus.service
systemctl status prometheus.service
systemctl enable prometheus.service
node_exporter
换种方式啊,其实一样的
vim /etc/systemd/system/node_exporter.service [Unit]
Description=node_exporter Monitoring System
Documentation=node_exporter Monitoring System [Service]
ExecStart=自己本地路径/node_exporter --web.listen-address=:9100 [Install]
WantedBy=multi-user.target #设置开机自启
systemctl daemon-reload
systemctl start node_exporter.service
systemctl status node_exporter.service
systemctl enable node_exporter.service
prometheus、node_exporter设置开机自启动的更多相关文章
- Fedora 16设置开机自启动程序与Ubuntu的区别
Ubuntu设置开机自启动脚本的方法是:修改/etc/init.d/rc.local这个文件,添加需要启动的程序即可,相关函数如下: void SetSysAutoBoot() { ] = {}; ; ...
- linux_设置开机自启动程序脚本
设置开机自启动
- Linux服务器,服务管理--systemctl命令详解,设置开机自启动
Linux服务器,服务管理--systemctl命令详解,设置开机自启动 syetemclt就是service和chkconfig这两个命令的整合,在CentOS 7就开始被使用了. 摘要: syst ...
- CentOS 6下 Oracle11gR2 设置开机自启动
[1] 更改/etc/oratab # This file is used by ORACLE utilities. It is created by root.sh # and updated by ...
- Ubuntu14.04设置开机自启动脚本
方法一.编辑rc.loacl脚本 Ubuntu开机之后会执行/etc/rc.local文件中的脚本,所以我们可以直接在/etc/rc.local中添加启动脚本.在 exit 0 前面添加好脚本代码, ...
- 设置开机自启动VirtualBox虚拟机系统
如果常用VirtualBox虚拟机系统的话,设置个随开机启动也是很方便的.不需要打开VirtualBox窗口,直接就是系统启动了. 又继续上网搜索学习了.(设置开机自启动VirtualBox虚拟机系统 ...
- CentOS7设置开机自启动命令大全
任务 旧指令 新指令 使某服务自动启动 chkconfig --level 3 httpd on systemctl enable httpd.service 使某服务不自 ...
- ntp服务设置开机自启动失败
设置了ntpd开机自启动,重启服务器ntpd没有自启动 1.需要禁掉chronyd.service: systemctl disable chronyd.service 2.手动启动ntpd: sys ...
- CentOS7设置开机自启动方式
方式一: # 在/etc/rc.d/rc.local文件中追加启动命令,该文件追加后,会随着机器自动后,自动运行文件中的命令 # vim /etc/rc.d/rc.local # 权限问题:在cent ...
随机推荐
- 零基础学Java之Java学习笔记(二):Java快速入门
提出要求: 开发一个 HelloWorld.java 程序,可以输出 "Hello,world!" 开发步骤: (1)将 Java 代码编写到扩展名为 HelloWorld.jav ...
- Typora+Markdown便捷发布blog
参考文章:https://www.cnblogs.com/Heroge/p/12459762.html 需要下载Typora和dotnet Typora下载链接:https://www.typora. ...
- 从一次netty 内存泄露问题来看netty对POST请求的解析
背景 最近生产环境一个基于 netty 的网关服务频繁 full gc 观察内存占用,并把时间维度拉的比较长,可以看到可用内存有明显的下降趋势 出现这种情况,按往常的经验,多半是内存泄露了 问题定位 ...
- git忽略文件夹提交以及gitignore修改后不生效的解决办法
1.在 .gitgnore 文件加入需要忽略的问价夹正则表达式: 在配置完以后提交代码,你可能会发现git忽略配置不生效! 解决办法,将缓存的文件重新添加一下即可 2.打开命令行,将下面三个命令复制粘 ...
- MVVMLight学习笔记(七)---Messenger使用
一.概述 Messenger中文解释为信使的意思,顾名思义,在MvvmLight中,它的主要作用是用于View和ViewModel.ViewModel和ViewModel之间的通信. 考虑以下场景: ...
- 十一:JavaWeb中的监听器(二)
一.监听域对象中属性的变更的监听器 域对象中属性的变更的事件监听器就是用来监听 ServletContext, HttpSession, HttpServletRequest 这三个对象中的属性变更信 ...
- Java程序设计学习笔记(六) — 网络编程
时间:2016-5-8 02:03 --网络编程 网络传输实际上就是进行数据传输. 一.传输的步骤: 1.对对方IP地址进行定位. 2.将数据打包发送到 ...
- Go测试--main测试
目录 简介 示例 简介 子测试的一个方便之处在于可以让多个测试共享Setup和Tear-down.但这种程度的共享有时并不满足需求,有时希望在整个测试程序做一些全局的setup和Tear-down,这 ...
- 地图控件:overview、scale、toolbar
地图常用控件: 1.AMap.MapType:地图类型切换插件,用来切换固定的几个常用图层 2.AMap.OverView:地图鹰眼插件,默认在地图右下角显示缩略图 3.AMap.Scale:地图比例 ...
- 使用 antd 的 form 组件来自定义提交的数据格式
最近使用antd UI 的表单提交数据,数据里面有的是数组,有的是对象.提交的时候还要去校验参数,让人非常头疼.在我仔细看完文档之后,发现 antd 的 form 组件做的非常不错,这些需求通通不是问 ...