summaryrefslogtreecommitdiffstats
path: root/plugins/check_disk.d/utils_disk.h
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-03-18 14:37:02 +0100
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-03-18 14:37:02 +0100
commit8ccff07bed03046a97637a54d45a9ffe77edc235 (patch)
tree6be1c9d8d6b6833c1416e3ad2e960a1e75cbcd3a /plugins/check_disk.d/utils_disk.h
parent285db2a9fa25519cacd48a76347ae2dee0c06605 (diff)
downloadmonitoring-plugins-8ccff07bed03046a97637a54d45a9ffe77edc235.tar.gz
refactor check_disk.d code a bit
Diffstat (limited to 'plugins/check_disk.d/utils_disk.h')
-rw-r--r--plugins/check_disk.d/utils_disk.h39
1 files changed, 30 insertions, 9 deletions
diff --git a/plugins/check_disk.d/utils_disk.h b/plugins/check_disk.d/utils_disk.h
index c5e81dc1..1c68fed9 100644
--- a/plugins/check_disk.d/utils_disk.h
+++ b/plugins/check_disk.d/utils_disk.h
@@ -1,8 +1,10 @@
1/* Header file for utils_disk */ 1/* Header file for utils_disk */
2 2
3#include "mountlist.h" 3#include "../../config.h"
4#include "../../gl/mountlist.h"
4#include "utils_base.h" 5#include "utils_base.h"
5#include "regex.h" 6#include "regex.h"
7#include <stdint.h>
6 8
7struct name_list { 9struct name_list {
8 char *name; 10 char *name;
@@ -16,22 +18,39 @@ struct regex_list {
16 18
17struct parameter_list { 19struct parameter_list {
18 char *name; 20 char *name;
19 thresholds *freespace_bytes; 21 char *group;
22
20 thresholds *freespace_units; 23 thresholds *freespace_units;
21 thresholds *freespace_percent; 24 thresholds *freespace_percent;
22 thresholds *usedspace_bytes;
23 thresholds *usedspace_units; 25 thresholds *usedspace_units;
24 thresholds *usedspace_percent; 26 thresholds *usedspace_percent;
27
25 thresholds *usedinodes_percent; 28 thresholds *usedinodes_percent;
26 thresholds *freeinodes_percent; 29 thresholds *freeinodes_percent;
27 char *group; 30
28 struct mount_entry *best_match; 31 struct mount_entry *best_match;
32
33 uintmax_t total;
34 uintmax_t available;
35 uintmax_t available_to_root;
36 uintmax_t used;
37 uintmax_t inodes_free;
38 uintmax_t inodes_free_to_root;
39 uintmax_t inodes_used;
40 uintmax_t inodes_total;
41
42 double dfree_pct;
43 double dused_pct;
44
45 uint64_t dused_units;
46 uint64_t dfree_units;
47 uint64_t dtotal_units;
48
49 double dused_inodes_percent;
50 double dfree_inodes_percent;
51
29 struct parameter_list *name_next; 52 struct parameter_list *name_next;
30 struct parameter_list *name_prev; 53 struct parameter_list *name_prev;
31 uintmax_t total, available, available_to_root, used, inodes_free, inodes_free_to_root, inodes_used, inodes_total;
32 double dfree_pct, dused_pct;
33 uint64_t dused_units, dfree_units, dtotal_units;
34 double dused_inodes_percent, dfree_inodes_percent;
35}; 54};
36 55
37void np_add_name(struct name_list **list, const char *name); 56void np_add_name(struct name_list **list, const char *name);
@@ -39,10 +58,12 @@ bool np_find_name(struct name_list *list, const char *name);
39bool np_seen_name(struct name_list *list, const char *name); 58bool np_seen_name(struct name_list *list, const char *name);
40int np_add_regex(struct regex_list **list, const char *regex, int cflags); 59int np_add_regex(struct regex_list **list, const char *regex, int cflags);
41bool np_find_regmatch(struct regex_list *list, const char *name); 60bool np_find_regmatch(struct regex_list *list, const char *name);
61
42struct parameter_list *np_add_parameter(struct parameter_list **list, const char *name); 62struct parameter_list *np_add_parameter(struct parameter_list **list, const char *name);
43struct parameter_list *np_find_parameter(struct parameter_list *list, const char *name); 63struct parameter_list *np_find_parameter(struct parameter_list *list, const char *name);
44struct parameter_list *np_del_parameter(struct parameter_list *item, struct parameter_list *prev); 64struct parameter_list *np_del_parameter(struct parameter_list *item, struct parameter_list *prev);
65struct parameter_list parameter_list_init(const char *);
45 66
46int search_parameter_list(struct parameter_list *list, const char *name); 67int search_parameter_list(struct parameter_list *list, const char *name);
47void np_set_best_match(struct parameter_list *desired, struct mount_entry *mount_list, bool exact); 68void np_set_best_match(struct parameter_list *desired, struct mount_entry *mount_list, bool exact);
48bool np_regex_match_mount_entry(struct mount_entry *me, regex_t *re); 69bool np_regex_match_mount_entry(struct mount_entry *, regex_t *);