summaryrefslogtreecommitdiffstats
path: root/plugins/tests
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-12-19 15:06:11 +0100
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-12-20 10:02:47 +0100
commit08c3f0f7379eabe51cd965d0dc35626d8939ae27 (patch)
tree69f1728b5fcfe1fed211eb693211a6e5818f6895 /plugins/tests
parent9083896d9c5f5a06f4f0c7c356879dc32330dab7 (diff)
downloadmonitoring-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.c7
-rw-r--r--plugins/tests/var/proc_meminfo55
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 @@
1MemTotal: 32767776 kB
2MemFree: 1693508 kB
3MemAvailable: 23807480 kB
4Buffers: 438456 kB
5Cached: 19124976 kB
6SwapCached: 136 kB
7Active: 7860680 kB
8Inactive: 18886776 kB
9Active(anon): 6108756 kB
10Inactive(anon): 1364500 kB
11Active(file): 1751924 kB
12Inactive(file): 17522276 kB
13Unevictable: 8548 kB
14Mlocked: 8548 kB
15SwapTotal: 33431548 kB
16SwapFree: 33428732 kB
17Zswap: 0 kB
18Zswapped: 0 kB
19Dirty: 784 kB
20Writeback: 0 kB
21AnonPages: 7139968 kB
22Mapped: 1094916 kB
23Shmem: 284160 kB
24KReclaimable: 3303788 kB
25Slab: 3801908 kB
26SReclaimable: 3303788 kB
27SUnreclaim: 498120 kB
28KernelStack: 32992 kB
29PageTables: 68160 kB
30SecPageTables: 0 kB
31NFS_Unstable: 0 kB
32Bounce: 0 kB
33WritebackTmp: 0 kB
34CommitLimit: 49815436 kB
35Committed_AS: 16888536 kB
36VmallocTotal: 34359738367 kB
37VmallocUsed: 91200 kB
38VmallocChunk: 0 kB
39Percpu: 41472 kB
40HardwareCorrupted: 0 kB
41AnonHugePages: 1708032 kB
42ShmemHugePages: 0 kB
43ShmemPmdMapped: 0 kB
44FileHugePages: 0 kB
45FilePmdMapped: 0 kB
46Unaccepted: 0 kB
47HugePages_Total: 0
48HugePages_Free: 0
49HugePages_Rsvd: 0
50HugePages_Surp: 0
51Hugepagesize: 2048 kB
52Hugetlb: 0 kB
53DirectMap4k: 860468 kB
54DirectMap2M: 20023296 kB
55DirectMap1G: 12582912 kB