systemctl start influxdb
systemctl enable influxdb
建库
curl -XPOST http://192.168.241.13:8086/query --data-urlencode “q=CREATE DATABASE prometheus”
或者
influx -precision rfc3339
create database prometheus;
show databases;
## 准备remote\_storage\_adapter
对于业务比较大的环境Local storage是绝对满足不了的,那么就要用remote storage了。
Prometheus的remote storage需要借助adapter实现,adapter会提供write url和read url给Prometheus,这样Prometheus获取到数据后就会先写到本地然后再调用write url写到远端。
下载一个可执行文件remote\_storage\_adapter。
GitHub地址:
https://github.com/prometheus/prometheus/blob/main/documentation/examples/remote_storage/remote_storage_adapter/README.md
需要安装一个go环境并进行build。我已经build好了,下载下面的地址可以直接用。
wget https://github.com/zyiqian/charts/blob/main/prometheus/remote_storage_adapter
chmod +x remote_storage_adapter
## 手工启动
nohup /usr/local/sbin/remote_storage_adapter
–influxdb-url=http://192.168.241.13:8086
–influxdb.database=prometheus
–influxdb.retention-policy=autogen >/var/log/remote_storage_adapter.log 2>&1 &
## 将remote\_storage\_adapter注册为系统服务
cat>/lib/systemd/system/remote_storage_adapter.service<<EOF
[Service]
Restart=on-failure
WorkingDirectory=/root/
ExecStart=/usr/local/sbin/remote_storage_adapter --influxdb-url=http://192.168.241.13:8086/ --influxdb.database=“prometheus” --influxdb.retention-policy=autogen
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable remote_storage_adapter
systemctl start remote_storage_adapter
systemctl status remote_storage_adapter
## 配置prometheus远程写入
修改prometheus.yml中的配置remoteWrite和remoteRead
remote_write:
- url: “http://192.168.241.13:8086/api/v1/prom/write?db=prometheus”
remote_read: - url: “http://192.168.241.13:8086/api/v1/prom/read?db=prometheus”
## 查看Influxdb
influx
Connected to http://localhost:8086 version 1.8.0
influxdb shell version: 1.8.0
show databases;
name: databases
name
prometheus
_internal
use prometheus
Using database prometheus
SHOW MEASUREMENTS;
name: measurements
name
ALERTS
ALERTS_FOR_STATE
aggregator_openapi_v2_regeneration_count
**>>零基础如何学习云计算?如果正在迷茫找不到合适的学习资料,你不必在东瞅西逛,看这一套云计算教程就够了!**
2023新版Linux教程,保姆级零基础Linux入门到精通全套视频
### 给大家的福利
**零基础入门**
对于从来没有接触过网络安全的同学,我们帮你准备了详细的学习成长路线图。可以说是最科学最系统的学习路线,大家跟着这个大的方向学习准没问题。
![](https://img-blog.csdnimg.cn/img_convert/95608e9062782d28f4f04f821405d99a.png)
同时每个成长路线对应的板块都有配套的视频提供:
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/a91b9e8100834e9291cfcf1695d8cd42.png#pic_center)
因篇幅有限,仅展示部分资料
网络安全面试题
![](https://img-blog.csdnimg.cn/img_convert/80674985176a4889f7bb130756893764.png)
绿盟护网行动
![](https://img-blog.csdnimg.cn/img_convert/9f3395407120bb0e1b5bf17bb6b6c743.png)
还有大家最喜欢的黑客技术
![](https://img-blog.csdnimg.cn/img_convert/5912337446dee53639406fead3d3f03c.jpeg)
**网络安全源码合集+工具包**
![](https://img-blog.csdnimg.cn/img_convert/5072ce807750c7ec721c2501c29cb7d5.png)
![](https://img-blog.csdnimg.cn/img_convert/4a5f4281817dc4613353c120c9543810.png)
**所有资料共282G**,朋友们如果有需要全套《网络安全入门+黑客进阶学习资源包》,可以扫描下方二维码领取(如遇扫码问题,可以在评论区留言领取哦)~