-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.php
74 lines (65 loc) · 3.44 KB
/
setup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
function plugin_rrdexport_version () {
return array(
'name' => 'rrdexport',
'version' => '0.3',
'longname' => 'RRD Auto Export',
'author' => 'Pattapong Jantarach',
'homepage' => 'http://pattapongj.com',
'email' => 'pattapongj@qmail.org',
'url' => 'https://github.com/TheGU/cacti_rrdexport'
);
}
function plugin_rrdexport_install () {
api_plugin_register_hook('rrdexport', 'config_arrays', 'rrdexport_config_arrays', 'setup.php');
api_plugin_register_hook('rrdexport', 'config_settings', 'rrdexport_config_settings', 'includes/settings.php');
api_plugin_register_hook('rrdexport', 'poller_bottom', 'rrdexport_poller_bottom', 'includes/polling.php');
api_plugin_register_hook('rrdexport', 'draw_navigation_text', 'rrdexport_draw_navigation_text', 'setup.php');
api_plugin_register_realm('rrdexport', 'rrdexport.php', 'Plugin -> RRD Export Schedules', 1);
rrdexport_setup_database ();
}
function plugin_rrdexport_uninstall () {
}
function plugin_rrdexport_check_config () {
return true;
}
function plugin_rrdexport_upgrade () {
return false;
}
function rrdexport_version () {
return plugin_rrdexport_version();
}
function rrdexport_config_arrays () {
global $menu;
$menu["Management"]['plugins/rrdexport/rrdexport.php'] = "RRD Export Schedules";
}
function rrdexport_draw_navigation_text ($nav) {
$nav["rrdexport.php:"] = array("title" => "RRD Export Schedules", "mapping" => "index.php:", "url" => "rrdexport.php", "level" => "1");
$nav["rrdexport.php:edit"] = array("title" => "RRD Export Schedule (Edit)", "mapping" => "index.php:", "url" => "rrdexport.php", "level" => "1");
$nav["rrdexport.php:actions"] = array("title" => "RRD Export Schedules", "mapping" => "index.php:", "url" => "rrdexport.php", "level" => "1");
return $nav;
}
function rrdexport_setup_database () {
$data = array();
$data['columns'][] = array('name' => 'id', 'type' => 'int(11)', 'NULL' => false, 'auto_increment' => true);
$data['columns'][] = array('name' => 'cf_type', 'type' => 'varchar(8)', 'NULL' => false, 'default' => 'AVERAGE');
$data['columns'][] = array('name' => 'enabled', 'type' => 'varchar(3)', 'NULL' => false, 'default' => 'on');
$data['columns'][] = array('name' => 'name', 'type' => 'varchar(128)', 'NULL' => true);
$data['columns'][] = array('name' => 'stime', 'type' => 'int(22)', 'NULL' => false);
$data['columns'][] = array('name' => 'ltime', 'type' => 'int(22)', 'NULL' => true);
$data['columns'][] = array('name' => 'sc_interval', 'type' => 'int(11)', 'NULL' => false);
$data['primary'] = 'id';
$data['keys'][] = array('name' => 'enabled', 'columns' => 'enabled');
$data['type'] = 'MyISAM';
$data['comment'] = 'RRD Export Schedules';
api_plugin_db_table_create ('rrdexport', 'plugin_rrdexport_schedules', $data);
$data = array();
$data['columns'][] = array('name' => 'local_data_id', 'type' => 'int(12)', 'NULL' => false);
# $data['columns'][] = array('name' => 'rrd_path', 'type' => 'varchar(255)', 'NULL' => false);
$data['columns'][] = array('name' => 'schedule', 'type' => 'int(12)', 'NULL' => false);
$data['primary'] = 'schedule`, `local_data_id';
$data['keys'][] = array('name' => 'schedule', 'columns' => 'schedule');
$data['type'] = 'MyISAM';
$data['comment'] = 'RRD Export Schedules Datasource';
api_plugin_db_table_create ('rrdexport', 'plugin_rrdexport_datasource', $data);
}