Cacti 插件中setup.php 文件的编写
2012-06-06 14:16
218 查看
Cacti 插件中setup.php 文件的编写
名词: 初始化函数 预定义函数
cacti 插件存放在 /plugins 目录,由setup.php与cacti 做关联调用;
setup.php文件由/include/plugins.php /lib/plugins.php这两个文件做解释和调用
插件名要在/include/config.php 或/include/global.php 文件中声明
声明格式如下:
$plugins[] = 'thold';
setup.php文件放置目录/plugins/插件名/setup.php
setup.php的文件内容由插件初始化函数(plugin_init_插件名())和自定义函数组成
初始化函数声明格式:
function plugin_init_thold() {
global $plugin_hooks;
$plugin_hooks['user_admin_edit']['thold'] = 'thold_user_admin_edit';
}
预定义函数名列表:
自定义函数举例:
function thold_user_admin_edit ($user) {
global $fields_user_user_edit_host;
$value = '';
if ($user != 0) {
$value = db_fetch_cell("SELECT data FROM plugin_thold_contacts WHERE user_id
= $user AND type = 'email'");
}
$fields_user_user_edit_host['email'] = array(
"method" => "textbox",
"value" => $value,
"friendly_name" => "电子邮件地址",
"form_id" => "|arg1:id|",
"default" => "",
"max_length" => 255
);
}
名词: 初始化函数 预定义函数
cacti 插件存放在 /plugins 目录,由setup.php与cacti 做关联调用;
setup.php文件由/include/plugins.php /lib/plugins.php这两个文件做解释和调用
插件名要在/include/config.php 或/include/global.php 文件中声明
声明格式如下:
$plugins[] = 'thold';
setup.php文件放置目录/plugins/插件名/setup.php
setup.php的文件内容由插件初始化函数(plugin_init_插件名())和自定义函数组成
初始化函数声明格式:
$plugin_hooks | ['user_admin_edit'] | ['thold'] | = | 'thold_user_admin_edit' | ; |
| 预定义函数名 | 插件名 | | 自定义函数 | |
global $plugin_hooks;
$plugin_hooks['user_admin_edit']['thold'] = 'thold_user_admin_edit';
}
预定义函数名列表:
预定义函数名 | 插件引用函数 | 对应修改页面 |
auth_alternate_realms | do_hook_function() | auth.php |
login_options_navigate | api_plugin_hook_function() | auth_changepassword.php |
| | auth_login.php |
login_before | api_plugin_hook() | auth_login.php |
cacti_image | api_plugin_hook_function() | auth_login.php |
login_after | api_plugin_hook() | auth_login.php |
data_sources_table | api_plugin_hook_function() | data_sources.php |
graph_buttons | api_plugin_hook() | graph.php |
| | /lib/html.php |
graphs_action_array | api_plugin_hook_function() | graphs.php |
graphs_action_execute | api_plugin_hook_function() | graphs.php |
graphs_action_prepare | api_plugin_hook_function() | graphs.php |
graphs_new_top_links | api_plugin_hook() | graphs_new.php |
graph_image | api_plugin_hook_function() | graph_image.php |
device_action_array | api_plugin_hook_function() | host.php |
device_action_execute | api_plugin_hook_function() | host.php |
device_action_prepare | api_plugin_hook_function() | host.php |
console_before | api_plugin_hook() | index.php |
console_after | api_plugin_hook() | index.php |
poller_top | api_plugin_hook() | poller.php |
poller_command_args | api_plugin_hook_function() | poller.php |
poller_bottom | api_plugin_hook() | poller.php |
user_admin_action | api_plugin_hook_function() | user_admin.php |
user_admin_setup_sql_save | api_plugin_hook_function() | user_admin.php |
user_admin_user_save | api_plugin_hook() | user_admin.php |
user_admin_edit | api_plugin_hook_function() | user_admin.php |
user_admin_tab | api_plugin_hook() | user_admin.php |
user_admin_run_action | api_plugin_hook_function() | user_admin.php |
utilities_action | api_plugin_hook_function() | utilities.php |
utilities_list | api_plugin_hook() | utilities.php |
config_arrays | api_plugin_hook() | /include/global_arrays.php |
config_form | api_plugin_hook() | /include/global_form.php |
valid_host_fields | api_plugin_hook_function() | /include/global_form.php |
config_settings | api_plugin_hook() | /include/global_settings.php |
top_graph_header | api_plugin_hook_function() | /include/top_graph_header.php |
page_title | api_plugin_hook_function() | /include/top_graph_header.php |
| | /include/top_header.php |
top_graph_refresh | api_plugin_hook_function() | /include/top_graph_header.php |
page_head | api_plugin_hook() | /include/top_graph_header.php |
| | /include/top_header.php |
top_graph_header_tabs | api_plugin_hook() | /include/top_graph_header.php |
top_header | api_plugin_hook_function() | /include/top_header.php |
top_header_tabs | api_plugin_hook() | /include/top_header.php |
api_device_save | api_plugin_hook_function() | /lib/api_device.php |
draw_navigation_tex | api_plugin_hook_function() | /lib/functions.php |
poller_output | api_plugin_hook_function() | /lib/poller.php |
poller_on_demand | api_plugin_hook_function() | /lib/poller.php |
rrdtool_function_graph_cache_check | api_plugin_hook_function() | /lib/rrd.php |
rrd_graph_graph_options | api_plugin_hook_function() | /lib/rrd.php |
prep_graph_array | api_plugin_hook_function() | /lib/rrd.php |
rrdtool_function_graph_set_file | api_plugin_hook_function() | /lib/rrd.php |
substitute_host_data | api_plugin_hook_function() | /lib/variables.php |
function thold_user_admin_edit ($user) {
global $fields_user_user_edit_host;
$value = '';
if ($user != 0) {
$value = db_fetch_cell("SELECT data FROM plugin_thold_contacts WHERE user_id
= $user AND type = 'email'");
}
$fields_user_user_edit_host['email'] = array(
"method" => "textbox",
"value" => $value,
"friendly_name" => "电子邮件地址",
"form_id" => "|arg1:id|",
"default" => "",
"max_length" => 255
);
}
相关文章推荐
- php重定向 htaccess文件的编写
- 利用php调用so库文件中的代码和编写so简单实例
- PHP编写的图片验证码类文件分享
- 编写properties文件的Eclipse插件
- PHP之编写日志文件留后门(免杀)
- PHP生成word文件插件PHPWord使用介绍
- VIM PIV插件的bug,编辑PHP大文件偶尔会丢失语法高亮
- window环境下编写定时器(执行php文件执行)
- Sublime Text编写80×86汇编.asm文件的语法高亮插件
- 【Html5】JQuery插件ajaxFileUpload 异步上传文件(PHP版)
- javascript及php笔记:自己动手写一个ajax异步上传文件的jquery插件
- 编写一个读写倾斜测量数据.s3c文件格式的OSG插件osgdb_s3c
- PHP利用PHPExcel插件读取Excel文件内容
- PHP导出excel表格文件并下载,不需要利用插件
- 编写properties文件的Eclipse插件(plugin)
- 不错的编写properties文件的Eclipse插件
- C#编写dll库文件并注册为COM组件供其他语言(如PHP等)调用
- Python编写在Maya中查看文件列表的插件
- IA插件文件编写
- PHP结合jQuery插件ajaxFileUpload实现异步上传文件实例