本文整理汇总了PHP中api_plugin_hook函数的典型用法代码示例。如果您正苦于以下问题:PHP api_plugin_hook函数的具体用法?PHP api_plugin_hook怎么用?PHP api_plugin_hook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_plugin_hook函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: host_edit
function host_edit()
{
global $fields_host_edit, $reindex_types;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('id'));
/* ==================================================== */
api_plugin_hook('host_edit_top');
if (!empty($_REQUEST['id'])) {
$host = db_fetch_row_prepared('SELECT * FROM host WHERE id = ?', array($_REQUEST['id']));
$header_label = '[edit: ' . htmlspecialchars($host['description']) . ']';
} else {
$header_label = '[new]';
}
if (!empty($host['id'])) {
?>
<table width='100%' align='center'>
<tr>
<td class='textInfo' colspan='2'>
<?php
print htmlspecialchars($host['description']);
?>
(<?php
print htmlspecialchars($host['hostname']);
?>
)
</td>
<td rowspan='2' class='textInfo' valign='top' align='right'>
<span class='linkMarker'>*</span><a class='hyperLink' href='<?php
print htmlspecialchars('graphs_new.php?host_id=' . $host['id']);
?>
'>Create Graphs for this Device</a><br>
<span class='linkMarker'>*</span><a class='hyperLink' href='<?php
print htmlspecialchars('data_sources.php?host_id=' . $host['id'] . '&ds_rows=30&filter=&template_id=-1&method_id=-1&page=1');
?>
'>Data Source List</a><br>
<span class='linkMarker'>*</span><a class='hyperLink' href='<?php
print htmlspecialchars('graphs.php?host_id=' . $host['id'] . '&graph_rows=30&filter=&template_id=-1&page=1');
?>
'>Graph List</a>
<?php
api_plugin_hook('device_edit_top_links');
?>
</td>
</tr>
<tr>
<td valign='top' class='textHeader'>
<div id='ping_results'>Pinging Device <i style='font-size:12px;' class='fa fa-spin fa-spinner'></i><br><br></div>
</td>
</tr>
</table>
<?php
}
html_start_box("<strong>Device</strong> {$header_label}", '100%', '', '3', 'center', '');
/* preserve the host template id if passed in via a GET variable */
if (!empty($_REQUEST['host_template_id'])) {
$fields_host_edit['host_template_id']['value'] = $_REQUEST['host_template_id'];
}
draw_edit_form(array('config' => array('form_name' => 'chk'), 'fields' => inject_form_variables($fields_host_edit, isset($host) ? $host : array())));
/* we have to hide this button to make a form change in the main form trigger the correct
* submit action */
echo "<div style='display:none;'><input type='submit' value='Default Submit Button'></div>";
html_end_box();
?>
<script type="text/javascript">
<!--
// default snmp information
var snmp_community = $('#snmp_community').val();
var snmp_username = $('#snmp_username').val();
var snmp_password = $('#snmp_password').val();
var snmp_auth_protocol = $('#snmp_auth_protocol').val();
var snmp_priv_passphrase = $('#snmp_priv_passphrase').val();
var snmp_priv_protocol = $('#snmp_priv_protocol').val();
var snmp_context = $('#snmp_context').val();
var snmp_port = $('#snmp_port').val();
var snmp_timeout = $('#snmp_timeout').val();
var max_oids = $('#max_oids').val();
// default ping methods
var ping_method = $('#ping_method').val();
var ping_port = $('#ping_port').val();
var ping_timeout = $('#ping_timeout').val();
var ping_retries = $('#ping_retries').val();
function setPing() {
availability_method = $('#availability_method').val();
ping_method = $('#ping_method').val();
switch(availability_method) {
case '0': // none
$('#row_ping_method').css('display', 'none');
$('#row_ping_port').css('display', 'none');
$('#row_ping_timeout').css('display', 'none');
$('#row_ping_retries').css('display', 'none');
break;
case '2': // snmp
case '5': // snmp sysDesc
case '6': // snmp getNext
$('#row_ping_method').css('display', 'none');
//.........这里部分代码省略.........
示例2: utilities
function utilities()
{
html_start_box("<strong>Cacti System Utilities</strong>", "100%", "", "3", "center", "");
?>
<colgroup span="3">
<col valign="top" width="20%"></col>
<col valign="top" width="80%"></col>
</colgroup>
<?php
html_header(array("Technical Support"), 2);
form_alternate_row();
?>
<td class="textArea">
<a href='<?php
print htmlspecialchars("utilities.php?action=view_tech");
?>
'>Technical Support</a>
</td>
<td class="textArea">
Cacti technical support page. Used by developers and technical support persons to assist with issues in Cacti. Includes checks for common configuration issues.
</td>
</tr>
<?php
html_header(array("Log Administration"), 2);
form_alternate_row();
?>
<td class="textArea">
<a href='<?php
print htmlspecialchars("utilities.php?action=view_logfile");
?>
'>View Cacti Log File</a>
</td>
<td class="textArea">
The Cacti Log File stores statistic, error and other message depending on system settings. This information can be used to identify problems with the poller and application.
</td>
</tr>
<?php
form_alternate_row();
?>
<td class="textArea">
<a href='<?php
print htmlspecialchars("utilities.php?action=view_user_log");
?>
'>View User Log</a>
</td>
<td class="textArea">
Allows Administrators to browse the user log. Administrators can filter and export the log as well.
</td>
</tr>
<?php
html_header(array("Poller Cache Administration"), 2);
form_alternate_row();
?>
<td class="textArea">
<a href='<?php
print htmlspecialchars("utilities.php?action=view_poller_cache");
?>
'>View Poller Cache</a>
</td>
<td class="textArea">
This is the data that is being passed to the poller each time it runs. This data is then in turn executed/interpreted and the results are fed into the rrd files for graphing or the database for display.
</td>
</tr>
<?php
form_alternate_row();
?>
<td class="textArea">
<a href='<?php
print htmlspecialchars("utilities.php?action=view_snmp_cache");
?>
'>View SNMP Cache</a>
</td>
<td class="textArea">
The SNMP cache stores information gathered from SNMP queries. It is used by cacti to determine the OID to use when gathering information from an SNMP-enabled host.
</td>
</tr>
<?php
form_alternate_row();
?>
<td class="textArea">
<a href='<?php
print htmlspecialchars("utilities.php?action=clear_poller_cache");
?>
'>Rebuild Poller Cache</a>
</td>
<td class="textArea">
The poller cache will be cleared and re-generated if you select this option. Sometimes host/data source data can get out of sync with the cache in which case it makes sense to clear the cache and start over.
</td>
</tr>
<?php
api_plugin_hook('utilities_list');
html_end_box();
}
示例3: syslog_filter
//.........这里部分代码省略.........
?>
"'>
<input type='button' value='Removals' title='View Syslog Removal Rules' onClick='javascript:document.location="<?php
print $config['url_path'] . "plugins/syslog/syslog_removal.php";
?>
"'>
<input type='button' value='Reports' title='View Syslog Reports' onClick='javascript:document.location="<?php
print $config['url_path'] . "plugins/syslog/syslog_reports.php";
?>
"'>
</td><?php
}
?>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr bgcolor="<?php
print $colors["panel"];
?>
" class="noprint">
<td>
<table cellpadding="0" cellspacing="0">
<tr>
<td nowrap style='white-space: nowrap;' width='60'>
<strong>Search:</strong>
</td>
<td style='padding-right:2px;'>
<input type="text" name="filter" size="30" value="<?php
print $_REQUEST["filter"];
?>
">
</td>
<?php
api_plugin_hook('syslog_extend_filter');
?>
<td style='padding-right:2px;'>
<select name="efacility" onChange="javascript:document.getElementById('syslog_form').submit();" title="Facilities">
<option value="0"<?php
if ($_REQUEST["efacility"] == "0") {
?>
selected<?php
}
?>
>All Facilities</option>
<?php
if (!isset($hostfilter)) {
$hostfilter = "";
}
$efacilities = syslog_db_fetch_assoc("SELECT DISTINCT f.facility_id, f.facility\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . $syslogdb_default . "`.`syslog_host_facilities` AS fh\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN `" . $syslogdb_default . "`.`syslog_facilities` AS f\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tON f.facility_id=fh.facility_id " . (strlen($hostfilter) ? "WHERE " : "") . $hostfilter . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY facility");
if (sizeof($efacilities)) {
foreach ($efacilities as $efacility) {
print "<option value=" . $efacility["facility_id"];
if ($_REQUEST["efacility"] == $efacility["facility_id"]) {
print " selected";
}
print ">" . ucfirst($efacility["facility"]) . "</option>\n";
}
}
?>
</select>
</td>
<td style='padding-right:2px;'>
<select name="elevel" onChange="javascript:document.getElementById('syslog_form').submit();" title="Priority Levels">
<option value="0"<?php
if ($_REQUEST["elevel"] == "0") {
?>
示例4: utilities
//.........这里部分代码省略.........
</td>
</tr>
<?php
form_alternate_row();
?>
<td class='textArea'>
<a href='<?php
print htmlspecialchars('utilities.php?action=clear_poller_cache');
?>
'>Rebuild Poller Cache</a>
</td>
<td class='textArea'>
The poller cache will be cleared and re-generated if you select this option. Sometimes host/data source data can get out of sync with the cache in which case it makes sense to clear the cache and start over.
</td>
</tr>
<?php
html_header(array('Boost Utilities'), 2);
form_alternate_row();
?>
<td class='textArea'>
<a href='<?php
print htmlspecialchars('utilities.php?action=view_boost_status');
?>
'>View Boost Status</a>
</td>
<td class='textArea'>
This menu pick allows you to view various boost settings and statistics associated with the current running Boost configuration.
</td>
</tr>
<?php
html_header(array('RRD Utilities'), 2);
form_alternate_row();
?>
<td class='textArea'>
<a href='<?php
print htmlspecialchars('rrdcleaner.php');
?>
'>RRDfile Cleaner</a>
</td>
<td class='textArea'>
When you delete Data Sources from Cacti, the corresponding RRDfiles are not removed automatically. Use this utility to facilitate the removal of these old files.
</td>
</tr>
<?php
html_header(array('SNMPAgent Utilities'), 2);
form_alternate_row();
?>
<td class='textArea'>
<a href='<?php
print htmlspecialchars('utilities.php?action=view_snmpagent_cache');
?>
'>View SNMPAgent Cache</a>
</td>
<td class='textArea'>
This shows all objects being handled by the SNMPAgent.
</td>
</tr>
<?php
form_alternate_row();
?>
<td class='textArea'>
<a href='<?php
print htmlspecialchars('utilities.php?action=rebuild_snmpagent_cache');
?>
'>Rebuild SNMPAgent Cache</a>
</td>
<td class='textArea'>
The snmp cache will be cleared and re-generated if you select this option. Note that it takes another poller run to restore the SNMP cache completely.
</td>
</tr>
<?php
form_alternate_row();
?>
<td class='textArea'>
<a href='<?php
print htmlspecialchars('utilities.php?action=view_snmpagent_events');
?>
'>View SNMPAgent Notification Log</a>
</td>
<td class='textArea'>
This menu pick allows you to view the latest events SNMPAgent has handled in relation to the registered notification receivers.
</td>
</tr>
<?php
form_alternate_row();
?>
<td class='textArea'>
<a href='<?php
print htmlspecialchars('managers.php');
?>
'>SNMP Notification Receivers</a>
</td>
<td class='textArea'>
Allows Administrators to maintain SNMP notification receivers.
</td>
</tr>
<?php
api_plugin_hook('utilities_list');
html_end_box();
}
示例5: unset
}
}
unset($input);
}
/* include base modules */
include_once $config["library_path"] . "/adodb/adodb.inc.php";
include_once $config["library_path"] . "/database.php";
/* connect to the database server */
db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port, $database_ssl);
/* include additional modules */
include_once $config["library_path"] . "/adodb/adodb.inc.php";
include_once $config["library_path"] . "/database.php";
include_once $config["library_path"] . "/functions.php";
include_once $config["include_path"] . "/global_constants.php";
include_once $config["library_path"] . "/plugins.php";
include_once $config["include_path"] . "/plugins.php";
include_once $config["include_path"] . "/global_arrays.php";
include_once $config["include_path"] . "/global_settings.php";
/* connect to the database server */
db_connect_real($database_hostname, $database_username, $database_password, $database_default, $database_type, $database_port, $database_ssl);
/* include additional modules */
include_once $config["include_path"] . "/global_form.php";
include_once $config["library_path"] . "/html.php";
include_once $config["library_path"] . "/html_form.php";
include_once $config["library_path"] . "/html_utility.php";
include_once $config["library_path"] . "/html_validate.php";
include_once $config["library_path"] . "/variables.php";
include_once $config["library_path"] . "/auth.php";
api_plugin_hook("config_insert");
/* current cacti version */
$config["cacti_version"] = "0.8.7i";
示例6: graphs
//.........这里部分代码省略.........
?>
>All</option>
<option value="-1"<?php
if ($_REQUEST["graph_type"] == "-1") {
?>
selected<?php
}
?>
>Graph Template Based</option>
<?php
$snmp_queries = db_fetch_assoc("SELECT\n\t\t\t\t\tsnmp_query.id,\n\t\t\t\t\tsnmp_query.name,\n\t\t\t\t\tsnmp_query.xml_path\n\t\t\t\t\tFROM (snmp_query,host_snmp_query)\n\t\t\t\t\tWHERE host_snmp_query.snmp_query_id=snmp_query.id\n\t\t\t\t\tAND host_snmp_query.host_id=" . $host["id"] . "\n\t\t\t\t\tORDER BY snmp_query.name");
if (sizeof($snmp_queries) > 0) {
foreach ($snmp_queries as $query) {
print "<option value='" . $query["id"] . "'";
if ($_REQUEST["graph_type"] == $query["id"]) {
print " selected";
}
print ">" . $query["name"] . "</option>\n";
}
}
?>
</select>
</td>
<td rowspan="2" class="textInfo" align="right" valign="top">
<span class="linkMarker">*</span><a href="<?php
print htmlspecialchars("host.php?action=edit&id=" . $_REQUEST["host_id"]);
?>
">Edit this Host</a><br>
<span class="linkMarker">*</span><a href="<?php
print htmlspecialchars("host.php?action=edit");
?>
">Create New Host</a><br>
<?php
api_plugin_hook('graphs_new_top_links');
?>
</td>
</tr>
<?php
if ($_REQUEST["graph_type"] > 0) {
?>
<tr>
<td width="55" valign='top'>
Search:
</td>
<td valign='top'>
<input type="text" name="filter" size="30" value="<?php
print htmlspecialchars(get_request_var_request("filter"));
?>
">
</td>
<td colspan='2' valign='top'>
<input type="submit" value="Go" title="Set/Refresh Filters">
<input type="submit" name="clear_x" value="Clear" title="Clear Filters">
</td>
</tr>
<?php
} else {
form_hidden_box("filter", $_REQUEST["filter"], "");
}
?>
</table>
</form>
</td>
</tr>
<?php
示例7: api_plugin_hook
| Cacti: The Complete RRDTool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
include './include/auth.php';
global $config;
api_plugin_hook('logout_pre_session_destroy');
/* Clear session */
setcookie(session_name(), '', time() - 3600, '/');
session_destroy();
$version = db_fetch_cell('SELECT cacti FROM version');
api_plugin_hook('logout_post_session_destroy');
/* Check to see if we are using Web Basic Auth */
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'timeout') {
print "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>\n";
print "<html>\n";
print "<head>\n";
print "\t<title>Logout of Cacti</title>\n";
print "\t<meta http-equiv='Content-Type' content='text/html;charset=utf-8'>\n";
print "\t<link href='" . $config['url_path'] . "include/themes/" . read_config_option('selected_theme') . "/main.css' type='text/css' rel='stylesheet'>\n";
print "\t<link href='" . $config['url_path'] . "include/themes/" . read_config_option('selected_theme') . "/jquery-ui.css' type='text/css' rel='stylesheet'>\n";
print "\t<link href='" . $config['url_path'] . "images/favicon.ico' rel='shortcut icon'>\n";
print "\t<script type='text/javascript' src='" . $config['url_path'] . "include/js/jquery.js' language='javascript'></script>\n";
print "\t<script type='text/javascript' src='" . $config['url_path'] . "include/js/jquery-ui.js' language='javascript'></script>\n";
print "\t<script type='text/javascript' src='" . $config['url_path'] . "include/js/jquery.cookie.js' language='javascript'></script>\n";
print "\t<script type='text/javascript' src='" . $config['url_path'] . "include/js/jquery.hotkeys.js'></script>\n";
print "\t<script type='text/javascript' src='" . $config['url_path'] . "include/layout.js'></script>\n";
示例8: draw_login_status
function draw_login_status($using_guest_account = false)
{
global $config;
$guest_account = db_fetch_cell_prepared('SELECT id FROM user_auth WHERE username = ?', array(read_config_option('guest_user')));
$auth_method = read_config_option('auth_method');
if (isset($_SESSION['sess_user_id']) && $_SESSION['sess_user_id'] == $guest_account) {
api_plugin_hook('nav_login_before');
print "Logged in as <span id='user' class='user usermenuup'>guest</span></div><div><ul class='menuoptions' style='display:none;'><li><a href='" . $config['url_path'] . "index.php'>Login as Regular User</a></li></ul>\n";
api_plugin_hook('nav_login_after');
print "</div>\n";
} elseif (isset($_SESSION['sess_user_id']) && $using_guest_account == false) {
api_plugin_hook('nav_login_before');
print "Logged in as <span id='user' class='user usermenuup'>" . db_fetch_cell_prepared('SELECT username FROM user_auth WHERE id = ?', array($_SESSION['sess_user_id'])) . "</span></div><div><ul class='menuoptions' style='display:none;'>" . (is_realm_allowed(20) ? "<li><a href='" . $config['url_path'] . "auth_profile.php?action=edit'>Edit Profile</a></li>" : "") . ($auth_method == 1 ? "<li><a href='" . $config['url_path'] . "auth_changepassword.php'>Change Password</a></li>" : '') . ($auth_method > 0 ? "<li><a href='" . $config['url_path'] . "logout.php'>Logout</a></li>" : "") . "</ul>\n";
api_plugin_hook('nav_login_after');
print "</div>\n";
}
}
示例9: api_plugin_hook_function
if (read_config_option("auth_method") == "3" || api_plugin_hook_function('login_realms_exist')) {
$realms = api_plugin_hook_function('login_realms', array("local" => array("name" => "Local", "selected" => false), "ldap" => array("name" => "LDAP", "selected" => true)));
?>
<tr id="realm_row">
<td>Realm:</td>
<td>
<select name="realm" style="width: 295px;"><?php
if (sizeof($realms)) {
foreach ($realms as $name => $realm) {
print "\t\t\t\t\t<option value='" . $name . "'" . ($realm["selected"] ? " selected" : "") . ">" . htmlspecialchars($realm["name"], ENT_QUOTES) . "</option>\n";
}
}
?>
</select>
</td>
</tr>
<?php
}
?>
<tr style="height:10px;"><td></td></tr>
<tr>
<td><input type="submit" value="Login"></td>
</tr>
</table>
<?php
api_plugin_hook('login_after');
?>
</form>
</body>
</html>
示例10: mikrotik_graph_area
function mikrotik_graph_area(&$graph_array, $no_graphs_message = "", $extra_url_args = "", $header = "", $columns = 2, $thumbnails = "true")
{
global $config;
if ($thumbnails == "true" || $thumbnails == "on") {
$th_option = "&graph_nolegend=true&graph_height=" . read_graph_config_option("default_height") . "&graph_width=" . read_graph_config_option("default_width");
} else {
$th_option = "";
}
$i = 0;
$k = 0;
if (sizeof($graph_array) > 0) {
if ($header != "") {
print $header;
}
print "<tr>";
foreach ($graph_array as $graph) {
?>
<td align='center' width='<?php
print 98 / $columns;
?>
%'>
<table width='1' cellpadding='0'>
<tr>
<td>
<a href='<?php
print htmlspecialchars($config['url_path'] . "graph.php?action=view&rra_id=all&local_graph_id=" . $graph["local_graph_id"]);
?>
'><img class='graphimage' id='graph_<?php
print $graph["local_graph_id"];
?>
' src='<?php
print $config['url_path'];
?>
graph_image.php?local_graph_id=<?php
print $graph["local_graph_id"] . "&rra_id=0" . $th_option . ($extra_url_args == "" ? "" : "&{$extra_url_args}");
?>
' border='0' alt='<?php
print $graph["title_cache"];
?>
'></a>
</td>
<td valign='top' style='padding: 3px;'>
<a href='<?php
print htmlspecialchars($config['url_path'] . "graph.php?action=zoom&local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&" . $extra_url_args);
?>
'><img src='<?php
print $config['url_path'];
?>
images/graph_zoom.gif' border='0' alt='Zoom Graph' title='Zoom Graph' style='padding: 3px;'></a><br>
<a href='<?php
print htmlspecialchars($config['url_path'] . "graph_xport.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=0&" . $extra_url_args);
?>
'><img src='<?php
print $config['url_path'];
?>
images/graph_query.png' border='0' alt='CSV Export' title='CSV Export' style='padding: 3px;'></a><br>
<a href='#page_top'><img src='<?php
print $config['url_path'];
?>
images/graph_page_top.gif' border='0' alt='Page Top' title='Page Top' style='padding: 3px;'></a><br>
<?php
api_plugin_hook('graph_buttons', array('hook' => 'thumbnails', 'local_graph_id' => $graph["local_graph_id"], 'rra' => 0, 'view_type' => ''));
?>
</td>
</tr>
</table>
</td>
<?php
$i++;
$k++;
if ($i == $columns && $k < count($graph_array)) {
$i = 0;
print "</tr><tr>";
}
}
print "</tr>";
} else {
if ($no_graphs_message != "") {
print "<td><em>{$no_graphs_message}</em></td>";
}
}
}
示例11: host_edit
function host_edit()
{
global $colors, $fields_host_edit, $reindex_types;
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
/* ==================================================== */
/* modify for multi user start */
if (!check_host($_GET["id"])) {
$_GET["id"] = "";
}
/* modify for multi user end */
api_plugin_hook('host_edit_top');
if (!empty($_GET["id"])) {
$host = db_fetch_row("select * from host where id=" . $_GET["id"]);
$header_label = "[edit: " . htmlspecialchars($host["description"]) . "]";
} else {
$header_label = "[new]";
}
if (!empty($host["id"])) {
?>
<table width="100%" align="center">
<tr>
<td class="textInfo" colspan="2">
<?php
print htmlspecialchars($host["description"]);
?>
(<?php
print htmlspecialchars($host["hostname"]);
?>
)
</td>
</tr>
<tr>
<td class="textHeader">
<?php
if ($host["availability_method"] == AVAIL_SNMP || $host["availability_method"] == AVAIL_SNMP_GET_NEXT || $host["availability_method"] == AVAIL_SNMP_GET_SYSDESC || $host["availability_method"] == AVAIL_SNMP_AND_PING || $host["availability_method"] == AVAIL_SNMP_OR_PING) {
?>
SNMP Information<br>
<span style="font-size: 10px; font-weight: normal; font-family: monospace;">
<?php
if ($host["snmp_community"] == "" && $host["snmp_username"] == "" || $host["snmp_version"] == 0) {
print "<span style='color: #ab3f1e; font-weight: bold;'>SNMP not in use</span>\n";
} else {
$snmp_system = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.1.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_auth_protocol"], $host["snmp_priv_passphrase"], $host["snmp_priv_protocol"], $host["snmp_context"], $host["snmp_port"], $host["snmp_timeout"], read_config_option("snmp_retries"), SNMP_WEBUI);
/* modify for some system descriptions */
/* 0000937: System output in host.php poor for Alcatel */
if (substr_count($snmp_system, "00:")) {
$snmp_system = str_replace("00:", "", $snmp_system);
$snmp_system = str_replace(":", " ", $snmp_system);
}
if ($snmp_system == "") {
print "<span style='color: #ff0000; font-weight: bold;'>SNMP error</span>\n";
} else {
$snmp_uptime = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.3.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_auth_protocol"], $host["snmp_priv_passphrase"], $host["snmp_priv_protocol"], $host["snmp_context"], $host["snmp_port"], $host["snmp_timeout"], read_config_option("snmp_retries"), SNMP_WEBUI);
$snmp_hostname = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.5.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_auth_protocol"], $host["snmp_priv_passphrase"], $host["snmp_priv_protocol"], $host["snmp_context"], $host["snmp_port"], $host["snmp_timeout"], read_config_option("snmp_retries"), SNMP_WEBUI);
$snmp_location = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.6.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_auth_protocol"], $host["snmp_priv_passphrase"], $host["snmp_priv_protocol"], $host["snmp_context"], $host["snmp_port"], $host["snmp_timeout"], read_config_option("snmp_retries"), SNMP_WEBUI);
$snmp_contact = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.4.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_auth_protocol"], $host["snmp_priv_passphrase"], $host["snmp_priv_protocol"], $host["snmp_context"], $host["snmp_port"], $host["snmp_timeout"], read_config_option("snmp_retries"), SNMP_WEBUI);
print "<strong>System:</strong>" . html_split_string($snmp_system) . "<br>\n";
$days = intval($snmp_uptime / (60 * 60 * 24 * 100));
$remainder = $snmp_uptime % (60 * 60 * 24 * 100);
$hours = intval($remainder / (60 * 60 * 100));
$remainder = $remainder % (60 * 60 * 100);
$minutes = intval($remainder / (60 * 100));
print "<strong>Uptime:</strong> {$snmp_uptime}";
print " ({$days} days, {$hours} hours, {$minutes} minutes)<br>\n";
print "<strong>Hostname:</strong> {$snmp_hostname}<br>\n";
print "<strong>Location:</strong> {$snmp_location}<br>\n";
print "<strong>Contact:</strong> {$snmp_contact}<br>\n";
}
}
?>
</span>
<?php
}
if ($host["availability_method"] == AVAIL_PING || $host["availability_method"] == AVAIL_SNMP_AND_PING || $host["availability_method"] == AVAIL_SNMP_OR_PING) {
/* create new ping socket for host pinging */
$ping = new Net_Ping();
$ping->host = $host;
$ping->port = $host["ping_port"];
/* perform the appropriate ping check of the host */
if ($ping->ping($host["availability_method"], $host["ping_method"], $host["ping_timeout"], $host["ping_retries"])) {
$host_down = false;
$color = "#000000";
} else {
$host_down = true;
$color = "#ff0000";
}
?>
<br>Ping Results<br>
<span style="font-size: 10px; font-weight: normal; color: <?php
print $color;
?>
; font-family: monospace;">
<?php
print $ping->ping_response;
?>
</span>
<?php
} else {
//.........这里部分代码省略.........
示例12: read_config_option
?>
include/jscalendar/calendar-setup.js'></script>
<script type='text/javascript' src='<?php
echo $config['url_path'];
?>
include/layout.js'></script>
<script type='text/javascript' src='<?php
echo $config['url_path'];
?>
include/themes/<?php
print read_config_option('selected_theme');
?>
/main.js'></script>
<?php
include $config['base_path'] . '/include/global_session.php';
api_plugin_hook('page_head');
?>
</head>
<?php
if ($oper_mode == OPER_MODE_NATIVE) {
?>
<body class='cactiConsoleBody' <?php
print api_plugin_hook_function('body_style', '');
?>
>
<?php
} else {
?>
<body class='cactiConsoleBody' <?php
print api_plugin_hook_function('body_style', '');
示例13: read_config_option
/* determine if you must output boost table now */
$max_records = read_config_option('boost_rrd_update_max_records');
$current_records = boost_get_total_rows();
if ($time_till_next_run <= 0 || $forcerun || $current_records >= $max_records || $next_run_time <= $current_time) {
db_execute("REPLACE INTO settings (name, value) VALUES ('boost_last_run_time', '" . date('Y-m-d G:i:s', $current_time) . "')");
/* output all the rrd data to the rrd files */
$rrd_updates = output_rrd_data($current_time, $forcerun);
if ($rrd_updates != '-1') {
log_boost_statistics($rrd_updates);
$next_run_time = $current_time + $seconds_offset;
} else {
/* rollback last run time */
db_execute("REPLACE INTO settings (name, value) VALUES ('boost_last_run_time', '" . date('Y-m-d G:i:s', $last_run_time) . "')");
}
dsstats_boost_bottom();
api_plugin_hook('boost_poller_bottom');
}
/* store the next run time so that people understand */
db_execute("REPLACE INTO settings (name, value) VALUES ('boost_next_run_time', '" . date('Y-m-d G:i:s', $next_run_time) . "')");
} else {
/* turn off the system level updates */
if (read_config_option('boost_rrd_update_system_enable') == 'on') {
db_execute("REPLACE INTO settings (name,value)\n\t\t\tVALUES ('boost_rrd_update_system_enable','')");
}
$rows = boost_get_total_rows();
if ($rows > 0) {
/* determine the time to clear the table */
$current_time = time();
/* output all the rrd data to the rrd files */
$rrd_updates = output_rrd_data($current_time, $forcerun);
if ($rrd_updates != '-1') {
示例14: syslog_sendemail
if ($found) {
$resend = false;
}
}
if ($resend) {
syslog_sendemail(trim($alert['email']), '', 'Event Alert - ' . $alert['name'], $html ? $htmlm : $alertm, $smsalert);
if ($alert['open_ticket'] == 'on' && strlen(read_config_option('syslog_ticket_command'))) {
if (is_executable(read_config_option('syslog_ticket_command'))) {
exec(read_config_option('syslog_ticket_command') . " --alert-name='" . clean_up_name($alert['name']) . "'" . " --severity='" . $alert['severity'] . "'" . " --hostlist='" . implode(',', $hostlist) . "'" . " --message='" . $alert['message'] . "'");
}
}
}
}
}
}
api_plugin_hook('plugin_syslog_after_processing');
/* move syslog records to the syslog table */
syslog_db_execute('INSERT INTO `' . $syslogdb_default . '`.`syslog` (logtime, priority_id, facility_id, program_id, host_id, message)
SELECT TIMESTAMP(`' . $syslog_incoming_config['dateField'] . '`, `' . $syslog_incoming_config['timeField'] . '`),
priority_id, facility_id, program_id, host_id, message
FROM (SELECT date, time, priority_id, facility_id, program_id, host_id, message
FROM syslog_incoming AS si
INNER JOIN syslog_hosts AS sh
ON sh.host=si.host
INNER JOIN syslog_programs AS sp
ON sp.program=si.program
WHERE status=' . $uniqueID . ') AS merge');
$moved = db_affected_rows($syslog_cnn);
syslog_debug('Moved ' . $moved . ", Message(s) to the 'syslog' table");
/* remove flagged messages */
syslog_db_execute('DELETE FROM `' . $syslogdb_default . '`.`syslog_incoming` WHERE status=' . $uniqueID);
示例15: if
<?php if (isset($refresh)) { print "\t<meta http-equiv=refresh content=\"" . $refresh["seconds"] . "; url='" . $refresh["page"] . "'\">\n"; }
initializeCookieVariable();
api_plugin_hook('page_head');
?>
</head>
<body id='body'>
<script type="text/javascript" src="<?php echo CACTI_URL_PATH; ?>include/js/wztooltip/wz_tooltip.js"></script>
<div id='header'>
<div id='logobar' class='logobar'></div>
<div id='navbar' class='navbar'>
<div id='navbar_l'>
<ul>
<?php echo draw_header_tab("console", __("Console"), CACTI_URL_PATH . "index.php");?>
<?php echo draw_header_tab("graphs", __("Graphs"), CACTI_URL_PATH . "graph_view.php");?>
<?php api_plugin_hook('top_header_tabs'); ?>
</ul>
</div>
</div>
<div id='navbrcrumb'>
<div style='float:left;'>
<?php print draw_navigation_text() . "\n";?>
</div>
<div style='float:right;'>
<a href="<?php echo cacti_wiki_url();?>" target="_blank">
<img src="<?php echo CACTI_URL_PATH; ?>images/help.gif" title="<?php print __("Help");?>" alt="<?php print __("Help");?>" align="top">
</a>
</div>
<div style='float:right'>
<?php if (read_config_option("auth_method") != 0) {
if(read_config_option('i18n_timezone_support') != 0) {