示例#1
0
function _device_field__poller_id($field_name, $field_value = "", $field_id = 0) {
	require_once(CACTI_BASE_PATH . "/lib/sys/html_form.php");
	require_once(CACTI_BASE_PATH . "/lib/poller/poller_info.php");

	?>
	<tr class="field alt">
		<td width="50%">
			<span class="title"><?php echo _("Default Poller");?></span><br>
			<?php echo _("Choose the default poller to handle this hosts request.");?>
		</td>
		<td colspan="2">
			<?php form_dropdown($field_name, array_rekey(api_poller_list(), "id", "name"), "", "", $field_value, "", "");?>
		</td>
	</tr>
	<?php
}
示例#2
0
function pollers() {
	$current_page = get_get_var_number("page", "1");

	global $colors, $poller_actions, $input_types;

	$menu_items = array(
		"enable" => _("Enable"),
		"disable" => _("Disable"),
		"delete" => _("Delete")
		);

	$filter_array = array();

	/* search field: filter (searches device description and hostname) */
	if (isset_get_var("search_filter")) {
		$filter_array["filter"] = array("name" => get_get_var("search_filter"), "hostname" => get_get_var("search_filter"));
	}

	/* clean up sort_column string */
	if (isset_get_var("sort_column")) {
		$filter_array["sort_column"] = get_get_var("sort_column");
	}else{
		$filter_array["sort_column"] = "name";
	}

	/* clean up sort_direction string */
	if (isset_get_var("sort_direction")) {
		$filter_array["sort_direction"] = get_get_var("sort_direction");
	}else{
		$filter_array["sort_direction"] = "ASC";
	}

	/* get a list of all devices on this page */
	$pollers = api_poller_list($filter_array, $current_page, read_config_option("num_rows_device"));

	/* get the total number of devices on all pages */
	$total_rows = api_poller_total_get($filter_array);

	/* generate page list */
	$url_string = build_get_url_string(array("search_filter"));
	$url_page_select = get_page_list($current_page, MAX_DISPLAY_PAGES, read_config_option("num_rows_device"), $total_rows, "pollers.php" . $url_string . ($url_string == "" ? "?" : "&") . "page=|PAGE_NUM|");

	form_start("pollers.php");

	$box_id = "1";
	html_start_box("<strong>" . _("Pollers") . "</strong>", "pollers.php?action=edit", $url_page_select);

	$display_text = array(
		"name"        => array(_("Name"),          "ASC"),
		"hostname"    => array(_("Hostname"),      "ASC"),
		"run_state"   => array(_("Status"),        "ASC"),
		"cur_time"    => array(_("Last Time"),     "DESC"),
		"min_time"    => array(_("Min Time"),      "DESC"),
		"max_time"    => array(_("Max Time"),      "DESC"),
		"avg_time"    => array(_("Avg Time"),      "DESC"),
		"active"      => array(_("Enabled"),       "ASC"),
		"last_update" => array(_("Last Run Date"), "ASC"));

	html_header_sort_checkbox($display_text, $filter_array["sort_column"], $filter_array["sort_direction"], $box_id);

	$i = 0;

	if (sizeof($pollers) > 0) {
	foreach ($pollers as $poller) {
		?>
		<tr class="item" id="box-<?php echo $box_id;?>-row-<?php echo $poller["poller_id"];?>" onClick="display_row_select('<?php echo $box_id;?>',document.forms[0],'box-<?php echo $box_id;?>-row-<?php echo $poller["poller_id"];?>', 'box-<?php echo $box_id;?>-chk-<?php echo $poller["poller_id"];?>')" onMouseOver="display_row_hover('box-<?php echo $box_id;?>-row-<?php echo $poller["poller_id"];?>')" onMouseOut="display_row_clear('box-<?php echo $box_id;?>-row-<?php echo $poller["poller_id"];?>')">
			<td class="title">
				<a href="pollers.php?action=edit&poller_id=<?php print $poller["id"];?>"><?php print $poller["name"];?></a>
			</td>
			<td>
				<?php echo $poller["hostname"];?>
			</td>
			<td>
				<?php echo $poller["run_state"];?>
			</td>
			<td>
				<?php echo $poller["cur_time"];?>
			</td>
			<td>
				<?php echo $poller["min_time"];?>
			</td>
			<td>
				<?php echo $poller["max_time"];?>
			</td>
			<td>
				<?php echo $poller["avg_time"];?>
			</td>
			<td>
				<?php echo ($poller["active"] == "on" ? _("Yes") : _("No"));?>
			</td>
			<td>
				<?php echo $poller["last_update"];?>
			</td>
			<td class="checkbox" align="center">
				<input type='checkbox' name='box-<?php echo $box_id;?>-chk-<?php echo $poller["poller_id"];?>' id='box-<?php echo $box_id;?>-chk-<?php echo $poller["poller_id"];?>' title="<?php echo $poller["name"];?>">
			</td>
		</tr>
		<?php
	}
	}else{
		?>
		<tr class="empty">
			<td colspan="6">
				<?php echo _("No Pollers Found.");?>
			</td>
		</tr>
		<?php
	}

	html_box_toolbar_draw($box_id, "0", "9", (sizeof($filter_array) == 0 ? HTML_BOX_SEARCH_INACTIVE : HTML_BOX_SEARCH_ACTIVE), $url_page_select);
	html_end_box(false);

	html_box_actions_menu_draw($box_id, "0", $menu_items);
	html_box_actions_area_create($box_id);

	form_hidden_box("action_post", "poller_list");
	form_end();
}