[PR #4437] [MERGED] monitor-all: improvements - tag based filtering #4971

Open
opened 2025-11-20 06:12:34 -05:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE/pull/4437
Author: @grizmin
Created: 5/13/2025
Status: Merged
Merged: 5/14/2025
Merged by: @michelroegl-brunner

Base: mainHead: main


📝 Commits (2)

  • 8aafb20 Update monitor-all.sh
  • 9027998 Merge pull request #1 from grizmin/feature/monitor-all

📊 Changes

1 file changed (+67 additions, -51 deletions)

View changed files

📝 tools/pve/monitor-all.sh (+67 -51)

📄 Description

✍️ Description

🧩 1. Tag-Based Filtering (Core Feature)
New feature: Only restart instances (VMs or containers) that have the mon-restart tag.

This makes monitoring and auto-restart controllable directly from the Proxmox Web UI, without editing scripts or services.

Set via GUI: VM → Options → Tags → mon-restart

Set via CLI: qm set -tags mon-restart or pct set -tags mon-restart

This is the primary new control mechanism, making the script safer, more flexible, and user-friendly.

🧰 2. Backward-Compatible Exclusion Mechanism
The original feature that lets you exclude instances via CLI arguments is preserved:

./ping-instances.sh 101 300
These IDs will always be skipped regardless of tag.

🧠 3. Intelligent Responsiveness Checks
For VMs:

Uses qm guest cmd ping to check responsiveness via the QEMU guest agent.

No longer relies on network-level ping, which can be misleading or blocked.

For containers (CTs):

Uses traditional ping to IP addresses obtained from pct exec, since CTs don’t support QEMU agent.

4. Instance Skipping Improvements
Instances are now skipped if:

They are explicitly excluded via CLI.

They are templates.

They are configured with onboot: 0 or missing.

They lack the mon-restart tag, regardless of other status.

🪵 5. Same Logging Behavior
All output continues to go to /var/log/ping-instances.log for persistent tracking.

Verbose messages were added for traceability (e.g., why a VM or CT was skipped).

🎯 Why This Matters
With tag-based control, admins can now manage restart behavior dynamically from the Proxmox Web UI, making the script:

More secure (no accidental restarts).

More maintainable (no script edits needed).

More user-friendly (integrated with the UI workflow).

Link: #

Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE/pull/4437 **Author:** [@grizmin](https://github.com/grizmin) **Created:** 5/13/2025 **Status:** ✅ Merged **Merged:** 5/14/2025 **Merged by:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`8aafb20`](https://github.com/community-scripts/ProxmoxVE/commit/8aafb20a95c7a58a3e49225c05bd0da2276a3f0a) Update monitor-all.sh - [`9027998`](https://github.com/community-scripts/ProxmoxVE/commit/9027998a6a66f011080b2f7a8e3b390708f889f0) Merge pull request #1 from grizmin/feature/monitor-all ### 📊 Changes **1 file changed** (+67 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `tools/pve/monitor-all.sh` (+67 -51) </details> ### 📄 Description <!--🛑 New scripts must be submitted to [ProxmoxVED](https://github.com/community-scripts/ProxmoxVED) for testing. PRs without prior testing will be closed. --> ## ✍️ Description 🧩 1. Tag-Based Filtering (Core Feature) New feature: Only restart instances (VMs or containers) that have the **mon-restart** tag. This makes monitoring and auto-restart controllable directly from the Proxmox Web UI, without editing scripts or services. Set via GUI: VM → Options → Tags → mon-restart Set via CLI: qm set <vmid> -tags mon-restart or pct set <ctid> -tags mon-restart This is the primary new control mechanism, making the script safer, more flexible, and user-friendly. 🧰 2. Backward-Compatible Exclusion Mechanism The original feature that lets you exclude instances via CLI arguments is preserved: ./ping-instances.sh 101 300 These IDs will always be skipped regardless of tag. 🧠 3. Intelligent Responsiveness Checks For VMs: Uses qm guest cmd <id> ping to check responsiveness via the QEMU guest agent. No longer relies on network-level ping, which can be misleading or blocked. For containers (CTs): Uses traditional ping to IP addresses obtained from pct exec, since CTs don’t support QEMU agent. ⛔ 4. Instance Skipping Improvements Instances are now skipped if: They are explicitly excluded via CLI. They are templates. They are configured with onboot: 0 or missing. They lack the mon-restart tag, regardless of other status. 🪵 5. Same Logging Behavior All output continues to go to /var/log/ping-instances.log for persistent tracking. Verbose messages were added for traceability (e.g., why a VM or CT was skipped). 🎯 Why This Matters With tag-based control, admins can now manage restart behavior dynamically from the Proxmox Web UI, making the script: More secure (no accidental restarts). More maintainable (no script edits needed). More user-friendly (integrated with the UI workflow). ## 🔗 Related PR / Issue Link: # ## ✅ Prerequisites (**X** in brackets) - [x] **Self-review completed** – Code follows project standards. - [x] **Tested thoroughly** – Changes work as expected. - [x] **No security risks** – No hardcoded secrets, unnecessary privilege escalations, or permission issues. --- ## 🛠️ Type of Change (**X** in brackets) - [ ] 🐞 **Bug fix** – Resolves an issue without breaking functionality. - [x] ✨ **New feature** – Adds new, non-breaking functionality. - [ ] 💥 **Breaking change** – Alters existing functionality in a way that may require updates. - [ ] 🆕 **New script** – A fully functional and tested script or script set. - [ ] 🌍 **Website update** – Changes to website-related JSON files or metadata. - [x] 🔧 **Refactoring / Code Cleanup** – Improves readability or maintainability without changing functionality. - [ ] 📝 **Documentation update** – Changes to `README`, `AppName.md`, `CONTRIBUTING.md`, or other docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2025-11-20 06:12:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE#4971