nbuchwitz / check_pve

Icinga check command for Proxmox VE via API
GNU General Public License v2.0
110 stars 35 forks source link

feat: add option --ignore-pools to exclude vms in pools from backup c… #60

Closed jdreffein closed 4 months ago

jdreffein commented 4 months ago

With this PR I introduce the possibility of ignoring VMs or containers assigned to one or many pools.

Sometimes you may have some vms for testing or commissioning, that don't have to be backed up.

With the new option --ignore-pools one or more pools can be specified. All VMIDs in those pools will be removed from the list of VMIDs not configured in any backup job that are reported by the checked node (cluster/backup-info/not-backed-up), so only VMIDs not ignored by this option will be reported by the check.

The name of the pools are separated with a comma. So both of these examples are valid --ignore-pools testpool --ignore-pools test,implement

This option also provides a solution to use the backup check when VMs are backed up via api/vzdump and not scheduled backup jobs of the cluster.

nbuchwitz commented 4 months ago

Thanks for your contribution! I really like the idea of ignoring complete pools and might extend this parameter to other checks where it makes sense. I took the liberty and pushed a fixup commit in order to simplify the lookup and follow the generel codying style. Feel free to squash with your commit and push the branch again. After that I can merge the PR.

jdreffein commented 4 months ago

yes, i will do that tomorrow, was a long day. sorry i didn't use black and ruff at first. maybe cause code is working here. just getting used to python.

nbuchwitz commented 4 months ago

No worries, especially if this was your first Python contribution. Have a nice evening!

jdreffein commented 4 months ago

Thank you for your appreciation and linting/enhancing the contributed code.

The next contribution would be a check for cluster memory. But it has be to generalized first because it is currently customized to our environment.

jdreffein commented 4 months ago

sorry, i got some things messed up with git. my latest commit should be the final working

nbuchwitz commented 4 months ago

You can use git commit --amend to edit the commit message and remove the fixups

nbuchwitz commented 4 months ago

@jdreffein I've squashed the commit into one and merged it into main branch. Thanks for your contribution!

P.S: Greetings to Niclas!