| 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 "NSCAThread.h"
|
|---|
| 24 | #include <CheckMemory.h>
|
|---|
| 25 |
|
|---|
| 26 | NSC_WRAPPERS_MAIN();
|
|---|
| 27 | NSC_WRAPPERS_CLI();
|
|---|
| 28 |
|
|---|
| 29 | class NSCAAgent {
|
|---|
| 30 | private:
|
|---|
| 31 | CheckMemory memoryChecker;
|
|---|
| 32 | int processMethod_;
|
|---|
| 33 | // NSCAThreadImpl pdhThread;
|
|---|
| 34 | std::list<NSCAThreadImpl*> extra_threads;
|
|---|
| 35 |
|
|---|
| 36 | public:
|
|---|
| 37 |
|
|---|
| 38 | public:
|
|---|
| 39 | NSCAAgent();
|
|---|
| 40 | virtual ~NSCAAgent();
|
|---|
| 41 | // Module calls
|
|---|
| 42 | bool loadModule(NSCAPI::moduleLoadMode mode);
|
|---|
| 43 | bool unloadModule();
|
|---|
| 44 | std::wstring getConfigurationMeta();
|
|---|
| 45 |
|
|---|
| 46 | /**
|
|---|
| 47 | * Return the module name.
|
|---|
| 48 | * @return The module name
|
|---|
| 49 | */
|
|---|
| 50 | std::wstring getModuleName() {
|
|---|
| 51 | return _T("NSCAAgent");
|
|---|
| 52 | }
|
|---|
| 53 | /**
|
|---|
| 54 | * Module version
|
|---|
| 55 | * @return module version
|
|---|
| 56 | */
|
|---|
| 57 | NSCModuleWrapper::module_version getModuleVersion() {
|
|---|
| 58 | NSCModuleWrapper::module_version version = {0, 3, 0 };
|
|---|
| 59 | return version;
|
|---|
| 60 | }
|
|---|
| 61 | std::wstring getModuleDescription() {
|
|---|
| 62 | return _T("Various system related checks, such as CPU load, process state, service state memory usage and PDH counters.");
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | bool hasCommandHandler();
|
|---|
| 66 | bool hasMessageHandler();
|
|---|
| 67 | NSCAPI::nagiosReturn handleCommand(const strEx::blindstr command, const unsigned int argLen, TCHAR **char_args, std::wstring &msg, std::wstring &perf);
|
|---|
| 68 | int commandLineExec(const TCHAR* command, const unsigned int argLen, TCHAR** args);
|
|---|
| 69 |
|
|---|
| 70 | NSCAPI::nagiosReturn checkCPU(const unsigned int argLen, char **char_args, std::wstring &msg, std::wstring &perf);
|
|---|
| 71 | NSCAPI::nagiosReturn checkUpTime(const unsigned int argLen, char **char_args, std::wstring &msg, std::wstring &perf);
|
|---|
| 72 | NSCAPI::nagiosReturn checkServiceState(const unsigned int argLen, char **char_args, std::wstring &msg, std::wstring &perf);
|
|---|
| 73 | NSCAPI::nagiosReturn checkMem(const unsigned int argLen, char **char_args, std::wstring &msg, std::wstring &perf);
|
|---|
| 74 | NSCAPI::nagiosReturn checkProcState(const unsigned int argLen, char **char_args, std::wstring &msg, std::wstring &perf);
|
|---|
| 75 | NSCAPI::nagiosReturn checkCounter(const unsigned int argLen, char **char_args, std::wstring &msg, std::wstring &perf);
|
|---|
| 76 |
|
|---|
| 77 | }; |
|---|