diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-10 11:52:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-10 11:52:32 +0100 |
commit | e8d580eb4bc9216518de8083d39fd857d91e0a46 (patch) | |
tree | 4a37db34074bdce03703fe74840aca9df5b87467 /plugins/check_apt.d/config.h | |
parent | 0f0290a52f70d132e09e5b373e2c75b4524d393b (diff) | |
parent | cda3906b12f88388ca4caeadf9f351c9c018bf89 (diff) | |
download | monitoring-plugins-e8d580eb4bc9216518de8083d39fd857d91e0a46.tar.gz |
Merge pull request #2080 from RincewindsHat/refactor/check_apt
Refactor check_apt
Diffstat (limited to 'plugins/check_apt.d/config.h')
-rw-r--r-- | plugins/check_apt.d/config.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/plugins/check_apt.d/config.h b/plugins/check_apt.d/config.h new file mode 100644 index 00000000..2c962e5a --- /dev/null +++ b/plugins/check_apt.d/config.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include "../../config.h" | ||
4 | #include <stddef.h> | ||
5 | |||
6 | /* some constants */ | ||
7 | typedef enum { | ||
8 | UPGRADE, | ||
9 | DIST_UPGRADE, | ||
10 | NO_UPGRADE | ||
11 | } upgrade_type; | ||
12 | |||
13 | typedef struct { | ||
14 | bool do_update; /* whether to call apt-get update */ | ||
15 | upgrade_type upgrade; /* which type of upgrade to do */ | ||
16 | bool only_critical; /* whether to warn about non-critical updates */ | ||
17 | bool list; /* list packages available for upgrade */ | ||
18 | /* number of packages available for upgrade to return WARNING status */ | ||
19 | int packages_warning; | ||
20 | |||
21 | char *upgrade_opts; /* options to override defaults for upgrade */ | ||
22 | char *update_opts; /* options to override defaults for update */ | ||
23 | char *do_include; /* regexp to only include certain packages */ | ||
24 | char *do_exclude; /* regexp to only exclude certain packages */ | ||
25 | char *do_critical; /* regexp specifying critical packages */ | ||
26 | char *input_filename; /* input filename for testing */ | ||
27 | } check_apt_config; | ||
28 | |||
29 | check_apt_config check_apt_config_init() { | ||
30 | check_apt_config tmp = {.do_update = false, | ||
31 | .upgrade = UPGRADE, | ||
32 | .only_critical = false, | ||
33 | .list = false, | ||
34 | .packages_warning = 1, | ||
35 | .update_opts = NULL, | ||
36 | .update_opts = NULL, | ||
37 | .do_include = NULL, | ||
38 | .do_exclude = NULL, | ||
39 | .do_critical = NULL, | ||
40 | .input_filename = NULL}; | ||
41 | return tmp; | ||
42 | } | ||