Commit 1b31d6c445dbf7a3c2ab9ee455313c6fcec128f1

Authored by Imanol-Mikel Barba Sabariego
1 parent 1b19e6ce

Added new threshold modes

CMakeLists.txt 100755 → 100644
check_csgo/README.md 100755 → 100644
check_csgo/auxiliar.cpp 100755 → 100644
check_csgo/auxiliar.h 100755 → 100644
check_csgo/check_csgo.cpp 100755 → 100644
check_csgo/check_csgo.h 100755 → 100644
check_memfree/auxiliar.cpp 100755 → 100644
check_memfree/auxiliar.h 100755 → 100644
check_memfree/check_memfree.cpp 100755 → 100644
check_memfree/check_memfree.h 100755 → 100644
check_memfree/range.h 100755 → 100644
check_memfree_freebsd/auxiliar.cpp 100755 → 100644
check_memfree_freebsd/auxiliar.h 100755 → 100644
check_memfree_freebsd/check_memfree.h 100755 → 100644
check_memfree_freebsd/range.h 100755 → 100644
check_openvpn/README.md 100755 → 100644
check_openvpn/auxiliar.cpp 100755 → 100644
check_openvpn/auxiliar.h 100755 → 100644
check_openvpn/check_openvpn.cpp 100755 → 100644
check_openvpn/check_openvpn.h 100755 → 100644
check_smart/auxiliar.cpp 100755 → 100644
check_smart/auxiliar.h 100755 → 100644
check_smart/check_smart.cpp
... ... @@ -49,62 +49,19 @@ int checkDriveType(const char* disk) {
49 49  
50 50 map<int,SMARTAttr> prepareAttrMap(int driveType) {
51 51 map<int,SMARTAttr> map;
52   -
53   - SMARTAttr realloc;
54   - realloc.name = "Reallocated_Sector_Ct";
55   - realloc.value = -1;
56   - realloc.severity = WARN;
57   - realloc.optional = false;
58   - map[REALLOC_SEC_COUNT_ID] = realloc;
59   -
60   - SMARTAttr pending;
61   - SMARTAttr off_uncorrect;
62   - SMARTAttr wear;
63   - SMARTAttr wearout;
64   - SMARTAttr badblocks;
65   - SMARTAttr rep_uncorrect;
  52 + map[REALLOC_SEC_COUNT_ID] = reallocated;
  53 + map[REP_UNCORRECT_ID] = rep_uncorrect;
66 54  
67 55 switch(driveType) {
68 56 case HDD:
69   - pending.name = "Current_Pending_Sector";
70   - pending.value = -1;
71   - pending.severity = CRIT;
72   - pending.optional = false;
73 57 map[CURRENT_PENDING_SEC_ID] = pending;
74   -
75   - off_uncorrect.name = "Offline_Uncorrectable";
76   - off_uncorrect.value = -1;
77   - off_uncorrect.severity = CRIT;
78   - off_uncorrect.optional = false;
79 58 map[OFFLINE_UNCORRECT_ID] = off_uncorrect;
80   -
81   - break;
  59 + break;
82 60 case SSD:
83   - wear.name = "Wear_Leveling_Count";
84   - wear.value = -1;
85   - wear.severity = WARN;
86   - wear.optional = true;
87 61 map[WEAR_COUNT_ID] = wear;
88   -
89   - wearout.name = "Media_Wearout_Indicator";
90   - wearout.value = -1;
91   - wearout.severity = WARN;
92   - wearout.optional = true;
93   - map[WEAR_COUNT_ID] = wearout;
94   -
95   - badblocks.name = "Runtime_Bad_Block";
96   - badblocks.value = -1;
97   - badblocks.severity = CRIT;
98   - badblocks.optional = false;
99   - map[RUNTIME_BAD_BLOCKS_IDD] = badblocks;
100   -
101   - rep_uncorrect.name = "Reported_Uncorrect";
102   - rep_uncorrect.value = -1;
103   - rep_uncorrect.severity = CRIT;
104   - rep_uncorrect.optional = false;
105   - map[REP_UNCORRECT_ID] = rep_uncorrect;
106   -
107   - break;
  62 + map[MEDIA_WEAROUT_ID] = wearout;
  63 + map[RUNTIME_BAD_BLOCKS_ID] = badblocks;
  64 + break;
108 65 }
109 66 return map;
110 67 }
... ... @@ -148,10 +105,15 @@ int evalStatus(const char* disk, int driveType, string *status) {
148 105 *status = string(disk) + " status UNKNOWN";
149 106 return UNKN;
150 107 }
  108 +
151 109 int veredict = 0;
152   - if(attr.value) {
153   - veredict = attr.severity;
  110 + if(attr.value > attr.threshold_warn) {
  111 + veredict = WARN;
154 112 }
  113 + if(attr.threshold_crit != -1 && attr.value > attr.threshold_crit) {
  114 + veredict = CRIT;
  115 + }
  116 +
155 117 switch(veredict) {
156 118 case OK:
157 119 break;
... ...
check_smart/check_smart.h 100755 → 100644
... ... @@ -31,8 +31,8 @@
31 31 #define CURRENT_PENDING_SEC_ID 197
32 32 #define OFFLINE_UNCORRECT_ID 198
33 33 #define WEAR_COUNT_ID 177
34   -#define MEDIA_WEAROUT_INDICATOR 233
35   -#define RUNTIME_BAD_BLOCKS_IDD 183
  34 +#define MEDIA_WEAROUT_ID 233
  35 +#define RUNTIME_BAD_BLOCKS_ID 183
36 36 #define REP_UNCORRECT_ID 187
37 37  
38 38 #define HDD 0
... ... @@ -42,13 +42,79 @@ using namespace std;
42 42  
43 43 struct SMARTAttr
44 44 {
  45 + int id;
45 46 string name;
46 47 int value;
47   - int severity;
  48 + int threshold_warn;
  49 + int threshold_crit;
48 50 bool optional;
49 51 }; typedef struct SMARTAttr SMARTAttr;
50 52  
51 53  
  54 +// Attribute definitions
  55 +SMARTAttr reallocated = {
  56 + .id = REALLOC_SEC_COUNT_ID,
  57 + .name = "Reallocated_Sector_Ct",
  58 + .value = -1,
  59 + .threshold_warn = 0,
  60 + .threshold_crit = -1,
  61 + .optional = false,
  62 +};
  63 +
  64 +SMARTAttr pending = {
  65 + .id = CURRENT_PENDING_SEC_ID,
  66 + .name = "Current_Pending_Sector",
  67 + .value = -1,
  68 + .threshold_warn = 0,
  69 + .threshold_crit = -1,
  70 + .optional = false,
  71 +};
  72 +
  73 +SMARTAttr off_uncorrect = {
  74 + .id = OFFLINE_UNCORRECT_ID,
  75 + .name = "Offline_Uncorrectable",
  76 + .value = -1,
  77 + .threshold_warn = 0,
  78 + .threshold_crit = 0,
  79 + .optional = false,
  80 +};
  81 +
  82 +SMARTAttr wear = {
  83 + .id = WEAR_COUNT_ID,
  84 + .name = "Wear_Leveling_Count",
  85 + .value = -1,
  86 + .threshold_warn = 80,
  87 + .threshold_crit = 90,
  88 + .optional = true,
  89 +};
  90 +
  91 +SMARTAttr wearout = {
  92 + .id = MEDIA_WEAROUT_ID,
  93 + .name = "Media_Wearout_Indicator",
  94 + .value = -1,
  95 + .threshold_warn = 80,
  96 + .threshold_crit = 90,
  97 + .optional = true,
  98 +};
  99 +
  100 +SMARTAttr badblocks = {
  101 + .id = RUNTIME_BAD_BLOCKS_ID,
  102 + .name = "Runtime_Bad_Block",
  103 + .value = -1,
  104 + .threshold_warn = 0,
  105 + .threshold_crit = 0,
  106 + .optional = false,
  107 +};
  108 +
  109 +SMARTAttr rep_uncorrect = {
  110 + .id = REP_UNCORRECT_ID,
  111 + .name = "Reported_Uncorrect",
  112 + .value = -1,
  113 + .threshold_warn = 0,
  114 + .threshold_crit = 0,
  115 + .optional = false,
  116 +};
  117 +
52 118 map<int,SMARTAttr> prepareAttrMap(int driveType);
53 119 int getSmartAttrValue(string line);
54 120 int getSmartAttrID(string line);
... ...
check_tftp/auxiliar.cpp 100755 → 100644
check_tftp/auxiliar.h 100755 → 100644
check_tftp/check_tftp.h 100755 → 100644
check_upnp/README.md 100755 → 100644
check_upnp/auxiliar.cpp 100755 → 100644
check_upnp/auxiliar.h 100755 → 100644
check_upnp/check_upnp.cpp 100755 → 100644
check_upnp/check_upnp.h 100755 → 100644