diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-12-19 15:06:11 +0100 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-12-20 10:02:47 +0100 |
commit | 08c3f0f7379eabe51cd965d0dc35626d8939ae27 (patch) | |
tree | 69f1728b5fcfe1fed211eb693211a6e5818f6895 /plugins/tests | |
parent | 9083896d9c5f5a06f4f0c7c356879dc32330dab7 (diff) | |
download | monitoring-plugins-08c3f0f7379eabe51cd965d0dc35626d8939ae27.tar.gz |
Add test proc/meminfo file and corresponding test
Diffstat (limited to 'plugins/tests')
-rw-r--r-- | plugins/tests/test_check_swap.c | 7 | ||||
-rw-r--r-- | plugins/tests/var/proc_meminfo | 55 |
2 files changed, 60 insertions, 2 deletions
diff --git a/plugins/tests/test_check_swap.c b/plugins/tests/test_check_swap.c index 42ac0086..86ab188f 100644 --- a/plugins/tests/test_check_swap.c +++ b/plugins/tests/test_check_swap.c | |||
@@ -13,9 +13,12 @@ int main() { | |||
13 | 13 | ||
14 | swap_config config = swap_config_init(); | 14 | swap_config config = swap_config_init(); |
15 | 15 | ||
16 | swap_result test_data = get_swap_data(config); | 16 | swap_result test_data = getSwapFromProcMeminfo(config, "./var/proc_meminfo"); |
17 | 17 | ||
18 | plan_tests(1); | 18 | plan_tests(4); |
19 | 19 | ||
20 | ok(test_data.errorcode == 0, "Test whether we manage to retrieve swap data"); | 20 | ok(test_data.errorcode == 0, "Test whether we manage to retrieve swap data"); |
21 | ok(test_data.metrics.total == 34233905152, "Is the total Swap correct"); | ||
22 | ok(test_data.metrics.free == 34231021568, "Is the free Swap correct"); | ||
23 | ok(test_data.metrics.used == 0, "Is the used Swap correct"); | ||
21 | } | 24 | } |
diff --git a/plugins/tests/var/proc_meminfo b/plugins/tests/var/proc_meminfo new file mode 100644 index 00000000..8c94c4e5 --- /dev/null +++ b/plugins/tests/var/proc_meminfo | |||
@@ -0,0 +1,55 @@ | |||
1 | MemTotal: 32767776 kB | ||
2 | MemFree: 1693508 kB | ||
3 | MemAvailable: 23807480 kB | ||
4 | Buffers: 438456 kB | ||
5 | Cached: 19124976 kB | ||
6 | SwapCached: 136 kB | ||
7 | Active: 7860680 kB | ||
8 | Inactive: 18886776 kB | ||
9 | Active(anon): 6108756 kB | ||
10 | Inactive(anon): 1364500 kB | ||
11 | Active(file): 1751924 kB | ||
12 | Inactive(file): 17522276 kB | ||
13 | Unevictable: 8548 kB | ||
14 | Mlocked: 8548 kB | ||
15 | SwapTotal: 33431548 kB | ||
16 | SwapFree: 33428732 kB | ||
17 | Zswap: 0 kB | ||
18 | Zswapped: 0 kB | ||
19 | Dirty: 784 kB | ||
20 | Writeback: 0 kB | ||
21 | AnonPages: 7139968 kB | ||
22 | Mapped: 1094916 kB | ||
23 | Shmem: 284160 kB | ||
24 | KReclaimable: 3303788 kB | ||
25 | Slab: 3801908 kB | ||
26 | SReclaimable: 3303788 kB | ||
27 | SUnreclaim: 498120 kB | ||
28 | KernelStack: 32992 kB | ||
29 | PageTables: 68160 kB | ||
30 | SecPageTables: 0 kB | ||
31 | NFS_Unstable: 0 kB | ||
32 | Bounce: 0 kB | ||
33 | WritebackTmp: 0 kB | ||
34 | CommitLimit: 49815436 kB | ||
35 | Committed_AS: 16888536 kB | ||
36 | VmallocTotal: 34359738367 kB | ||
37 | VmallocUsed: 91200 kB | ||
38 | VmallocChunk: 0 kB | ||
39 | Percpu: 41472 kB | ||
40 | HardwareCorrupted: 0 kB | ||
41 | AnonHugePages: 1708032 kB | ||
42 | ShmemHugePages: 0 kB | ||
43 | ShmemPmdMapped: 0 kB | ||
44 | FileHugePages: 0 kB | ||
45 | FilePmdMapped: 0 kB | ||
46 | Unaccepted: 0 kB | ||
47 | HugePages_Total: 0 | ||
48 | HugePages_Free: 0 | ||
49 | HugePages_Rsvd: 0 | ||
50 | HugePages_Surp: 0 | ||
51 | Hugepagesize: 2048 kB | ||
52 | Hugetlb: 0 kB | ||
53 | DirectMap4k: 860468 kB | ||
54 | DirectMap2M: 20023296 kB | ||
55 | DirectMap1G: 12582912 kB | ||