mirror of
https://github.com/Cacti/plugin_monitor.git
synced 2026-10-23 03:26:42 +09:00
Fix #183 - Ordering and Limits
* This feature provides a common interface when looking at the list view
This commit is contained in:
1 parent
c15e6bbdb9
commit
6e97b30f21
2 files changed
+191
-210
No files matched your search
+16
-155
@@ -3,354 +3,215 @@
|
||||
--- develop ---
|
||||
|
||||
* issue#182: Color coding monitor page list view
|
||||
* feature#183: Add Ordering and Row Counters to List View
|
||||
|
||||
--- 2.7 ---
|
||||
|
||||
* issue#161: Reboot warnings triggered at the wrong time.
|
||||
|
||||
* issue#162: Table name is wrong ALTER TABLE plugin_monitor_update should be ALTER TABLE plugin_monitor_uptime
|
||||
|
||||
* issue#163: Fix some PHP Deprecation warnings
|
||||
|
||||
* issue#166: typo in monitor.php function render_where_join line 1233 render_group_concat($ahwere, ' AND ', 'h.id', $hlist);
|
||||
|
||||
* issue#171: monitor plugin crashes with Uncaught TypeError
|
||||
|
||||
* issue#173: small visual bug in tree view
|
||||
|
||||
* issue#174: Fix css position
|
||||
|
||||
* issue#175: Issue with mute function
|
||||
|
||||
* issue: Remove deprecated each() call in setup.php
|
||||
|
||||
--- 2.6 ---
|
||||
|
||||
* issue#122: Cacti Device Reboot Notification - don't include hosts with no monitor device set
|
||||
|
||||
* issue#128: SQL errors happen during Autom8 runs Monitor 2.3.6
|
||||
|
||||
* issue#139: WEBUI WARNING: Attempt to use GET method for POST operations
|
||||
|
||||
* issue#142: Monitor generates PHP Backtrace Errors
|
||||
|
||||
* issue#143: Limit device view based on User Permission Settings
|
||||
|
||||
* issue#147: Monitor Tab odering issue
|
||||
|
||||
* issue#148: Monitor Plugin Last fail data always update to ~1970 for hosts that have never been down.
|
||||
|
||||
* issue#157: Monitor plugin error message in cacti log
|
||||
|
||||
* issue: Monitor continues to throw errors about monitor column being null
|
||||
|
||||
* feature#90: Context menu for device options
|
||||
|
||||
* feature#115: Location in UI in default view
|
||||
|
||||
* feature#127: Limit the amount of devices shown
|
||||
|
||||
* feature#167: Add device icons
|
||||
|
||||
|
||||
--- 2.5 ---
|
||||
|
||||
* issue#140: Spelling Error in Reboot Email Subject
|
||||
|
||||
* issue: Unset variable warnings causing emails to be sent to Cacti admin
|
||||
|
||||
|
||||
--- 2.4 ---
|
||||
|
||||
* issue#100: Long names in devices in monitor.php in (title view)
|
||||
|
||||
* issue#102: Doubled footer in monitor page (tile view)
|
||||
|
||||
* issue#104: Broken responsive design
|
||||
|
||||
* issue#105: Host description contains multibyte character set may cause the
|
||||
garbled text
|
||||
|
||||
* issue#105: Host description contains multibyte character set may cause the garbled text
|
||||
* issue#109: Reboot history being removed incorrectly for removed devices
|
||||
|
||||
* issue#114: Monitor legend can not expand to a single line
|
||||
|
||||
* issue#123: When sending emails, monitor reports config variable not found
|
||||
|
||||
* issue#124: SQL Errors when removing hosts that no longer exist
|
||||
|
||||
* issue#125: Notification history is not being updated
|
||||
|
||||
* issue: Add more checks for removed Device conditions
|
||||
|
||||
* issue: Dont attempt to send an device down email if there is none set for a
|
||||
device
|
||||
|
||||
* issue: Dont attempt to send an device down email if there is none set for a device
|
||||
* issue: When remote pollers are enabled, monitor can remove all your devices
|
||||
|
||||
* feature: PHP 7.2 compatibility
|
||||
|
||||
* feature#134: Added option to Loop the alarm sound
|
||||
|
||||
|
||||
--- 2.3.5 ---
|
||||
|
||||
* issue#48: Reboot notifications did not properly use Monitor sender settings
|
||||
|
||||
* issue#66: Correct missing variable warnings when sending emails
|
||||
|
||||
* issue#71: Only one tile being displayed per row being displayed #71
|
||||
|
||||
* issue#72: Internet Explorer fails to apply filters
|
||||
|
||||
* issue#76: Monitor attempts to get status for non-server elements
|
||||
|
||||
* issue#77: Device status information in popup window may contains quotes
|
||||
|
||||
* issue#78: Arranging hosts by Device Template is not working
|
||||
|
||||
* issue#89: When there are no group level items, SQL filters can become badly
|
||||
formatted
|
||||
|
||||
* issue#94: When grouping by tree, Devices added to the root of a tree appear on
|
||||
every tree
|
||||
|
||||
* issue#89: When there are no group level items, SQL filters can become badly formatted
|
||||
* issue#94: When grouping by tree, Devices added to the root of a tree appear on every tree
|
||||
* issue#95: When grouping by site, devices with no site never appear
|
||||
|
||||
* feature: Support for Cacti 1.2
|
||||
|
||||
* feature: Align Status with Thold Status
|
||||
|
||||
* feature: Implement Cacti Responsive Filter for Mobile
|
||||
|
||||
* feature: Allow Alert sounds on Threshold Breach or Triggers
|
||||
|
||||
* feature: Support text based email generation
|
||||
|
||||
|
||||
--- 2.3.4 ---
|
||||
|
||||
* issue#61: Fixed issue where monitor_list was not being used
|
||||
|
||||
* issue#64: Fixed issue with overlapping rows in tree view
|
||||
|
||||
* feature: Added option to disable inclusion of Threshold alert lists
|
||||
|
||||
|
||||
--- 2.3.3 ---
|
||||
|
||||
* issue#57: Fixed issue with mute not working
|
||||
|
||||
* issue#60: Fixed issue with themes
|
||||
|
||||
* issue: Fixed issue with audio constantly playing
|
||||
|
||||
* issue: Fixed issue with audio attempting to play files that do not exist
|
||||
|
||||
|
||||
--- 2.3.2 ---
|
||||
|
||||
* feature: Allow "from" email address/name to be set
|
||||
|
||||
* feature: Requires a minimum of Cacti 1.1.36
|
||||
|
||||
|
||||
--- 2.3.1 ---
|
||||
|
||||
* issue: fixed issue where criticalities was not being correctly referenced
|
||||
|
||||
|
||||
--- 2.3 ---
|
||||
|
||||
* feature: improved header/filter layout for more consistent view
|
||||
|
||||
* feature: Added List View mode * issue: fixed issue where hosts where not
|
||||
always evaluated properly in render_perms()
|
||||
|
||||
* feature: Added List View mode * issue: fixed issue where hosts where not always evaluated properly in render_perms()
|
||||
|
||||
--- 2.2 ---
|
||||
|
||||
* issue#23: Notify admins on a system reboot detection
|
||||
|
||||
* issue#31: Tree rendering not functioning as expected
|
||||
|
||||
* issue#43: Modified plugin_monitor reporting and updating behavior when cacti
|
||||
host table indicates device uptime values of 0
|
||||
|
||||
* issue#43: Modified plugin_monitor reporting and updating behavior when cacti host table indicates device uptime values of 0
|
||||
* issue: Properly handle text domain for internationalization
|
||||
|
||||
* issue: List of plugin_monitors, sound files, in setup, is now sorted
|
||||
|
||||
* feature: Update Spanish Translation
|
||||
|
||||
|
||||
--- 2.1 ---
|
||||
|
||||
* issue#26: Monitor is not showing triggered colors
|
||||
|
||||
* issue#27: Time in State not reported correctly in some instances
|
||||
|
||||
* issue: Correct several smaller visual issues with monitor
|
||||
|
||||
* feature: Convert Monitor to use CSS for skin developers
|
||||
|
||||
|
||||
--- 2.0 ---
|
||||
|
||||
* feature: Support for Cacti 1.0
|
||||
|
||||
* feature: Complete redesign using font awesome
|
||||
|
||||
* feature: Allow specification of device criticality
|
||||
|
||||
* feature: Allow specification of warning and alert ping round trip latency
|
||||
number
|
||||
|
||||
* feature: Allow specification of warning and alert ping round trip latency number
|
||||
* feature: All GUI interactions using ajax
|
||||
|
||||
* feature: Specification of settings using filter
|
||||
|
||||
* feature: Save user based settings
|
||||
|
||||
* feature: Using new Cacti permissions system
|
||||
|
||||
* feature: Generalized code cleanup
|
||||
|
||||
* feature: Integrate better with Thold and Syslog
|
||||
|
||||
|
||||
--- 1.3 ---
|
||||
|
||||
* compat: Fix general header
|
||||
|
||||
|
||||
--- 1.2 ---
|
||||
|
||||
* issue#0001654: a little update for monitor plugin
|
||||
|
||||
* issue: Correct some undefined offset errors
|
||||
|
||||
|
||||
--- 1.1 ---
|
||||
|
||||
* compat: Allow proper navigation text generation
|
||||
|
||||
* issue: User would see console as a pick even if they were guest
|
||||
|
||||
* issue: Mute button does not work properly
|
||||
|
||||
* issue: Text fields in MySQL can not include a default
|
||||
|
||||
|
||||
--- 1.0 ---
|
||||
|
||||
* feature: Add Grouping by Host Template
|
||||
|
||||
* feature: Adding 0.8.7f features
|
||||
|
||||
|
||||
--- 0.9 ---
|
||||
|
||||
* compat: Monitor is now only PA 2.0 compatible
|
||||
|
||||
* issue: Fix for mass enabling / disabling monitoring of hosts
|
||||
|
||||
|
||||
--- 0.8.2 ---
|
||||
|
||||
* feature: Change from JS Status popup to pure CSS
|
||||
|
||||
* feature: Remove "Details" view
|
||||
|
||||
|
||||
--- 0.8.1 ---
|
||||
|
||||
* feature: Fix compatibility issue between monitor and thold v0.3.6
|
||||
|
||||
|
||||
--- 0.8 ---
|
||||
|
||||
* issue: Add fix for not showing disabled thresholds
|
||||
|
||||
* issue: Lots of code cleanup
|
||||
|
||||
* issue: Fix Cacti 0.8.7 compatibility
|
||||
|
||||
* feature: Add a muted icon to show what hosts are currently muted
|
||||
|
||||
* feature: Only show hosts that have had at least 2 pollings. This stops it
|
||||
from alerting on new hosts that havent been properly polled yet.
|
||||
|
||||
* feature: Only show hosts that have had at least 2 pollings. This stops it from alerting on new hosts that havent been properly polled yet.
|
||||
* feature: All the selecting of "None" as a sound to not have it play an alert
|
||||
|
||||
* feature: Move from using cookies to using session variables
|
||||
|
||||
* feature: Allow the display of a Host Down Message
|
||||
|
||||
* feature: Add a patch by fri that allows grouping by tree / header and does
|
||||
user auth checking
|
||||
|
||||
* feature: Add a patch by fri that allows grouping by tree / header and does user auth checking
|
||||
* feature: Use new "api_user_realm_auth" from Plugin Architecture
|
||||
|
||||
* feature: Display host down time under the hostname
|
||||
|
||||
|
||||
--- 0.7 ---
|
||||
|
||||
* issue#0000044 - Modify device image to link to devices graphs
|
||||
|
||||
* issue#0000052 - If the Threshold plugin is running, change the host color to
|
||||
Orange if a threshold is breached
|
||||
|
||||
* issue#0000052 - If the Threshold plugin is running, change the host color to Orange if a threshold is breached
|
||||
* issue: Fixes to the fast poller
|
||||
|
||||
* feature: Add option to select an different alarm sound from the available wav
|
||||
and mp3 files in the sounds directory
|
||||
|
||||
* feature: Add option to select an different alarm sound from the available wav and mp3 files in the sounds directory
|
||||
* feature: Update tab image to better resemble the original cacti images
|
||||
|
||||
* feature: Add option to add an icon legend to the Monitor display
|
||||
|
||||
* feature: Moved sounds to their own folder
|
||||
|
||||
|
||||
--- 0.6 ---
|
||||
|
||||
* issue#0000013 - Fix issues with database names with uncommon characters by
|
||||
enclosing in back-ticks
|
||||
|
||||
* issue#0000013 - Fix issues with database names with uncommon characters by enclosing in back-ticks
|
||||
* feature: Allow guest access to the Monitor Tab
|
||||
|
||||
|
||||
--- 0.5 ---
|
||||
|
||||
* issue: Fixed an issue with the mute button action url (thanks Tut!)
|
||||
|
||||
* issue: Fixed an issue with the monitor page and includes
|
||||
|
||||
* issue: Fixed an issue with the Fast Poller paths
|
||||
|
||||
|
||||
--- 0.4 ---
|
||||
|
||||
* feature: Added Javscript Mouseover Tooltips. This replaces the title
|
||||
attribute which I used before (Newlines didnt work in Firefox)
|
||||
|
||||
* feature: Added Javscript Mouseover Tooltips. This replaces the title attribute which I used before (Newlines didnt work in Firefox)
|
||||
|
||||
--- 0.3 ---
|
||||
|
||||
* feature: Added Settings for Refresh Rate and Width of Hosts See Settings >>
|
||||
Misc
|
||||
|
||||
* feature: Added Faster Poller so that you can know immediately if something is
|
||||
down
|
||||
|
||||
* feature: Added Settings for Refresh Rate and Width of Hosts See Settings > Misc
|
||||
* feature: Added Faster Poller so that you can know immediately if something is down
|
||||
|
||||
--- 0.2 ---
|
||||
|
||||
* issue: Fix for navigational line
|
||||
|
||||
|
||||
--- 0.1 ---
|
||||
|
||||
* Initial release
|
||||
|
||||
+175
-55
@@ -442,7 +442,7 @@ function draw_filter_and_status() {
|
||||
global $criticalities, $page_refresh_interval, $classes, $monitor_grouping;
|
||||
global $monitor_view_type, $monitor_status, $monitor_trim;
|
||||
global $dozoombgndcolor, $dozoomrefresh, $zoom_hist_status, $zoom_hist_size, $mon_zoom_state;
|
||||
global $new_form, $new_title;
|
||||
global $new_form, $new_title, $item_rows;
|
||||
|
||||
$header = __('Monitor Filter [ Last Refresh: %s ]', date('g:i:s a', time()), 'monitor') . (get_request_var('refresh') < 99999 ? __(' [ Refresh Again in <i style="padding:0px !important;margin:0px;" id="timer">%d</i> Seconds ]', get_request_var('refresh'), 'monitor') : '') . (get_request_var('view') == 'list' ? __('[ Showing only first 30 Devices ]', 'monitor'):'') . '<span id="text" style="vertical-align:baseline;padding:0px !important;display:none"></span>';
|
||||
|
||||
@@ -503,12 +503,15 @@ function draw_filter_and_status() {
|
||||
draw_filter_dropdown('status', __('Status', 'monitor'), $monitor_status, $mon_zoom_status);
|
||||
draw_filter_dropdown('view', __('View', 'monitor'), $monitor_view_type);
|
||||
draw_filter_dropdown('grouping', __('Grouping', 'monitor'), $monitor_grouping);
|
||||
draw_filter_dropdown('rows', __('Devices', 'monitor'), $item_rows);
|
||||
|
||||
// Buttons
|
||||
print '<td><span>' . PHP_EOL;
|
||||
|
||||
print '<input type="submit" value="' . __esc('Refresh', 'monitor') . '" id="go" title="' . __esc('Refresh the Device List', 'monitor') . '">' . PHP_EOL;
|
||||
|
||||
print '<input type="button" value="' . __esc('Clear', 'monitor') . '" id="clear" title="' . __esc('Clear the set filter', 'monitor') . '">' . PHP_EOL;
|
||||
|
||||
print '<input type="button" value="' . __esc('Save', 'monitor') . '" id="save" title="' . __esc('Save Filter Settings', 'monitor') . '">' . PHP_EOL;
|
||||
|
||||
print '<input type="button" value="' . __esc('New', 'monitor') . '" id="new" title="' . __esc('Save New Dashboard', 'monitor') . '">' . PHP_EOL;
|
||||
@@ -741,6 +744,7 @@ function draw_filter_and_status() {
|
||||
strURL += '&site=' + $('#site').val();
|
||||
strURL += '&template=' + $('#template').val();
|
||||
strURL += '&view=' + $('#view').val();
|
||||
strURL += '&rows=' + $('#rows').val();
|
||||
strURL += '&crit=' + $('#crit').val();
|
||||
strURL += '&size=' + $('#size').val();
|
||||
strURL += '&trim=' + $('#trim').val();
|
||||
@@ -766,6 +770,7 @@ function draw_filter_and_status() {
|
||||
site: $('#site').val(),
|
||||
template: $('#template').val(),
|
||||
view: $('#view').val(),
|
||||
rows: $('#rows').val(),
|
||||
crit: $('#crit').val(),
|
||||
rfilter: base64_encode($('#rfilter').val()),
|
||||
trim: $('#trim').val(),
|
||||
@@ -797,6 +802,7 @@ function draw_filter_and_status() {
|
||||
'&site=' + $('#site').val() +
|
||||
'&template=' + $('#template').val() +
|
||||
'&view=' + $('#view').val() +
|
||||
'&rows=' + $('#rows').val() +
|
||||
'&crit=' + $('#crit').val() +
|
||||
'&rfilter=' + base64_encode($('#rfilter').val()) +
|
||||
'&trim=' + $('#trim').val() +
|
||||
@@ -848,6 +854,20 @@ function draw_filter_and_status() {
|
||||
applyFilter('refresh');
|
||||
}
|
||||
|
||||
var selectmenu = ($('#grouping').selectmenu('instance') !== undefined);
|
||||
|
||||
if ($('#view').val() == 'list') {
|
||||
$('#grouping').prop('disabled', true);
|
||||
if (selectmenu) {
|
||||
$('#grouping').selectmenu('disable');
|
||||
}
|
||||
} else {
|
||||
$('#grouping').prop('disabled', false);
|
||||
if (selectmenu) {
|
||||
$('#grouping').selectmenu('enable');
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the timeout to keep countdown accurate
|
||||
clearTimeout(myTimer);
|
||||
|
||||
@@ -856,6 +876,10 @@ function draw_filter_and_status() {
|
||||
applyFilter('go');
|
||||
});
|
||||
|
||||
$('#clear').click(function(event) {
|
||||
loadPageNoHeader('monitor.php?clear=1&header=false');
|
||||
});
|
||||
|
||||
$('#sound').click(function() {
|
||||
if ($('#mute').val() == 'false') {
|
||||
$('#mute').val('true');
|
||||
@@ -868,7 +892,7 @@ function draw_filter_and_status() {
|
||||
}
|
||||
});
|
||||
|
||||
$('#refresh, #view, #trim, #crit, #grouping, #size, #status, #tree, #site, #template').change(function() {
|
||||
$('#refresh, #view, #rows, #trim, #crit, #grouping, #size, #status, #tree, #site, #template').change(function() {
|
||||
applyFilter('change');
|
||||
});
|
||||
|
||||
@@ -1024,6 +1048,9 @@ function save_settings() {
|
||||
case 'view':
|
||||
set_user_setting('monitor_view', get_request_var('view'));
|
||||
break;
|
||||
case 'rows':
|
||||
set_user_setting('monitor_view', get_request_var('rows'));
|
||||
break;
|
||||
case 'crit':
|
||||
set_user_setting('monitor_crit', get_request_var('crit'));
|
||||
break;
|
||||
@@ -1056,6 +1083,7 @@ function save_settings() {
|
||||
'?refresh=' . get_request_var('refresh') .
|
||||
'&grouping=' . get_request_var('grouping') .
|
||||
'&view=' . get_request_var('view') .
|
||||
'&rows=' . get_request_var('rows') .
|
||||
'&crit=' . get_request_var('crit') .
|
||||
'&size=' . get_request_var('size') .
|
||||
'&trim=' . get_request_var('trim') .
|
||||
@@ -1101,10 +1129,12 @@ function validate_request_vars($force = false) {
|
||||
),
|
||||
'dashboard' => array(
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'pageset' => true,
|
||||
'default' => read_user_setting('monitor_dashboard', '0', $force)
|
||||
),
|
||||
'rfilter' => array(
|
||||
'filter' => FILTER_VALIDATE_IS_REGEX,
|
||||
'pageset' => true,
|
||||
'default' => read_user_setting('monitor_rfilter', '', $force)
|
||||
),
|
||||
'name' => array(
|
||||
@@ -1120,13 +1150,20 @@ function validate_request_vars($force = false) {
|
||||
'grouping' => array(
|
||||
'filter' => FILTER_CALLBACK,
|
||||
'options' => array('options' => 'sanitize_search_string'),
|
||||
'pageset' => true,
|
||||
'default' => read_user_setting('monitor_grouping', read_config_option('monitor_grouping'), $force)
|
||||
),
|
||||
'view' => array(
|
||||
'filter' => FILTER_CALLBACK,
|
||||
'options' => array('options' => 'sanitize_search_string'),
|
||||
'pageset' => true,
|
||||
'default' => read_user_setting('monitor_view', read_config_option('monitor_view'), $force)
|
||||
),
|
||||
'rows' => array(
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'options' => array('options' => 'sanitize_search_string'),
|
||||
'default' => read_user_setting('monitor_view', read_config_option('monitor_rows'), $force)
|
||||
),
|
||||
'size' => array(
|
||||
'filter' => FILTER_CALLBACK,
|
||||
'options' => array('options' => 'sanitize_search_string'),
|
||||
@@ -1138,33 +1175,33 @@ function validate_request_vars($force = false) {
|
||||
),
|
||||
'crit' => array(
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'pageset' => true,
|
||||
'default' => read_user_setting('monitor_crit', '-1', $force)
|
||||
),
|
||||
'status' => array(
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'pageset' => true,
|
||||
'default' => read_user_setting('monitor_status', '-1', $force)
|
||||
),
|
||||
'tree' => array(
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'pageset' => true,
|
||||
'default' => read_user_setting('monitor_tree', '-1', $force)
|
||||
),
|
||||
'site' => array(
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'pageset' => true,
|
||||
'default' => read_user_setting('monitor_site', '-1', $force)
|
||||
),
|
||||
'template' => array(
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'pageset' => true,
|
||||
'default' => read_user_setting('monitor_template', '-1', $force)
|
||||
),
|
||||
'id' => array(
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'default' => '-1'
|
||||
),
|
||||
'rows' => array(
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'pageset' => true,
|
||||
'default' => '-1'
|
||||
),
|
||||
'page' => array(
|
||||
'filter' => FILTER_VALIDATE_INT,
|
||||
'default' => '1'
|
||||
@@ -1286,19 +1323,51 @@ function render_default() {
|
||||
|
||||
$sql_where = '';
|
||||
$sql_join = '';
|
||||
$sql_limit = '';
|
||||
$sql_order = 'ORDER BY description';
|
||||
|
||||
if (get_request_var('rows') == '-1') {
|
||||
$rows = read_config_option('num_rows_table');
|
||||
} elseif (get_request_var('rows') == 'default') {
|
||||
$rows = read_config_option('num_rows_table');
|
||||
} else {
|
||||
$rows = get_request_var('rows');
|
||||
}
|
||||
|
||||
if (get_request_var('view') == 'list') {
|
||||
$sql_order = get_order_string();
|
||||
}
|
||||
|
||||
render_where_join($sql_where, $sql_join);
|
||||
|
||||
$hosts_sql = ("SELECT DISTINCT h.*, IFNULL(s.name,' " . __('Non-Site Device', 'monitor') . " ') AS site_name
|
||||
$poller_interval = read_config_option('poller_interval');
|
||||
|
||||
$sql_limit = ' LIMIT ' . ($rows*(get_request_var('page')-1)) . ',' . $rows;
|
||||
|
||||
$hosts_sql = ("SELECT DISTINCT h.*, IFNULL(s.name,' " . __('Non-Site Device', 'monitor') . " ') AS site_name,
|
||||
CAST(IF(availability_method = 0, '0',
|
||||
IF(status_event_count > 0 AND status IN (1, 2), status_event_count*$poller_interval,
|
||||
IF(UNIX_TIMESTAMP(status_rec_date) < 943916400 AND status IN (0, 3), total_polls*$poller_interval,
|
||||
IF(UNIX_TIMESTAMP(status_rec_date) > 943916400, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(status_rec_date),
|
||||
IF(snmp_sysUptimeInstance>0 AND snmp_version > 0, snmp_sysUptimeInstance/100, UNIX_TIMESTAMP()
|
||||
))))) AS unsigned) AS instate
|
||||
FROM host AS h
|
||||
LEFT JOIN sites AS s
|
||||
ON h.site_id = s.id
|
||||
$sql_join
|
||||
$sql_where
|
||||
ORDER BY description");
|
||||
$sql_order
|
||||
$sql_limit");
|
||||
|
||||
$hosts = db_fetch_assoc($hosts_sql);
|
||||
|
||||
$total_rows = db_fetch_cell("SELECT COUNT(DISTINCT h.id)
|
||||
FROM host AS h
|
||||
LEFT JOIN sites AS s
|
||||
ON h.site_id = s.id
|
||||
$sql_join
|
||||
$sql_where");
|
||||
|
||||
if (cacti_sizeof($hosts)) {
|
||||
// Determine the correct width of the cell
|
||||
$maxlen = 10;
|
||||
@@ -1314,7 +1383,7 @@ function render_default() {
|
||||
$function = 'render_header_' . get_request_var('view');
|
||||
if (function_exists($function)) {
|
||||
/* Call the custom render_header_ function */
|
||||
$result .= $function($hosts);
|
||||
$result .= $function($hosts, $total_rows, $rows);
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
@@ -1324,17 +1393,13 @@ function render_default() {
|
||||
$result .= render_host($host, true, $maxlen);
|
||||
}
|
||||
|
||||
if (get_request_var('view') == 'list' && $count > 30) {
|
||||
break;
|
||||
}
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
$function = 'render_footer_' . get_request_var('view');
|
||||
if (function_exists($function)) {
|
||||
/* Call the custom render_footer_ function */
|
||||
$result .= $function($hosts);
|
||||
$result .= $function($hosts, $total_rows, $rows);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1347,17 +1412,29 @@ function render_site() {
|
||||
$result = '';
|
||||
|
||||
$sql_where = '';
|
||||
$sql_join = '';
|
||||
$sql_join = '';
|
||||
$sql_limit = '';
|
||||
|
||||
if (get_request_var('rows') == '-1') {
|
||||
$rows = read_config_option('num_rows_table');
|
||||
} elseif (get_request_var('rows') == 'default') {
|
||||
$rows = read_config_option('num_rows_table');
|
||||
} else {
|
||||
$rows = get_request_var('rows');
|
||||
}
|
||||
|
||||
render_where_join($sql_where, $sql_join);
|
||||
|
||||
$sql_limit = ' LIMIT ' . ($rows*(get_request_var('page')-1)) . ',' . $rows;
|
||||
|
||||
$hosts_sql = ("SELECT DISTINCT h.*, IFNULL(s.name,' " . __('Non-Site Devices', 'monitor') . " ') AS site_name
|
||||
FROM host AS h
|
||||
LEFT JOIN sites AS s
|
||||
ON s.id = h.site_id
|
||||
$sql_join
|
||||
$sql_where
|
||||
ORDER BY site_name, description");
|
||||
ORDER BY site_name, description
|
||||
$sql_limit");
|
||||
|
||||
$hosts = db_fetch_assoc($hosts_sql);
|
||||
|
||||
@@ -1442,10 +1519,21 @@ function render_template() {
|
||||
$result = '';
|
||||
|
||||
$sql_where = '';
|
||||
$sql_join = '';
|
||||
$sql_join = '';
|
||||
$sql_limit = '';
|
||||
|
||||
if (get_request_var('rows') == '-1') {
|
||||
$rows = read_config_option('num_rows_table');
|
||||
} elseif (get_request_var('rows') == 'default') {
|
||||
$rows = read_config_option('num_rows_table');
|
||||
} else {
|
||||
$rows = get_request_var('rows');
|
||||
}
|
||||
|
||||
render_where_join($sql_where, $sql_join);
|
||||
|
||||
$sql_limit = ' LIMIT ' . ($rows*(get_request_var('page')-1)) . ',' . $rows;
|
||||
|
||||
if (get_request_var('template') > 0) {
|
||||
$sql_where .= ($sql_where == '' ? '' : 'AND ') . 'ht.id = ' . get_request_var('template');
|
||||
}
|
||||
@@ -1462,7 +1550,8 @@ function render_template() {
|
||||
$sql_template
|
||||
$sql_join
|
||||
$sql_where
|
||||
ORDER BY ht.name, h.description");
|
||||
ORDER BY ht.name, h.description
|
||||
$sql_limit");
|
||||
|
||||
$ctemp = -1;
|
||||
$ptemp = -1;
|
||||
@@ -1590,6 +1679,7 @@ function render_tree() {
|
||||
|
||||
// Determine the correct width of the cell
|
||||
$maxlen = 10;
|
||||
|
||||
if (get_request_var('view') == 'default') {
|
||||
$maxlen = db_fetch_cell("SELECT MAX(LENGTH(description))
|
||||
FROM host AS h
|
||||
@@ -1598,6 +1688,7 @@ function render_tree() {
|
||||
WHERE disabled = ''
|
||||
AND deleted = ''");
|
||||
}
|
||||
|
||||
$maxlen = get_monitor_trim_length($maxlen);
|
||||
|
||||
if (cacti_sizeof($branchWhost)) {
|
||||
@@ -2080,63 +2171,85 @@ function render_header_tilesadt($hosts) {
|
||||
return render_header_default($hosts);
|
||||
}
|
||||
|
||||
function render_header_list($hosts) {
|
||||
function render_header_list($hosts, $total_rows = 0, $rows = 0) {
|
||||
$display_text = array(
|
||||
'hostname' => array(
|
||||
'hostname' => array(
|
||||
'display' => __('Hostname', 'monitor'),
|
||||
'align' => 'left', 'tip' => __('Hostname of device', 'monitor')
|
||||
'sort' => 'ASC',
|
||||
'align' => 'left', 'tip' => __('Hostname of device', 'monitor')
|
||||
),
|
||||
'id' => array(
|
||||
'display' => __('ID', 'monitor'),
|
||||
'sort' => 'ASC',
|
||||
'align' => 'left'
|
||||
),
|
||||
'description' => array(
|
||||
'display' => __('Description', 'monitor'),
|
||||
'align' => 'left'
|
||||
'sort' => 'ASC',
|
||||
'align' => 'left'
|
||||
),
|
||||
'site_name' => array(
|
||||
'site_name' => array(
|
||||
'display' => __('Site', 'monitor'),
|
||||
'align' => 'left'
|
||||
'sort' => 'ASC',
|
||||
'align' => 'left'
|
||||
),
|
||||
'criticality' => array(
|
||||
'monitor_criticality' => array(
|
||||
'display' => __('Criticality', 'monitor'),
|
||||
'align' => 'left'
|
||||
'sort' => 'ASC',
|
||||
'align' => 'left'
|
||||
),
|
||||
'avail' => array(
|
||||
'display' => __('Availability', 'monitor'),
|
||||
'align' => 'right'
|
||||
),
|
||||
'status' => array(
|
||||
'status' => array(
|
||||
'display' => __('Status', 'monitor'),
|
||||
'align' => 'center'
|
||||
'sort' => 'DESC',
|
||||
'align' => 'center'
|
||||
),
|
||||
'duration' => array(
|
||||
'display' => __('Length in status', 'monitor'),
|
||||
'align' => 'center'
|
||||
'instate' => array(
|
||||
'display' => __('Length in Status', 'monitor'),
|
||||
'sort' => 'ASC',
|
||||
'align' => 'center'
|
||||
),
|
||||
'average' => array(
|
||||
'avg_time' => array(
|
||||
'display' => __('Averages', 'monitor'),
|
||||
'align' => 'left'
|
||||
'sort' => 'DESC',
|
||||
'align' => 'left'
|
||||
),
|
||||
'warnings' => array(
|
||||
'monitor_warn' => array(
|
||||
'display' => __('Warning', 'monitor'),
|
||||
'sort' => 'DESC',
|
||||
'align' => 'left'
|
||||
),
|
||||
'lastfail' => array(
|
||||
'display' => __('Last Fail', 'monitor'),
|
||||
'align' => 'left'
|
||||
),
|
||||
'admin' => array(
|
||||
'monitor_text' => array(
|
||||
'display' => __('Admin', 'monitor'),
|
||||
'align' => 'left'
|
||||
'sort' => 'ASC',
|
||||
'tip' => __('Monitor Text Column represents \'Admin\'', 'monitor'),
|
||||
'align' => 'left'
|
||||
),
|
||||
'notes' => array(
|
||||
'notes' => array(
|
||||
'display' => __('Notes', 'monitor'),
|
||||
'align' => 'left'
|
||||
)
|
||||
'sort' => 'ASC',
|
||||
'align' => 'left'
|
||||
),
|
||||
'availability' => array(
|
||||
'display' => __('Availability', 'monitor'),
|
||||
'sort' => 'DESC',
|
||||
'align' => 'right'
|
||||
),
|
||||
'status_fail_date' => array(
|
||||
'display' => __('Last Fail', 'monitor'),
|
||||
'sort' => 'DESC',
|
||||
'align' => 'right'
|
||||
),
|
||||
);
|
||||
|
||||
ob_start();
|
||||
|
||||
$nav = html_nav_bar('monitor.php?rfilter=' . get_request_var('rfilter'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 12, __('Devices'), 'page', 'main');
|
||||
|
||||
html_start_box(__('Monitored Devices', 'monitor'), '100%', '', '3', 'center', '');
|
||||
html_nav_bar('monitor.php', 1, 1, sizeof($hosts), sizeof($hosts), cacti_sizeof($display_text), __('Devices', 'monitor'));
|
||||
html_header($display_text, '', '', false);
|
||||
|
||||
print $nav;
|
||||
|
||||
html_header_sort($display_text, get_request_var('sort_column'), get_request_var('sort_direction'), false);
|
||||
|
||||
$output = ob_get_contents();
|
||||
|
||||
@@ -2161,11 +2274,17 @@ function render_footer_tilesadt($hosts) {
|
||||
return render_footer_default($hosts);
|
||||
}
|
||||
|
||||
function render_footer_list($hosts) {
|
||||
function render_footer_list($hosts, $total_rows, $rows) {
|
||||
ob_start();
|
||||
|
||||
html_end_box(false);
|
||||
|
||||
if ($total_rows > 0) {
|
||||
$nav = html_nav_bar('monitor.php?rfilter=' . get_request_var('rfilter'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 12, __('Devices'), 'page', 'main');
|
||||
|
||||
print $nav;
|
||||
}
|
||||
|
||||
$output = ob_get_contents();
|
||||
|
||||
ob_end_clean();
|
||||
@@ -2228,17 +2347,18 @@ function render_host_list($host) {
|
||||
$url = $host['anchor'];
|
||||
|
||||
form_selectable_cell(filter_value($host['hostname'], '', $url), $host['id'], '', 'left');
|
||||
form_selectable_cell($host['id'], $host['id'], '', 'left');
|
||||
form_selectable_cell($host['description'], $host['id'], '', 'left');
|
||||
form_selectable_cell($host['site_name'], $host['id'], '', 'left');
|
||||
form_selectable_cell($host_crit, $host['id'], '', 'left');
|
||||
form_selectable_cell(round($host['availability'],2) . " %", $host['id'], '', 'right');
|
||||
form_selectable_cell($sdisplay, $host['id'], '', 'center');
|
||||
form_selectable_cell($dt, $host['id'], '', 'center');
|
||||
form_selectable_cell($host_avg, $host['id'], '', 'left');
|
||||
form_selectable_cell($host_warn, $host['id'], '', 'left');
|
||||
form_selectable_cell($host_datefail, $host['id'], '', 'left');
|
||||
form_selectable_cell($host_admin, $host['id'], '', 'left');
|
||||
form_selectable_cell($host['notes'], $host['id'], '', 'left');
|
||||
form_selectable_cell($host_admin, $host['id'], '', 'white-space:pre-wrap;text-align:left');
|
||||
form_selectable_cell(str_replace(array("\n", "\r"), array(' ', ''), $host['notes']), $host['id'], '', 'white-space:pre-wrap;text-align:left');
|
||||
form_selectable_cell(round($host['availability'],2) . " %", $host['id'], '', 'right');
|
||||
form_selectable_cell($host_datefail, $host['id'], '', 'right');
|
||||
|
||||
form_end_row();
|
||||
|
||||
|
||||
Reference in new issue
Block a user