Updated README with installation instructions, and fixed dashboard import

This commit is contained in:
Dan Snyder 2025-05-23 13:38:36 -04:00
parent a1b5faddf1
commit eaff59c2ff
3 changed files with 864 additions and 1210 deletions

View File

@ -68,6 +68,7 @@ $(INSTALL_DIR)/%.service: $(SERVICE_DIR)/%.service
install-services: create-services $(INSTALLED) ## Installs all service files in the systemd/ directory into /etc/systemd/system
systemctl daemon-reload
@for srv in $(SERVICES); do \
echo "Installing and starting service $$srv..."; \
name=$$(basename $$srv); \
systemctl enable $$name; \
systemctl start $$name; \

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,69 @@
# ProxMon
Basic idea:
Use the following PS command to gather basic data on processes:
ps ax -o pid,ppid,tgid,uid,lxc,cuu,rss,times,etimes,stat,command --cols 1000
Use resident size as an approximation of real memory usage.
Prometheus exporter that monitors LXC, process and node metrics for Proxmox. This is comprised of two components:
1. node-exporter
- Publicly available "node exporter" from Prometheus. This provides a wide range of system metrics, and by default serves metrics on port 9100.
- Pre-built binary in this repo for ease of installation.
- Configuration details can be found [here](https://github.com/prometheus/node_exporter).
2. proxmon
- Provides supplemental metrics that node-exporter does not provide, and by default serves metrics on port 9101.
- Metrics include resource usage on a per-LXC and per-process basis.
Use CPU utilization may need to be divided by CPU count
Also included is a Grafana dashboard tailored to the data exported by both components above.
Structure of each entry:
_id: unique ID of data point
time: time sample was taken
node: Node of process
host: Host name
hostType: Type of host ('node', 'lxc', 'vm')
# Installation
**NOTE**: This is intended to be run on the host system. However, it is probably possible to run it in an LXC. This would require you to bind-mount the ```/proc``` directory of the pve node into the LXC, and point both node-exporter and proxmon components to read from the bind-mounted directory instead of the default ```/proc``` directory of the LXC. Aside from that, the installation process should be the same.
### Install steps on any PVE node you wish to monitor:
1. Install git if you don't have it already
```apt install git```
2. Create a directory for ProxMon to live
```mkdir /home/monitor```
**NOTE**: This does not create a new user. This guide does not include configuring the service to run under a different user, and will by default run it under root. See **Customizing Services**.
3. ```cd /home/monitor```
4. ```git clone https://git.cozyclan.xyz/dan/ProxMon.git```
5. ```cd ProxMon```
6. If you wish to configure the services in any way, such as running them as a new user (note on step 2) or editing the port they use, skip the remaining steps and go to the **Customizing Services** section.
7. Run ```make install```
8. Verify services are running:
```systemctl status node-exporter.service```
```systemctl status proxmon-exporter.service```
9. Congratulations, you're done. Go to the **Connecting** section.
## Customizing Services
The Makefile has various build targets that can be used for finer control over the installation process. A full list of targets can be viewed with ```make help```.
1. Build proxmon: ```make build```. This will place the executables in the ```bin/``` folder, and generate template service files in the ```systemd/``` directory.
2. Edit the service files in the ```systemd/``` directory to enable node-exporter features or change the ports of the components. If you would like to run these as non-root users, [ask ChatGPT](https://chatgpt.com/share/6830a1d9-5fe0-8012-abdd-076e78a12067).
3. Install the service files: ```make install-services```. This will copy the service files from ```systemd/``` into ```/etc/systemd/system``` and will start the services in systemd. You can also use ```make reinstall-services``` if you have already installed the services and want to install updated versions of the service files.
# Connecting
## Prometheus
0. Install Prometheus if you haven't already with the [Prometheus Helper Script](https://community-scripts.github.io/ProxmoxVE/scripts?id=prometheus). Save the web URL displayed at the end of the setup script.
1. Open your Prometheus LXC console.
2. Edit the file ```/etc/prometheus/prometheus.yml```
3. Under ```scrape_configs``` add the following job. You can edit the job_name as you wish. Set the IP address in the targets to the IP of the host you wish to scrape data from.
4. You can also edit the polling rates in the yml file.
```
scrape_configs:
- job_name: "node"
static_configs:
- targets: ['<HOST_IP>:9100', '<HOST_IP>:9101']
```
5. Restart prometheus: ```systemctl restart prometheus.service```
## Grafana
0. Install Grafana if you haven't already with the [Grafana Helper Script](https://community-scripts.github.io/ProxmoxVE/scripts?id=grafana). Save the web URL displayed at the end of the setup script.
1. Login to the Grafana web interface provided at the end of the helper script
2. On the left side, go to ```Connections->Add new connection```.
3. Search for and click on "Prometheus".
4. Click ```Add new data source``` in the top right.
5. Under ```Connection``` and ```Prometheus server URL``` paste in the web URL of your Prometheus server listed at the end of the Prometheus Helper Script.
6. On the left side, go to ```Dashboards```
7. In the top right, click ```New->Import```
8. Copy the contents of ```Proxmox-Dashboard.json``` from this git repository, and paste it into the text field.
9. Click ```Import```