| 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 | NSC_WRAPPERS_MAIN();
|
|---|
| 24 |
|
|---|
| 25 | class CheckNSCP : public nscapi::impl::SimpleCommand, public nscapi::impl::simple_plugin, public nscapi::impl::simple_log_handler {
|
|---|
| 26 | private:
|
|---|
| 27 | MutexHandler mutex_;
|
|---|
| 28 | std::wstring crashFolder;
|
|---|
| 29 | typedef std::list<std::string> error_list;
|
|---|
| 30 | error_list errors_;
|
|---|
| 31 | public:
|
|---|
| 32 | // Module calls
|
|---|
| 33 | bool loadModule();
|
|---|
| 34 | bool loadModuleEx(std::wstring alias, NSCAPI::moduleLoadMode mode);
|
|---|
| 35 | bool unloadModule();
|
|---|
| 36 | std::wstring getConfigurationMeta();
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | std::wstring getModuleName() {
|
|---|
| 40 | return _T("Check NSCP");
|
|---|
| 41 | }
|
|---|
| 42 | nscapi::plugin_wrapper::module_version getModuleVersion() {
|
|---|
| 43 | nscapi::plugin_wrapper::module_version version = {0, 0, 1 };
|
|---|
| 44 | return version;
|
|---|
| 45 | }
|
|---|
| 46 | std::wstring getModuleDescription() {
|
|---|
| 47 | return _T("Checkes the state of " SZAPPNAME);
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | bool hasCommandHandler();
|
|---|
| 51 | bool hasMessageHandler();
|
|---|
| 52 | void handleMessage(int msgType, const std::string file, int line, std::string message);
|
|---|
| 53 | NSCAPI::nagiosReturn handleCommand(const strEx::wci_string command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf);
|
|---|
| 54 | std::string render(int msgType, const std::string file, int line, std::string message);
|
|---|
| 55 | NSCAPI::nagiosReturn check_nscp( std::list<std::wstring> arguments, std::wstring & msg, std::wstring & perf );
|
|---|
| 56 | int get_crashes(std::wstring &last_crash);
|
|---|
| 57 | int get_errors(std::wstring &last_error);
|
|---|
| 58 | }; |
|---|