Skip to content

Commit

Permalink
feat: Make check mode naming more consistent
Browse files Browse the repository at this point in the history
Introduc aliases for check modes to make naming more consistent:

- io_wait: io-wait
- vm_status: vm-status

Signed-off-by: Nicolai Buchwitz <[email protected]>
  • Loading branch information
nbuchwitz committed May 12, 2024
1 parent 86805df commit c8acabd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ The ``icinga2`` folder contains the command definition and service examples for

```
usage: check_pve.py [-h] -e API_ENDPOINT [--api-port API_PORT] -u API_USER (-p API_PASSWORD | -t API_TOKEN) [-k] -m
{cluster,version,cpu,memory,swap,storage,io_wait,updates,services,subscription,vm,vm_status,replication,disk-health,ceph-health,zfs-health,zfs-fragmentation,backup}
[-n NODE] [--name NAME] [--vmid VMID] [--expected-vm-status {running,stopped,paused}] [--ignore-vm-status] [--ignore-service NAME] [--ignore-disk NAME]
[-w THRESHOLD_WARNING] [-c THRESHOLD_CRITICAL] [-M] [-V MIN_VERSION] [--unit {GB,MB,KB,GiB,MiB,KiB,B}]
{cluster,version,cpu,memory,swap,storage,io_wait,io-wait,updates,services,subscription,vm,vm_status,vm-status,replication,disk-health,ceph-health,zfs-health,zfs-fragmentation,backup} [-n NODE] [--name NAME]
[--vmid VMID] [--expected-vm-status {running,stopped,paused}] [--ignore-vm-status] [--ignore-service NAME] [--ignore-disk NAME] [-w THRESHOLD_WARNING] [-c THRESHOLD_CRITICAL] [-M] [-V MIN_VERSION]
[--unit {GB,MB,KB,GiB,MiB,KiB,B}]
Check command for PVE hosts via API
Expand All @@ -124,7 +124,7 @@ API Options:
-k, --insecure Don't verify HTTPS certificate
Check Options:
-m {cluster,version,cpu,memory,swap,storage,io_wait,updates,services,subscription,vm,vm_status,replication,disk-health,ceph-health,zfs-health,zfs-fragmentation,backup}, --mode {cluster,version,cpu,memory,swap,storage,io_wait,updates,services,subscription,vm,vm_status,replication,disk-health,ceph-health,zfs-health,zfs-fragmentation,backup}
-m {cluster,version,cpu,memory,swap,storage,io_wait,io-wait,updates,services,subscription,vm,vm_status,vm-status,replication,disk-health,ceph-health,zfs-health,zfs-fragmentation,backup}, --mode {cluster,version,cpu,memory,swap,storage,io_wait,io-wait,updates,services,subscription,vm,vm_status,vm-status,replication,disk-health,ceph-health,zfs-health,zfs-fragmentation,backup}
Mode to use.
-n NODE, --node NODE Node to check (necessary for all modes except cluster, version and backup)
--name NAME Name of storage, vm, or container
Expand All @@ -144,7 +144,6 @@ Check Options:
The minimal pve version to check for. Any version lower than this will return CRITICAL.
--unit {GB,MB,KB,GiB,MiB,KiB,B}
Unit which is used for performance data and other values
```

## Check examples
Expand Down
8 changes: 5 additions & 3 deletions check_pve.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ def check(self) -> None:
self.check_memory()
elif self.options.mode == "swap":
self.check_swap()
elif self.options.mode == "io_wait":
elif self.options.mode in ("io_wait", "io-wait"):
self.check_io_wait()
elif self.options.mode == "disk-health":
self.check_disks()
Expand All @@ -849,8 +849,8 @@ def check(self) -> None:
self.check_subscription()
elif self.options.mode == "storage":
self.check_storage(self.options.name)
elif self.options.mode in ["vm", "vm_status"]:
only_status = self.options.mode == "vm_status"
elif self.options.mode in ["vm", "vm_status", "vm-status"]:
only_status = self.options.mode in ["vm_status", "vm-status"]

if self.options.name:
idx = self.options.name
Expand Down Expand Up @@ -936,11 +936,13 @@ def parse_args(self) -> None:
"swap",
"storage",
"io_wait",
"io-wait",
"updates",
"services",
"subscription",
"vm",
"vm_status",
"vm-status",
"replication",
"disk-health",
"ceph-health",
Expand Down

0 comments on commit c8acabd

Please sign in to comment.