Skip to content

Commit

Permalink
Merge pull request #71 from natrontech/feat/improvements
Browse files Browse the repository at this point in the history
feat: add flag -version
  • Loading branch information
janfuhrer authored Dec 28, 2024
2 parents 73d2ba9 + 7a7dbd2 commit 4c0d53a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ $ ./pbs-exporter -help

You can use the following flags to configure the exporter. All flags can also be set using environment variables. Environment variables take precedence over flags.

| Flag | Environment Variable | Description | Default |
| ------------------------ | -------------------- | ---------------------------------------------------- | ------------------------------------------------------ |
| `pbs.loglevl` | `PBS_LOGLEVEL` | Log level (debug, info) | `info` |
| `pbs.api.token` | `PBS_API_TOKEN` | API token to use for authentication | |
| `pbs.api.token.name` | `PBS_API_TOKEN_NAME` | Name of the API token to use for authentication | `pbs-exporter` |
| `pbs.endpoint` | `PBS_ENDPOINT` | Address of the Proxmox Backup Server | `http://localhost:8007` (if no parameter `target` set) |
| `pbs.username` | `PBS_USERNAME` | Username to use for authentication | `root@pam` |
| `pbs.timeout` | `PBS_TIMEOUT` | Timeout for requests to Proxmox Backup Server | `5s` |
| `pbs.insecure` | `PBS_INSECURE` | Disable TLS certificate verification | `false` |
| `pbs.metrics-path` | `PBS_METRICS_PATH` | Path under which to expose metrics | `/metrics` |
| `pbs.web.listen-address` | `PBS_LISTEN_ADDRESS` | Address to listen on for web interface and telemetry | `:10019` |
| Flag | Environment Variable | Description | Default |
| -------------------- | -------------------- | ---------------------------------------------------- | ------------------------------------------------------ |
| `pbs.loglevel` | `PBS_LOGLEVEL` | Log level (debug, info) | `info` |
| `pbs.api.token` | `PBS_API_TOKEN` | API token to use for authentication | |
| `pbs.api.token.name` | `PBS_API_TOKEN_NAME` | Name of the API token to use for authentication | `pbs-exporter` |
| `pbs.endpoint` | `PBS_ENDPOINT` | Address of the Proxmox Backup Server | `http://localhost:8007` (if no parameter `target` set) |
| `pbs.username` | `PBS_USERNAME` | Username to use for authentication | `root@pam` |
| `pbs.timeout` | `PBS_TIMEOUT` | Timeout for requests to Proxmox Backup Server | `5s` |
| `pbs.insecure` | `PBS_INSECURE` | Disable TLS certificate verification | `false` |
| `pbs.metrics-path` | `PBS_METRICS_PATH` | Path under which to expose metrics | `/metrics` |
| `pbs.listen-address` | `PBS_LISTEN_ADDRESS` | Address to listen on for web interface and telemetry | `:10019` |

### Docker secrets

Expand Down
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ var (
"Address on which to expose metrics")
loglevel = flag.String("pbs.loglevel", "info",
"Loglevel")
showVersion = flag.Bool("version", false, "Show version and exit")

// Metrics
up = prometheus.NewDesc(
Expand Down Expand Up @@ -756,6 +757,11 @@ func findLastSnapshotWithBackupID(response SnapshotResponse, backupID string) (i
func main() {
flag.Parse()

if *showVersion {
fmt.Printf("PBS Exporter Version: %s, Commit: %s, Build Time: %s\n", Version, Commit, BuildTime)
os.Exit(0)
}

// log build information
log.Printf("INFO: Starting PBS Exporter %s, commit %s, built at %s", Version, Commit, BuildTime)

Expand Down

0 comments on commit 4c0d53a

Please sign in to comment.