]> granicus.if.org Git - icinga2/blob - lib/db_ido/dbconnection.ti
Merge pull request #7124 from Icinga/bugfix/namespace-thread-safe
[icinga2] / lib / db_ido / dbconnection.ti
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #include "db_ido/dbquery.hpp"
4 #include "base/configobject.hpp"
5
6 library db_ido;
7
8 namespace icinga
9 {
10
11 abstract class DbConnection : ConfigObject
12 {
13         [config] String table_prefix {
14                 default {{{ return "icinga_"; }}}
15         };
16
17         [config, required] Dictionary::Ptr cleanup {
18                 default {{{ return new Dictionary(); }}}
19         };
20
21         [config] Array::Ptr categories {
22                 default {{{
23                         return new Array({
24                                 "DbCatConfig",
25                                 "DbCatState",
26                                 "DbCatAcknowledgement",
27                                 "DbCatComment",
28                                 "DbCatDowntime",
29                                 "DbCatEventHandler",
30                                 "DbCatFlapping",
31                                 "DbCatNotification",
32                                 "DbCatProgramStatus",
33                                 "DbCatRetention",
34                                 "DbCatStateHistory"
35                         });
36                 }}}
37         };
38         [no_user_view, no_user_modify] int categories_filter_real (CategoryFilter);
39
40         [config] bool enable_ha {
41                 default {{{ return true; }}}
42         };
43
44         [config] double failover_timeout {
45                 default {{{ return 30; }}}
46         };
47
48         [state, no_user_modify] double last_failover;
49
50         [no_user_modify] String schema_version;
51         [no_user_modify] bool connected;
52         [no_user_modify] bool should_connect {
53                 default {{{ return true; }}}
54         };
55 };
56
57
58 validator DbConnection {
59         Dictionary cleanup {
60                 Number acknowledgements_age;
61                 Number commenthistory_age;
62                 Number contactnotifications_age;
63                 Number contactnotificationmethods_age;
64                 Number downtimehistory_age;
65                 Number eventhandlers_age;
66                 Number externalcommands_age;
67                 Number flappinghistory_age;
68                 Number hostchecks_age;
69                 Number logentries_age;
70                 Number notifications_age;
71                 Number processevents_age;
72                 Number statehistory_age;
73                 Number servicechecks_age;
74                 Number systemcommands_age;
75         };
76
77         Array categories {
78                 String "*";
79         };
80 };
81
82 }