由于内存白菜价, 家里的虚拟机越来越多了。
1个是难以管理hostname 和 ip, 只靠/etc/hosts 去记住其实并不方便
试过宝塔linux面板, 可惜是单机的,不适用于管理集群linux服务器, 而且里面一股金钱气息。
至于他们另1个产品堡塔云, 估计是集群管理, 但是安装失败, 而且看了价格感觉像智商税。
公司用过Appdynamic, 功能强大可惜更不是我能想的。

只能还是去寻找开源方案。好在外能的google提供了一套成熟的开源方案
Prometheus - 用于管理机 - 集群服务器数据收集
node_exporter - 用于被管理节点 - 提供节点本身的服务器数据给Prometheus
Grafana - 数据展示工具
下面就会写出详细的安装步骤
1. 服务器准备
| No | hostname | ip | cpu 数 | memory | os | comment |
|---|---|---|---|---|---|---|
| 1 | amdeuc-vm0 | 10.0.1.155 | 1 | 2 | ubuntu 22.04 LTS server | 监控机 |
| 2 | amdeuc-vm1 | 10.0.1.156 | 2 | 8 | ubuntu 22.04 LTS server | 被监控机 |
| 3 | amdeuc-vm2 | 10.0.1.157 | 1 | 4 | ubuntu 22.04 LTS server | 被监控机 |
| 4 | amdeuc-vm3 | 10.0.1.158 | 1 | 4 | ubuntu 22.04 LTS server | 被监控机 |
2. 在宿主机安装Prometheus
2.1 安装
个人觉得不用下载安装包这么复杂, 直接从ubuntu源安装
sudo apt-get install prometheus
检查prometheus 有没有启动
gateman@amdeuc-vm0:~$ systemctl status prometheus
● prometheus.service - Monitoring system and time series database
Loaded: loaded (/lib/systemd/system/prometheus.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2022-11-24 15:58:52 UTC; 4h 3min ago
Docs: https://prometheus.io/docs/introduction/overview/
man:prometheus(1)
Main PID: 23080 (prometheus)
Tasks: 7 (limit: 23310)
Memory: 44.6M
CPU: 30.744s
CGroup: /system.slice/prometheus.service
└─23080 /usr/bin/prometheus
2.2 检查配置文件
gateman@amdeuc-vm0:/etc/prometheus$ cat prometheus.yml
# Sample config for Prometheus.
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'example'
# Alertmanager configuration
alerting

最低0.47元/天 解锁文章
1592

被折叠的 条评论
为什么被折叠?



