source: nscp/modules/Scheduler/Scheduler.h @ 83c2453

0.4.00.4.10.4.2
Last change on this file since 83c2453 was 76540c3, checked in by Michael Medin <michael@…>, 15 months ago
  • Added support for specifying targets on schedules: settings/scheduler/schedules/foo target = foo-host Will re-target the NSCA (or whatever you use) towards a given target.
  • Fixed is schedule manager uses new standard object reader
  • Fixed some issues with reading schedule
  • Property mode set to 100644
File size: 2.7 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***************************************************************************/
21NSC_WRAPPERS_MAIN();
22//#include <config.h>
23#include <strEx.h>
24
25#include "simple_scheduler.hpp"
26#include "schedules.hpp"
27
28
29class Scheduler : public scheduler::schedule_handler, public nscapi::impl::simple_plugin {
30private:
31        std::wstring schedule_path;
32        scheduler::simple_scheduler scheduler_;
33        schedules::schedule_handler schedules_;
34
35
36public:
37        Scheduler() {
38                scheduler_.set_handler(this);
39        }
40        virtual ~Scheduler() {}
41        // Module calls
42        bool loadModule();
43        bool loadModuleEx(std::wstring alias, NSCAPI::moduleLoadMode mode);
44        bool unloadModule();
45
46
47        void add_schedule(std::wstring alias, std::wstring command);
48        //scheduler::target read_schedule(std::wstring path, std::wstring comment, scheduler::target *def = NULL);
49        void handle_schedule(schedules::schedule_object item);
50        void on_error(std::wstring error);
51
52        static std::wstring getModuleName() {
53                return _T("Scheduler");
54        }
55        static nscapi::plugin_wrapper::module_version getModuleVersion() {
56                nscapi::plugin_wrapper::module_version version = {0, 3, 0 };
57                return version;
58        }
59        static std::wstring getModuleDescription() {
60                return _T("A scheduler which schedules checks at regular intervals");
61        }
62};
Note: See TracBrowser for help on using the repository browser.