1<?php
2/*
3 +-------------------------------------------------------------------------+
4 | Copyright (C) 2004-2021 The Cacti Group                                 |
5 |                                                                         |
6 | This program is free software; you can redistribute it and/or           |
7 | modify it under the terms of the GNU General Public License             |
8 | as published by the Free Software Foundation; either version 2          |
9 | of the License, or (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 | Cacti: The Complete RRDtool-based Graphing Solution                     |
17 +-------------------------------------------------------------------------+
18 | This code is designed, written, and maintained by the Cacti Group. See  |
19 | about.php and/or the AUTHORS file for specific developer information.   |
20 +-------------------------------------------------------------------------+
21 | http://www.cacti.net/                                                   |
22 +-------------------------------------------------------------------------+
23*/
24
25define('CACTI_PHP_VERSION_MINIMUM', '5.4.0');
26
27define('CACTI_ESCAPE_CHARACTER', '"');
28define('COPYRIGHT_YEARS', 'Copyright (C) 2004-' . date('Y') . ' The Cacti Group');
29define('COPYRIGHT_YEARS_SHORT', '(c) 2004-' . date('Y') . ' - The Cacti Group');
30
31define('HOST_GROUPING_GRAPH_TEMPLATE', 1);
32define('HOST_GROUPING_DATA_QUERY_INDEX', 2);
33
34define('TREE_ORDERING_INHERIT', 0);
35define('TREE_ORDERING_NONE', 1);
36define('TREE_ORDERING_ALPHABETIC', 2);
37define('TREE_ORDERING_NUMERIC', 3);
38define('TREE_ORDERING_NATURAL', 4);
39
40define('TREE_ITEM_TYPE_HEADER', 1);
41define('TREE_ITEM_TYPE_GRAPH', 2);
42define('TREE_ITEM_TYPE_HOST', 3);
43
44define('RRDTOOL_OUTPUT_NULL', 0);
45define('RRDTOOL_OUTPUT_STDOUT', 1);
46define('RRDTOOL_OUTPUT_STDERR', 2);
47define('RRDTOOL_OUTPUT_GRAPH_DATA', 3);
48define('RRDTOOL_OUTPUT_BOOLEAN', 4);
49define('RRDTOOL_OUTPUT_RETURN_STDERR', 5);
50
51define('RRD_FONT_RENDER_NORMAL',  'normal');
52define('RRD_FONT_RENDER_LIGHT',   'light');
53define('RRD_FONT_RENDER_MONO',    'mono');
54
55define('RRD_GRAPH_RENDER_NORMAL', 'normal');
56define('RRD_GRAPH_RENDER_MONO',   'mono');
57
58define('RRD_LEGEND_POS_NORTH',    'north');
59define('RRD_LEGEND_POS_SOUTH',    'south');
60define('RRD_LEGEND_POS_WEST',     'west');
61define('RRD_LEGEND_POS_EAST',     'east');
62
63define('RRD_ALIGN_NONE',          '');
64define('RRD_ALIGN_LEFT',          'left');
65define('RRD_ALIGN_RIGHT',         'right');
66define('RRD_ALIGN_JUSTIFIED',     'justified');
67define('RRD_ALIGN_CENTER',        'center');
68
69define('RRD_LEGEND_DIR_TOPDOWN',  'topdown');
70define('RRD_LEGEND_DIR_BOTTOMUP', 'bottomup');
71
72define('RRD_FILE_VERSION1',       '0001');
73define('RRD_FILE_VERSION3',       '0003');
74
75define('DATA_QUERY_AUTOINDEX_NONE', 0);
76define('DATA_QUERY_AUTOINDEX_BACKWARDS_UPTIME', 1);
77define('DATA_QUERY_AUTOINDEX_INDEX_NUM_CHANGE', 2);
78define('DATA_QUERY_AUTOINDEX_FIELD_VERIFICATION', 3);
79
80define('DATA_INPUT_TYPE_SCRIPT', 1);
81define('DATA_INPUT_TYPE_SNMP', 2);
82define('DATA_INPUT_TYPE_SNMP_QUERY', 3);
83define('DATA_INPUT_TYPE_SCRIPT_QUERY', 4);
84define('DATA_INPUT_TYPE_PHP_SCRIPT_SERVER', 5);
85define('DATA_INPUT_TYPE_QUERY_SCRIPT_SERVER', 6);
86
87define('GRAPH_ITEM_TYPE_COMMENT',            1);
88define('GRAPH_ITEM_TYPE_HRULE',              2);
89define('GRAPH_ITEM_TYPE_VRULE',              3);
90define('GRAPH_ITEM_TYPE_LINE1',              4);
91define('GRAPH_ITEM_TYPE_LINE2',              5);
92define('GRAPH_ITEM_TYPE_LINE3',              6);
93define('GRAPH_ITEM_TYPE_AREA',               7);
94define('GRAPH_ITEM_TYPE_STACK',              8);
95define('GRAPH_ITEM_TYPE_GPRINT',             9);
96define('GRAPH_ITEM_TYPE_LEGEND',            10);
97define('GRAPH_ITEM_TYPE_GPRINT_LAST',       11);
98define('GRAPH_ITEM_TYPE_GPRINT_MAX',        12);
99define('GRAPH_ITEM_TYPE_GPRINT_MIN',        13);
100define('GRAPH_ITEM_TYPE_GPRINT_AVERAGE',    14);
101define('GRAPH_ITEM_TYPE_LEGEND_CAMM',       15);
102define('GRAPH_ITEM_TYPE_LINESTACK',         20);
103define('GRAPH_ITEM_TYPE_TIC',               30);
104define('GRAPH_ITEM_TYPE_TEXTALIGN',         40);
105
106/* used both for polling and reindexing */
107define('POLLER_ACTION_SNMP', 0);
108define('POLLER_ACTION_SCRIPT', 1);
109define('POLLER_ACTION_SCRIPT_PHP', 2);
110
111/* used for reindexing only:
112 * in case we do not have OID_NUM_INDEXES|ARG_NUM_INDEXES
113 * we simply use the OID_INDEX|ARG_INDEX and count number of indexes found
114 * so this is more of a REINDEX_ACTION_... thingy
115 */
116define('POLLER_ACTION_SNMP_COUNT', 10);
117define('POLLER_ACTION_SCRIPT_COUNT', 11);
118define('POLLER_ACTION_SCRIPT_PHP_COUNT', 12);
119
120define('POLLER_COMMAND_REINDEX', 1);
121define('POLLER_COMMAND_RRDPURGE', 2);
122define('POLLER_COMMAND_PURGE', 3);
123
124define('POLLER_VERBOSITY_NONE', 1);
125define('POLLER_VERBOSITY_LOW', 2);
126define('POLLER_VERBOSITY_MEDIUM', 3);
127define('POLLER_VERBOSITY_HIGH', 4);
128define('POLLER_VERBOSITY_DEBUG', 5);
129define('POLLER_VERBOSITY_DEVDBG', 6);
130
131define('POLLER_STATUS_NEW', 0);
132define('POLLER_STATUS_RUNNING', 1);
133define('POLLER_STATUS_IDLE', 2);
134define('POLLER_STATUS_DOWN', 3);
135define('POLLER_STATUS_DISABLED', 4);
136define('POLLER_STATUS_RECOVERING', 5);
137define('POLLER_STATUS_HEARTBEAT', 6);
138
139define('AVAIL_NONE', 0);
140define('AVAIL_SNMP_AND_PING', 1);
141define('AVAIL_SNMP', 2);
142define('AVAIL_PING', 3);
143define('AVAIL_SNMP_OR_PING', 4);
144define('AVAIL_SNMP_GET_SYSDESC', 5);
145define('AVAIL_SNMP_GET_NEXT', 6);
146
147define('PING_ICMP', 1);
148define('PING_UDP', 2);
149define('PING_TCP', 3);
150define('PING_SNMP', 4);
151
152define('HOST_UNKNOWN', 0);
153define('HOST_DOWN', 1);
154define('HOST_RECOVERING', 2);
155define('HOST_UP', 3);
156define('HOST_ERROR', 4);
157
158define('GT_CUSTOM', 0);
159define('GT_LAST_HALF_HOUR', 1);
160define('GT_LAST_HOUR', 2);
161define('GT_LAST_2_HOURS', 3);
162define('GT_LAST_4_HOURS', 4);
163define('GT_LAST_6_HOURS', 5);
164define('GT_LAST_12_HOURS', 6);
165define('GT_LAST_DAY', 7);
166define('GT_LAST_2_DAYS', 8);
167define('GT_LAST_3_DAYS', 9);
168define('GT_LAST_4_DAYS', 10);
169define('GT_LAST_WEEK', 11);
170define('GT_LAST_2_WEEKS', 12);
171define('GT_LAST_MONTH', 13);
172define('GT_LAST_2_MONTHS', 14);
173define('GT_LAST_3_MONTHS', 15);
174define('GT_LAST_4_MONTHS', 16);
175define('GT_LAST_6_MONTHS', 17);
176define('GT_LAST_YEAR', 18);
177define('GT_LAST_2_YEARS', 19);
178define('GT_DAY_SHIFT', 20);
179define('GT_THIS_DAY', 21);
180define('GT_THIS_WEEK', 22);
181define('GT_THIS_MONTH', 23);
182define('GT_THIS_YEAR', 24);
183define('GT_PREV_DAY', 25);
184define('GT_PREV_WEEK', 26);
185define('GT_PREV_MONTH', 27);
186define('GT_PREV_YEAR', 28);
187
188define('DEFAULT_TIMESPAN', 86400);
189
190# graph timeshifts
191define('GTS_CUSTOM', 0);
192define('GTS_HALF_HOUR', 1);
193define('GTS_1_HOUR', 2);
194define('GTS_2_HOURS', 3);
195define('GTS_4_HOURS', 4);
196define('GTS_6_HOURS', 5);
197define('GTS_12_HOURS', 6);
198define('GTS_1_DAY', 7);
199define('GTS_2_DAYS', 8);
200define('GTS_3_DAYS', 9);
201define('GTS_4_DAYS', 10);
202define('GTS_1_WEEK', 11);
203define('GTS_2_WEEKS', 12);
204define('GTS_1_MONTH', 13);
205define('GTS_2_MONTHS', 14);
206define('GTS_3_MONTHS', 15);
207define('GTS_4_MONTHS', 16);
208define('GTS_6_MONTHS', 17);
209define('GTS_1_YEAR', 18);
210define('GTS_2_YEARS', 19);
211
212define('DEFAULT_TIMESHIFT', 86400);
213
214# weekdays according to date('w') builtin function
215define('WD_SUNDAY', 	date('w',strtotime('sunday')));
216define('WD_MONDAY', 	date('w',strtotime('monday')));
217define('WD_TUESDAY', 	date('w',strtotime('tuesday')));
218define('WD_WEDNESDAY', 	date('w',strtotime('wednesday')));
219define('WD_THURSDAY', 	date('w',strtotime('thursday')));
220define('WD_FRIDAY', 	date('w',strtotime('friday')));
221define('WD_SATURDAY', 	date('w',strtotime('saturday')));
222
223define('GD_MO_D_Y', 0);
224define('GD_MN_D_Y', 1);
225define('GD_D_MO_Y', 2);
226define('GD_D_MN_Y', 3);
227define('GD_Y_MO_D', 4);
228define('GD_Y_MN_D', 5);
229
230define('GDC_HYPHEN', 0);
231define('GDC_SLASH', 1);
232define('GDC_DOT', 2);
233
234define('CVDEF_ITEM_TYPE_FUNCTION', 1);
235define('CVDEF_ITEM_TYPE_OPERATOR', 2);
236define('CVDEF_ITEM_TYPE_SPEC_DS', 4);
237define('CVDEF_ITEM_TYPE_CDEF', 5);
238define('CVDEF_ITEM_TYPE_STRING', 6);
239
240define('SNMP_POLLER', 0);
241define('SNMP_CMDPHP', 1);
242define('SNMP_WEBUI', 2);
243
244define('OPER_MODE_NATIVE', 0);
245define('OPER_MODE_RESKIN', 1);
246define('OPER_MODE_IFRAME_NONAV', 2);
247define('OPER_MODE_NOTABS', 3);
248
249define('BOOST_TIMER_START', 1);
250define('BOOST_TIMER_END', 0);
251define('BOOST_TIMER_STOP', BOOST_TIMER_END);
252define('BOOST_TIMER_TOTAL', 2);
253define('BOOST_TIMER_CYCLES', 3);
254define('BOOST_TIMER_OVERHEAD_MULTIPLIER', 20000);
255
256define('SNMPAGENT_EVENT_SEVERITY_LOW', 1);
257define('SNMPAGENT_EVENT_SEVERITY_MEDIUM', 2);
258define('SNMPAGENT_EVENT_SEVERITY_HIGH', 3);
259define('SNMPAGENT_EVENT_SEVERITY_CRITICAL', 4);
260
261define('CLOG_PERM_ADMIN', 0);
262define('CLOG_PERM_USER',  1);
263define('CLOG_PERM_NONE',  2);
264
265define('CHARS_PER_TIER', 3);
266define('MAX_TREE_DEPTH', 30);
267define('SORT_TYPE_TREE', 1);
268define('SORT_TYPE_TREE_ITEM', 2);
269
270define('REPORTS_SEND_NOW', 1);
271define('REPORTS_DUPLICATE', 2);
272define('REPORTS_ENABLE', 3);
273define('REPORTS_DISABLE', 4);
274define('REPORTS_DELETE', 99);
275define('REPORTS_OWN', 100);
276
277define('REPORTS_TYPE_INLINE_PNG', 1);
278define('REPORTS_TYPE_INLINE_JPG', 2);
279define('REPORTS_TYPE_INLINE_GIF', 3);
280define('REPORTS_TYPE_ATTACH_PNG', 11);
281define('REPORTS_TYPE_ATTACH_JPG', 12);
282define('REPORTS_TYPE_ATTACH_GIF', 13);
283define('REPORTS_TYPE_INLINE_PNG_LN', 91);
284define('REPORTS_TYPE_INLINE_JPG_LN', 92);
285define('REPORTS_TYPE_INLINE_GIF_LN', 93);
286
287define('REPORTS_ITEM_GRAPH', 1);
288define('REPORTS_ITEM_TEXT', 2);
289define('REPORTS_ITEM_TREE', 3);
290define('REPORTS_ITEM_HR', 4);
291
292define('REPORTS_ALIGN_LEFT', 1);
293define('REPORTS_ALIGN_CENTER', 2);
294define('REPORTS_ALIGN_RIGHT', 3);
295define('REPORTS_SCHED_INTVL_MINUTE', 10);
296define('REPORTS_SCHED_INTVL_HOUR', 11);
297
298define('REPORTS_SCHED_INTVL_DAY', 1);
299define('REPORTS_SCHED_INTVL_WEEK', 2);
300define('REPORTS_SCHED_INTVL_MONTH_DAY', 3);
301define('REPORTS_SCHED_INTVL_MONTH_WEEKDAY', 4);
302define('REPORTS_SCHED_INTVL_YEAR', 5);
303
304define('REPORTS_SCHED_COUNT', 1);
305define('REPORTS_SCHED_OFFSET', 0);
306
307define('REPORTS_GRAPH_LINK', 0);
308
309define('REPORTS_FONT_SIZE', 10);
310define('REPORTS_HOST_NONE', 0);
311define('REPORTS_TREE_NONE', 0);
312define('REPORTS_TIMESPAN_DEFAULT', GT_LAST_DAY);
313
314define('REPORTS_EXTENSION_GD', 'gd');
315
316define('REPORTS_OUTPUT_STDOUT', 1);
317define('REPORTS_OUTPUT_EMAIL',  2);
318
319define('REPORTS_DEFAULT_MAX_SIZE', 10485760);
320
321# unless a hook for 'global_constants' is available, all DEFINEs go here
322define('AGGREGATE_GRAPH_TYPE_KEEP',          0);
323define('AGGREGATE_GRAPH_TYPE_KEEP_STACKED', 50);
324define('AGGREGATE_GRAPH_TYPE_LINE1_STACK',  51);
325define('AGGREGATE_GRAPH_TYPE_LINE2_STACK',  52);
326define('AGGREGATE_GRAPH_TYPE_LINE3_STACK',  53);
327
328define('AGGREGATE_TOTAL_NONE', 1);
329define('AGGREGATE_TOTAL_ALL', 2);
330define('AGGREGATE_TOTAL_ONLY', 3);
331
332define('AGGREGATE_TOTAL_TYPE_SIMILAR', 1);
333define('AGGREGATE_TOTAL_TYPE_ALL', 2);
334
335define('AGGREGATE_ORDER_NONE', 1);
336define('AGGREGATE_ORDER_DS_GRAPH', 2);
337define('AGGREGATE_ORDER_GRAPH_DS', 3);
338define('AGGREGATE_ORDER_BASE_GRAPH', 4);
339
340define('AUTOMATION_OP_NONE', 0);
341define('AUTOMATION_OP_CONTAINS', 1);
342define('AUTOMATION_OP_CONTAINS_NOT', 2);
343define('AUTOMATION_OP_BEGINS', 3);
344define('AUTOMATION_OP_BEGINS_NOT', 4);
345define('AUTOMATION_OP_ENDS', 5);
346define('AUTOMATION_OP_ENDS_NOT', 6);
347define('AUTOMATION_OP_MATCHES', 7);
348define('AUTOMATION_OP_MATCHES_NOT', 8);
349define('AUTOMATION_OP_LT', 9);
350define('AUTOMATION_OP_LE', 10);
351define('AUTOMATION_OP_GT', 11);
352define('AUTOMATION_OP_GE', 12);
353define('AUTOMATION_OP_UNKNOWN', 13);
354define('AUTOMATION_OP_NOT_UNKNOWN', 14);
355define('AUTOMATION_OP_EMPTY', 15);
356define('AUTOMATION_OP_NOT_EMPTY', 16);
357define('AUTOMATION_OP_REGEXP', 17);
358define('AUTOMATION_OP_NOT_REGEXP', 18);
359
360define('AUTOMATION_OPER_NULL', 0);
361define('AUTOMATION_OPER_AND', 1);
362define('AUTOMATION_OPER_OR', 2);
363define('AUTOMATION_OPER_LEFT_BRACKET', 3);
364define('AUTOMATION_OPER_RIGHT_BRACKET', 4);
365
366define('AUTOMATION_TREE_ITEM_TYPE_STRING', '0');
367
368define('AUTOMATION_RULE_TYPE_GRAPH_MATCH', 1);
369define('AUTOMATION_RULE_TYPE_GRAPH_ACTION', 2);
370define('AUTOMATION_RULE_TYPE_TREE_MATCH', 3);
371define('AUTOMATION_RULE_TYPE_TREE_ACTION', 4);
372
373# pseudo table name required as long as Data Query XML resides in files
374define('AUTOMATION_RULE_TABLE_XML', 'XML');
375
376define('AUTOMATION_ACTION_GRAPH_DUPLICATE', 1);
377define('AUTOMATION_ACTION_GRAPH_ENABLE', 2);
378define('AUTOMATION_ACTION_GRAPH_DISABLE', 3);
379define('AUTOMATION_ACTION_GRAPH_DELETE', 99);
380define('AUTOMATION_ACTION_TREE_DUPLICATE', 1);
381define('AUTOMATION_ACTION_TREE_ENABLE', 2);
382define('AUTOMATION_ACTION_TREE_DISABLE', 3);
383define('AUTOMATION_ACTION_TREE_DELETE', 99);
384
385if (isset($database_type) && $database_type == 'mysql') {
386	define('SQL_NO_CACHE', 'SQL_NO_CACHE');
387} else {
388	define('SQL_NO_CACHE', '');
389}
390
391define('MAX_DISPLAY_PAGES', 5);
392define('CHECKED', 'on');
393
394define('FILTER_VALIDATE_MAX_DATE_AS_INT', 2088385563);
395define('FILTER_VALIDATE_IS_REGEX',             99999);
396define('FILTER_VALIDATE_IS_NUMERIC_ARRAY',    100000);
397define('FILTER_VALIDATE_IS_NUMERIC_LIST',     100001);
398
399/* socket errors */
400define('ENOTSOCK',        88);
401define('EDESTADDRREQ',    89);
402define('EMSGSIZE',        90);
403define('EPROTOTYPE',      91);
404define('ENOPROTOOPT',     92);
405define('EPROTONOSUPPORT', 93);
406define('ESOCKTNOSUPPORT', 94);
407define('EOPNOTSUPP',      95);
408define('EPFNOSUPPORT',    96);
409define('EAFNOSUPPORT',    97);
410define('EADDRINUSE',      98);
411define('EADDRNOTAVAIL',   99);
412define('ENETDOWN',        100);
413define('ENETUNREACH',     101);
414define('ENETRESET',       102);
415define('ECONNABORTED',    103);
416define('ECONNRESET',      104);
417define('ENOBUFS',         105);
418define('EISCONN',         106);
419define('ENOTCONN',        107);
420define('ESHUTDOWN',       108);
421define('ETOOMANYREFS',    109);
422define('ETIMEDOUT',       110);
423define('ECONNREFUSED',    111);
424define('EHOSTDOWN',       112);
425define('EHOSTUNREACH',    113);
426define('EALREADY',        114);
427define('EINPROGRESS',     115);
428define('EREMOTEIO',       121);
429define('ECANCELED',       125);
430
431define('DB_STATUS_ERROR'  , 0);
432define('DB_STATUS_WARNING', 1);
433define('DB_STATUS_SUCCESS', 2);
434define('DB_STATUS_SKIPPED', 3);
435
436define('MESSAGE_LEVEL_NONE',  0);
437define('MESSAGE_LEVEL_INFO',  1);
438define('MESSAGE_LEVEL_WARN',  2);
439define('MESSAGE_LEVEL_ERROR', 3);
440define('MESSAGE_LEVEL_CSRF',  4);
441define('MESSAGE_LEVEL_MIXED', 5);
442
443if (!defined('PASSWORD_DEFAULT')) {
444	define('PASSWORD_DEFAULT', 1);
445}
446
447define('CACTI_MAIL_PHP', 0);
448define('CACTI_MAIL_SENDMAIL', 1);
449define('CACTI_MAIL_SMTP', 2);
450
451define('DAYS_FORMAT_SHORT', 0);
452define('DAYS_FORMAT_MEDIUM', 1);
453define('DAYS_FORMAT_MEDIUM_LOG', 2);
454define('DAYS_FORMAT_LONG', 3);
455define('DAYS_FORMAT_LONG_LOG', 4);
456
457define('GRAPH_SOURCE_PLAIN', 0);
458define('GRAPH_SOURCE_DATA_QUERY', 1);
459define('GRAPH_SOURCE_TEMPLATE', 2);
460define('GRAPH_SOURCE_AGGREGATE', 3);
461
462define('CACTI_LANGUAGE_HANDLER_NONE', 0);
463define('CACTI_LANGUAGE_HANDLER_PHPGETTEXT', 1);
464define('CACTI_LANGUAGE_HANDLER_OSCAROTERO', 2);
465define('CACTI_LANGUAGE_HANDLER_MOTRANSLATOR', 3);
466
467if (!defined('LDAP_OPT_X_TLS_NEVER')) {
468	define('LDAP_OPT_X_TLS_NEVER', 0);
469	define('LDAP_OPT_X_TLS_HARD', 1);
470	define('LDAP_OPT_X_TLS_DEMAND', 2);
471	define('LDAP_OPT_X_TLS_ALLOW', 3);
472	define('LDAP_OPT_X_TLS_TRY', 4);
473}
474
475