| 1 | #pragma once |
|---|
| 2 | #include "PDHCollector.h" |
|---|
| 3 | #include <CheckMemory.h> |
|---|
| 4 | |
|---|
| 5 | NSC_WRAPPERS_MAIN(); |
|---|
| 6 | |
|---|
| 7 | class CheckSystem { |
|---|
| 8 | private: |
|---|
| 9 | CheckMemory memoryChecker; |
|---|
| 10 | int processMethod_; |
|---|
| 11 | PDHCollectorThread pdhThread; |
|---|
| 12 | |
|---|
| 13 | public: |
|---|
| 14 | typedef enum { started, stopped } states; |
|---|
| 15 | typedef struct rB { |
|---|
| 16 | NSCAPI::nagiosReturn code_; |
|---|
| 17 | std::string msg_; |
|---|
| 18 | std::string perf_; |
|---|
| 19 | rB(NSCAPI::nagiosReturn code, std::string msg) : code_(code), msg_(msg) {} |
|---|
| 20 | rB() : code_(NSCAPI::returnUNKNOWN) {} |
|---|
| 21 | } returnBundle; |
|---|
| 22 | |
|---|
| 23 | public: |
|---|
| 24 | CheckSystem(); |
|---|
| 25 | virtual ~CheckSystem(); |
|---|
| 26 | // Module calls |
|---|
| 27 | bool loadModule(); |
|---|
| 28 | bool unloadModule(); |
|---|
| 29 | std::string getConfigurationMeta(); |
|---|
| 30 | |
|---|
| 31 | /** |
|---|
| 32 | * Return the module name. |
|---|
| 33 | * @return The module name |
|---|
| 34 | */ |
|---|
| 35 | std::string getModuleName() { |
|---|
| 36 | return "System Checks Module."; |
|---|
| 37 | } |
|---|
| 38 | /** |
|---|
| 39 | * Module version |
|---|
| 40 | * @return module version |
|---|
| 41 | */ |
|---|
| 42 | NSCModuleWrapper::module_version getModuleVersion() { |
|---|
| 43 | NSCModuleWrapper::module_version version = {0, 3, 0 }; |
|---|
| 44 | return version; |
|---|
| 45 | } |
|---|
| 46 | std::string getModuleDescription() { |
|---|
| 47 | return "Various system related checks, such as CPU load, process state, service state memory usage and PDH counters."; |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | bool hasCommandHandler(); |
|---|
| 51 | bool hasMessageHandler(); |
|---|
| 52 | NSCAPI::nagiosReturn handleCommand(const strEx::blindstr command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | NSCAPI::nagiosReturn checkCPU(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); |
|---|
| 56 | NSCAPI::nagiosReturn checkUpTime(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); |
|---|
| 57 | NSCAPI::nagiosReturn checkServiceState(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); |
|---|
| 58 | NSCAPI::nagiosReturn checkMem(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); |
|---|
| 59 | NSCAPI::nagiosReturn checkProcState(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); |
|---|
| 60 | NSCAPI::nagiosReturn checkCounter(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf); |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | }; |
|---|