Skip to content

Commit

Permalink
Merge pull request #53 from nbuchwitz/format-black
Browse files Browse the repository at this point in the history
style: Enforce styling and linting
  • Loading branch information
nbuchwitz authored May 12, 2024
2 parents 235052f + c8acabd commit cf66cc2
Show file tree
Hide file tree
Showing 4 changed files with 688 additions and 386 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on: [push, pull_request]
name: Linter

jobs:
build:
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "*"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black ruff
- name: Check styling with black
run: |
black --check *.py
- name: Run ruff linter
run: |
ruff check *.py
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# check_pve
Icinga check command for Proxmox VE via API

![Linter](https://github.com/nbuchwitz/check_pve/actions/workflows/lint.yml/badge.svg)

## Setup

### Requirements
Expand All @@ -15,9 +17,9 @@ This check command depends on **Python 3** and the following modules:
apt install python3 python3-requests python3-packaging
```

**Installation on Redhat 7 / CentOS 7**
**Installation on Rocky / Alma Linux 9**
```
yum install python36 python36-requests python36-packaging
yum install python3 python3-requests python3-packaging
```

**Installation on FreeBSD**
Expand Down Expand Up @@ -100,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 @@ -122,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 @@ -142,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
Loading

0 comments on commit cf66cc2

Please sign in to comment.