| 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 | NSC_WRAPPERS_MAIN(); |
|---|
| 22 | #include <config.h> |
|---|
| 23 | #include <strEx.h> |
|---|
| 24 | #include <utils.h> |
|---|
| 25 | #include <checkHelpers.hpp> |
|---|
| 26 | |
|---|
| 27 | class CheckDisk { |
|---|
| 28 | private: |
|---|
| 29 | |
|---|
| 30 | public: |
|---|
| 31 | CheckDisk(); |
|---|
| 32 | virtual ~CheckDisk(); |
|---|
| 33 | // Module calls |
|---|
| 34 | bool loadModule(); |
|---|
| 35 | bool unloadModule(); |
|---|
| 36 | |
|---|
| 37 | std::wstring getModuleName() { |
|---|
| 38 | return _T("CheckDisk"); |
|---|
| 39 | } |
|---|
| 40 | std::wstring getModuleDescription() { |
|---|
| 41 | return _T("CheckDisk can check various file and disk related things.\nThe current version has commands to check Size of hard drives and directories."); |
|---|
| 42 | } |
|---|
| 43 | NSCModuleWrapper::module_version getModuleVersion() { |
|---|
| 44 | NSCModuleWrapper::module_version version = {0, 0, 1 }; |
|---|
| 45 | return version; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | bool hasCommandHandler(); |
|---|
| 49 | bool hasMessageHandler(); |
|---|
| 50 | std::wstring get_filter(unsigned int drvType); |
|---|
| 51 | NSCAPI::nagiosReturn handleCommand(const strEx::blindstr command, const unsigned int argLen, TCHAR **char_args, std::wstring &message, std::wstring &perf); |
|---|
| 52 | |
|---|
| 53 | // Check commands |
|---|
| 54 | NSCAPI::nagiosReturn CheckFileSize(const unsigned int argLen, TCHAR **char_args, std::wstring &message, std::wstring &perf); |
|---|
| 55 | NSCAPI::nagiosReturn CheckDriveSize(const unsigned int argLen, TCHAR **char_args, std::wstring &message, std::wstring &perf); |
|---|
| 56 | NSCAPI::nagiosReturn CheckFile(const unsigned int argLen, TCHAR **char_args, std::wstring &message, std::wstring &perf); |
|---|
| 57 | NSCAPI::nagiosReturn getFileAge(const unsigned int argLen, TCHAR **char_args, std::wstring &message, std::wstring &perf); |
|---|
| 58 | |
|---|
| 59 | private: |
|---|
| 60 | typedef checkHolders::CheckConatiner<checkHolders::MaxMinBoundsDiscSize> PathConatiner; |
|---|
| 61 | typedef checkHolders::CheckConatiner<checkHolders::MaxMinPercentageBoundsDiskSize> DriveConatiner; |
|---|
| 62 | }; |
|---|