source: nscp/trunk/modules/CheckSystem/CheckSystem.h @ d1dd484

Last change on this file since d1dd484 was 2172776, checked in by Michael Medin <michael@…>, 6 years ago

2006-03-05 MickeM

  • Fixed -v FILEAGE check_nt (NSClient) check.
  • Added licence agreement header to all files
  • Property mode set to 100644
File size: 3.5 KB
Line 
1/**************************************************************************
2*   Copyright (C) 2004-2007 by Michael Medin <michael@medin.name>         *
3*                                                                         *
4*   This code is part of NSClient++ - http://trac.nakednuns.org/nscp      *
5*                                                                         *
6*   This program is free software; you can redistribute it and/or modify  *
7*   it under the terms of the GNU General Public License as published by  *
8*   the Free Software Foundation; either version 2 of the License, or     *
9*   (at your option) any later version.                                   *
10*                                                                         *
11*   This program is distributed in the hope that it will be useful,       *
12*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14*   GNU General Public License for more details.                          *
15*                                                                         *
16*   You should have received a copy of the GNU General Public License     *
17*   along with this program; if not, write to the                         *
18*   Free Software Foundation, Inc.,                                       *
19*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
20***************************************************************************/
21#pragma once
22
23#include "PDHCollector.h"
24#include <CheckMemory.h>
25
26NSC_WRAPPERS_MAIN();
27NSC_WRAPPERS_CLI();
28
29class CheckSystem {
30private:
31        CheckMemory memoryChecker;
32        int processMethod_;
33        PDHCollectorThread pdhThread;
34
35public:
36        typedef enum { started, stopped } states;
37        typedef struct rB {
38                NSCAPI::nagiosReturn code_;
39                std::string msg_;
40                std::string perf_;
41                rB(NSCAPI::nagiosReturn code, std::string msg) : code_(code), msg_(msg) {}
42                rB() : code_(NSCAPI::returnUNKNOWN) {}
43        } returnBundle;
44
45public:
46        CheckSystem();
47        virtual ~CheckSystem();
48        // Module calls
49        bool loadModule();
50        bool unloadModule();
51        std::string getConfigurationMeta();
52
53        /**
54        * Return the module name.
55        * @return The module name
56        */
57        std::string getModuleName() {
58                return "CheckSystem";
59        }
60        /**
61        * Module version
62        * @return module version
63        */
64        NSCModuleWrapper::module_version getModuleVersion() {
65                NSCModuleWrapper::module_version version = {0, 3, 0 };
66                return version;
67        }
68        std::string getModuleDescription() {
69                return "Various system related checks, such as CPU load, process state, service state memory usage and PDH counters.";
70        }
71
72        bool hasCommandHandler();
73        bool hasMessageHandler();
74        NSCAPI::nagiosReturn handleCommand(const strEx::blindstr command, const unsigned int argLen, char **char_args, std::string &msg, std::string &perf);
75        int commandLineExec(const char* command,const unsigned int argLen,char** args);
76
77        NSCAPI::nagiosReturn checkCPU(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf);
78        NSCAPI::nagiosReturn checkUpTime(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf);
79        NSCAPI::nagiosReturn checkServiceState(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf);
80        NSCAPI::nagiosReturn checkMem(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf);
81        NSCAPI::nagiosReturn checkProcState(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf);
82        NSCAPI::nagiosReturn checkCounter(const unsigned int argLen, char **char_args, std::string &msg, std::string &perf);
83
84};
Note: See TracBrowser for help on using the repository browser.