Skip to content

Commit

Permalink
Correcting spelling and grammar issues
Browse files Browse the repository at this point in the history
Also, add new columns for future HRULE feature.
  • Loading branch information
cigamit committed Jan 13, 2017
1 parent 7e7214d commit ce4aefe
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 59 deletions.
2 changes: 1 addition & 1 deletion INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[info]
name = thold
version = 1.0
version = 1.0.1
longname = Thresholds
author = The Cacti Group
email =
Expand Down
12 changes: 6 additions & 6 deletions cli_thresholds.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function thold_cli_autocreate_host ($id) {
echo "Auto Creating Thresholds for Device #$id\n";
autocreate($id);
if (isset($_SESSION['thold_message'])) {
echo strip_tags(str_replace(array('<br>', 'Created threshold'), array("\n", ' Created threshold'), $_SESSION['thold_message']));
echo strip_tags(str_replace(array('<br>', 'Created Threshold'), array("\n", ' Created Threshold'), $_SESSION['thold_message']));
}
}

Expand All @@ -154,13 +154,13 @@ function display_help () {
print "Threshold Command Line Interface, Version " . read_config_option('plugin_thold_version') . "\n";
print "usage: cli_thresholds.php --auto-create=N | --graph-template=N [--thold-template=N] [--graph-ids='N1 N2 ...']\n\n";
print "There are two usage methods:\n\n";
print "The first requires you to specify the host id of the device and all existing threshold templates\n";
print "The first requires you to specify the host id of the device and all existing Threshold templates\n";
print "are applied to hosts.\n\n";
print "The second requires you to specify a minimum of a Graph Template ID, and optionally the\n";
print "Threshold Template and Graph ID's of the Graphs to be impacted.\n\n";
print "--auto-create=N - Auto Create all thresholds for this host id using current templates\n";
print "--graph-template=N - The Graph Template to create thresholds for\n";
print "--thold-template=N - The Threshold Template to use for creating thresholds\n";
print "--graph-ids='N1 N2 ...' - The Threshold Template to use for creating thresholds\n";
print "--auto-create=N - Auto Create all Thresholds for this host id using current templates\n";
print "--graph-template=N - The Graph Template to create Thresholds for\n";
print "--thold-template=N - The Threshold Template to use for creating Thresholds\n";
print "--graph-ids='N1 N2 ...' - The Threshold Template to use for creating Thresholds\n";
print "-h --help -V --version - Display this help message\n\n";
}
2 changes: 1 addition & 1 deletion includes/arrays.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

$thold_log_retention = array(
'-1' => __('Indefinately'),
'-1' => __('Indefinitely'),
'31' => __('%d Month', 1),
'62' => __('%d Months', 2),
'93' => __('%d Months', 3),
Expand Down
12 changes: 9 additions & 3 deletions includes/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ function thold_upgrade_database () {
api_plugin_db_add_column ('thold', 'thold_data', array('name' => 'data_template_id', 'type' => 'int(11)', 'NULL' => false, 'default' => 0, 'after' => 'graph_template'));
api_plugin_db_add_column ('thold', 'thold_data', array('name' => 'restored_alert', 'type' => 'char(3)', 'NULL' => false, 'default' => ''));


api_plugin_db_add_column ('thold', 'thold_template', array('name' => 'name', 'type' => 'varchar(100)', 'NULL' => false, 'default' => '', 'after' => 'id'));
api_plugin_db_add_column ('thold', 'thold_template', array('name' => 'time_hi', 'type' => 'varchar(100)', 'NULL' => true, 'after' => 'thold_fail_trigger'));
api_plugin_db_add_column ('thold', 'thold_template', array('name' => 'time_low', 'type' => 'varchar(100)', 'NULL' => true, 'after' => 'time_hi'));
Expand Down Expand Up @@ -311,6 +310,13 @@ function thold_upgrade_database () {
}
}

if (version_compare($oldv, '1.0.1', '<')) {
api_plugin_db_add_column ('thold', 'thold_data', array('name' => 'thold_hrule_alert', 'type' => 'int(11)', 'unsigned' => true, 'NULL' => false, 'default' => '', 'after' => 'exempt'));
api_plugin_db_add_column ('thold', 'thold_data', array('name' => 'thold_hrule_warning', 'type' => 'int(11)', 'unsigned' => true, 'NULL' => false, 'default' => '', 'after' => 'thold_hrule_alert') );
api_plugin_db_add_column ('thold', 'thold_template', array('name' => 'thold_hrule_alert', 'type' => 'int(11)', 'unsigned' => true, 'NULL' => false, 'default' => '', 'after' => 'exempt'));
api_plugin_db_add_column ('thold', 'thold_template', array('name' => 'thold_hrule_warning', 'type' => 'int(11)', 'unsigned' => true, 'NULL' => false, 'default' => '', 'after' => 'thold_hrule_alert') );
}

db_execute('UPDATE settings SET value = "' . $v['version'] . '" WHERE name = "plugin_thold_version"');
db_execute('UPDATE plugin_config SET version = "' . $v['version'] . '" WHERE directory = "thold"');
}
Expand Down Expand Up @@ -441,7 +447,7 @@ function thold_setup_database () {
$data['keys'][] = array('name' => 'data_source_id', 'columns' => 'data_source_id');
$data['keys'][] = array('name' => 'data_template_id', 'columns' => 'data_template_id');
$data['type'] = 'InnoDB';
$data['comment'] = 'Table of thresholds defaults for graphs';
$data['comment'] = 'Table of Thresholds defaults for graphs';
api_plugin_db_table_create ('thold', 'thold_template', $data);

$data = array();
Expand All @@ -454,7 +460,7 @@ function thold_setup_database () {
$data['keys'][] = array('name' => 'user_id', 'columns' => 'user_id');
$data['unique_keys'][] = array('name' => 'user_id_type', 'columns' => 'user_id`, `type');
$data['type'] = 'InnoDB';
$data['comment'] = 'Table of threshold contacts';
$data['comment'] = 'Table of Threshold contacts';
api_plugin_db_table_create ('thold', 'plugin_thold_contacts', $data);

$data = array();
Expand Down
2 changes: 1 addition & 1 deletion includes/polling.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ function thold_update_host_status() {

$msg = read_config_option('thold_up_text');
if ($msg == '') {
$msg = __('<br>System <DESCRIPTION> (<HOSTNAME>) status: <DOWN/UP><br><br>Current ping response: <CUR_TIME> ms<br>Average system response : <AVG_TIME> ms<br>System availability: <AVAILABILITY><br>Total Checks Since Clear: <TOT_POLL><br>Total Failed Checks: <FAIL_POLL><br>Last Date Checked UP: <LAST_FAIL><br>Devices Previously DOWN for: <DOWNTIME><br><br>Snmp Info:<br>Name - <SNMP_HOSTNAME><br>Location - <SNMP_LOCATION><br>Uptime - <UPTIMETEXT> (<UPTIME> ms)<br>System - <SNMP_SYSTEM><br><br>NOTE: <NOTES>');
$msg = __('<br>System <DESCRIPTION> (<HOSTNAME>) status: <DOWN/UP><br><br>Current ping response: <CUR_TIME> ms<br>Average system response : <AVG_TIME> ms<br>System availability: <AVAILABILITY><br>Total Checks Since Clear: <TOT_POLL><br>Total Failed Checks: <FAIL_POLL><br>Last Date Checked UP: <LAST_FAIL><br>Devices Previously DOWN for: <DOWNTIME><br><br>SNMP Info:<br>Name - <SNMP_HOSTNAME><br>Location - <SNMP_LOCATION><br>Uptime - <UPTIMETEXT> (<UPTIME> ms)<br>System - <SNMP_SYSTEM><br><br>NOTE: <NOTES>');
}
$msg = str_replace('<SUBJECT>', $subject, $msg);
$msg = str_replace('<HOSTNAME>', $host['hostname'], $msg);
Expand Down
32 changes: 16 additions & 16 deletions includes/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function thold_config_form () {
'collapsible' => true
);
$fields_host_edit3['thold_send_email'] = array(
'friendly_name' => __('Thold Up/Down Email Notification'),
'friendly_name' => __('Threshold Up/Down Email Notification'),
'method' => 'drop_array',
'array' => array(
'0' => __('Disabled'),
Expand Down Expand Up @@ -193,7 +193,7 @@ function thold_config_settings () {
),
'thold_autocreate' => array(
'friendly_name' => __('Auto Create Thresholds'),
'description' => __('If selected, when running either automation, or when creating/saving a Device, all thresholds associated with the Device Template will be created.'),
'description' => __('If selected, when running either automation, or when creating/saving a Device, all Thresholds associated with the Device Template will be created.'),
'method' => 'checkbox',
'default' => ''
),
Expand Down Expand Up @@ -240,7 +240,7 @@ function thold_config_settings () {
),
'thold_log_debug' => array(
'friendly_name' => __('Debug Log'),
'description' => __('Enable logging of debug messages with Thold'),
'description' => __('Enable logging of debug messages with Threshold'),
'method' => 'checkbox',
'default' => ''
),
Expand All @@ -257,13 +257,13 @@ function thold_config_settings () {
),
'thold_daemon_enable' => array(
'friendly_name' => __('Enable Threshold Daemon'),
'description' => __('Checking this box will enable the use of a dedicated Threshold daemon. This can be used to increase system performace and/or to distribute threshold monitoring to a separate server.'),
'description' => __('Checking this box will enable the use of a dedicated Threshold daemon. This can be used to increase system performance and/or to distribute Threshold monitoring to a separate server.'),
'method' => 'checkbox',
'default' => ''
),
'thold_max_concurrent_processes' => array(
'friendly_name' => __('Maximum Concurrent Thold Processes'),
'description' => __('The maximum number of concurrent processes to be handled by the Thold Daemon.'),
'friendly_name' => __('Maximum Concurrent Threshold Processes'),
'description' => __('The maximum number of concurrent processes to be handled by the Threshold Daemon.'),
'method' => 'textbox',
'size' => 2,
'max_length' => 2,
Expand All @@ -275,7 +275,7 @@ function thold_config_settings () {
),
'alert_exempt' => array(
'friendly_name' => __('Weekend exemptions'),
'description' => __('If this is checked, thold will not run on weekends.'),
'description' => __('If this is checked, Thold will not run on weekends.'),
'method' => 'checkbox',
),
'alert_trigger' => array(
Expand All @@ -300,7 +300,7 @@ function thold_config_settings () {
),
'alert_bl_timerange_def' => array(
'friendly_name' => __('Baseline Time Range Default'),
'description' => __('This is the default value used in creating thresholds or templates.'),
'description' => __('This is the default value used in creating Thresholds or templates.'),
'method' => 'drop_array',
'array' => get_reference_types(),
'size' => 12,
Expand All @@ -317,7 +317,7 @@ function thold_config_settings () {
),
'alert_bl_percent_def' => array(
'friendly_name' => __('Baseline Deviation Percentage'),
'description' => __('This is the default value used in creating thresholds or templates.'),
'description' => __('This is the default value used in creating Thresholds or templates.'),
'method' => 'textbox',
'size' => 3,
'max_length' => 3,
Expand Down Expand Up @@ -367,12 +367,12 @@ function thold_config_settings () {
),
'thold_alert_snmp_warning' => array(
'friendly_name' => __('Disable Warning Notifications'),
'description' => __('If this is checked, Thold will not send a notification when a warning threshold has been breached.'),
'description' => __('If this is checked, Threshold will not send a notification when a warning Threshold has been breached.'),
'method' => 'checkbox'
),
'thold_alert_snmp_normal' => array(
'friendly_name' => __('Disable Restoration Notifications'),
'description' => __('If this is checked, Thold will not send a notfication when the threshold has returned to normal status.'),
'description' => __('If this is checked, Threshold will not send a notification when the Threshold has returned to normal status.'),
'method' => 'checkbox'
),
'thold_snmp_event_description' => array(
Expand Down Expand Up @@ -422,7 +422,7 @@ function thold_config_settings () {
'class' => 'textAreaNotes',
'textarea_rows' => '7',
'textarea_cols' => '80',
'default' => __('System Error : <DESCRIPTION> (<HOSTNAME>) is <DOWN/UP><br>Reason: <MESSAGE><br><br>Average system response : <AVG_TIME> ms<br>System availability: <AVAILABILITY><br>Total Checks Since Clear: <TOT_POLL><br>Total Failed Checks: <FAIL_POLL><br>Last Date Checked DOWN : <LAST_FAIL><br>Device Previously UP for: <DOWNTIME><br>NOTE: <NOTES>'),
'default' => __('System Error : <DESCRIPTION> (<HOSTNAME>) is <DOWN/UP><br>Reason: <MESSAGE><br><br>Average system response: <AVG_TIME> ms<br>System availability: <AVAILABILITY><br>Total Checks Since Clear: <TOT_POLL><br>Total Failed Checks: <FAIL_POLL><br>Last Date Checked DOWN : <LAST_FAIL><br>Device Previously UP for: <DOWNTIME><br>NOTE: <NOTES>'),
),
'thold_up_subject' => array(
'friendly_name' => __('Recovering Device Subject'),
Expand All @@ -439,18 +439,18 @@ function thold_config_settings () {
'class' => 'textAreaNotes',
'textarea_rows' => '7',
'textarea_cols' => '80',
'default' => __('<br>System <DESCRIPTION> (<HOSTNAME>) status: <DOWN/UP><br><br>Current ping response: <CUR_TIME> ms<br>Average system response : <AVG_TIME> ms<br>System availability: <AVAILABILITY><br>Total Checks Since Clear: <TOT_POLL><br>Total Failed Checks: <FAIL_POLL><br>Last Date Checked UP: <LAST_FAIL><br>Device Previously DOWN for: <DOWNTIME><br><br>Snmp Info:<br>Name - <SNMP_HOSTNAME><br>Location - <SNMP_LOCATION><br>Uptime - <UPTIMETEXT> (<UPTIME> ms)<br>System - <SNMP_SYSTEM><br><br>NOTE: <NOTES>'),
'default' => __('<br>System <DESCRIPTION> (<HOSTNAME>) status: <DOWN/UP><br><br>Current ping response: <CUR_TIME> ms<br>Average system response: <AVG_TIME> ms<br>System availability: <AVAILABILITY><br>Total Checks Since Clear: <TOT_POLL><br>Total Failed Checks: <FAIL_POLL><br>Last Date Checked UP: <LAST_FAIL><br>Device Previously DOWN for: <DOWNTIME><br><br>Snmp Info:<br>Name - <SNMP_HOSTNAME><br>Location - <SNMP_LOCATION><br>Uptime - <UPTIMETEXT> (<UPTIME> ms)<br>System - <SNMP_SYSTEM><br><br>NOTE: <NOTES>'),
),
'thold_from_email' => array(
'friendly_name' => __('From Email Address'),
'description' => __('This is the Email address that the threshold will appear from.'),
'description' => __('This is the Email address that the Threshold will appear from.'),
'method' => 'textbox',
'default' => read_config_option('settings_from_email'),
'max_length' => 255,
),
'thold_from_name' => array(
'friendly_name' => __('From Name'),
'description' => __('This is the actual name that the threshold will appear from.'),
'description' => __('This is the actual name that the Threshold will appear from.'),
'method' => 'textbox',
'default' => read_config_option('settings_from_name'),
'max_length' => 255,
Expand All @@ -466,7 +466,7 @@ function thold_config_settings () {
),
'thold_warning_text' => array(
'friendly_name' => __('Threshold Warning Message'),
'description' => __('This is the message that will be displayed at the top of all threshold warnings (255 Char MAX). HTML is allowed, but will be removed for text only Emails. There are several descriptors that may be used.<br>&#060DESCRIPTION&#062 &#060HOSTNAME&#062 &#060TIME&#062 &#060URL&#062 &#060GRAPHID&#062 &#060CURRENTVALUE&#062 &#060THRESHOLDNAME&#062 &#060DSNAME&#062 &#060SUBJECT&#062 &#060GRAPH&#062'),
'description' => __('This is the message that will be displayed at the top of all Threshold warnings (255 Char MAX). HTML is allowed, but will be removed for text only Emails. There are several descriptors that may be used.<br>&#060DESCRIPTION&#062 &#060HOSTNAME&#062 &#060TIME&#062 &#060URL&#062 &#060GRAPHID&#062 &#060CURRENTVALUE&#062 &#060THRESHOLDNAME&#062 &#060DSNAME&#062 &#060SUBJECT&#062 &#060GRAPH&#062'),
'method' => 'textarea',
'class' => 'textAreaNotes',
'textarea_rows' => '5',
Expand Down
14 changes: 8 additions & 6 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@

function plugin_thold_install () {
global $config;

if (version_compare($config['cacti_version'], '1.0.0') < 0) {
return false;
}

api_plugin_register_hook('thold', 'page_head', 'thold_page_head', 'setup.php');
api_plugin_register_hook('thold', 'top_header_tabs', 'thold_show_tab', 'includes/tab.php');
api_plugin_register_hook('thold', 'top_graph_header_tabs', 'thold_show_tab', 'includes/tab.php');
Expand Down Expand Up @@ -394,7 +396,7 @@ function thold_device_action_prepare($save) {

print "<tr>
<td colspan='2' class='textArea'>
<p>" . __('Click \'Continute\' to apply all appropriate Thresholds to these Device(s).') . "</p>
<p>" . __('Click \'Continue\' to apply all appropriate Thresholds to these Device(s).') . "</p>
<ul>" . $save['host_list'] . "</ul>
</td>
</tr>";
Expand Down Expand Up @@ -487,7 +489,7 @@ function thold_data_sources_table($ds) {
function thold_graphs_new() {
global $config;

print '<span class="linkMarker">*</span><a class="autocreate hyperLink" href="' . htmlspecialchars($config['url_path'] . 'plugins/thold/thold.php?action=autocreate&host_id=' . get_filter_request_var('host_id')) . '">' . __('Auto-create thresholds'). '</a><br>';
print '<span class="linkMarker">*</span><a class="autocreate hyperLink" href="' . htmlspecialchars($config['url_path'] . 'plugins/thold/thold.php?action=autocreate&host_id=' . get_filter_request_var('host_id')) . '">' . __('Auto-create Thresholds'). '</a><br>';
}

function thold_user_admin_setup_sql_save($save) {
Expand Down Expand Up @@ -618,7 +620,7 @@ function thold_data_source_action_execute($action) {

plugin_thold_log_changes($id, 'created', " $tname [$name]");

$message .= __('Created threshold for the Graph \'<i>%s</i>\' using the Data Source \'<i>%s</i>\'', $tname, $name) . "<br>";
$message .= __('Created Threshold for the Graph \'<i>%s</i>\' using the Data Source \'<i>%s</i>\'', $tname, $name) . "<br>";
}
}
}
Expand Down Expand Up @@ -841,7 +843,7 @@ function thold_graphs_action_execute($action) {
}

plugin_thold_log_changes($id, 'created', " $tname [$name]");
$message .= __('Created threshold for the Graph \'<i>%s</i>\' using the Data Source \'<i>%s</i>\'', $tname, $name) . "<br>";
$message .= __('Created Threshold for the Graph \'<i>%s</i>\' using the Data Source \'<i>%s</i>\'', $tname, $name) . "<br>";
}
}
}
Expand Down Expand Up @@ -1039,7 +1041,7 @@ function thold_device_edit_pre_bottom() {
$i++;
}
}else{
print '<tr><td><em>' . __('No Associated Threshold Templates.') . '</em></td></tr>';
print '<tr><td colspan="2"><em>' . __('No Associated Threshold Templates.') . '</em></td></tr>';
}

html_end_box();
Expand Down Expand Up @@ -1071,7 +1073,7 @@ function thold_device_template_edit() {
$i++;
}
}else{
print '<tr><td><em>' . __('No Associated Threshold Templates.') . '</em></td></tr>';
print '<tr><td colspan="2"><em>' . __('No Associated Threshold Templates.') . '</em></td></tr>';
}

$unmapped = db_fetch_assoc_prepared('SELECT DISTINCT tt.id, tt.name
Expand Down
Loading

0 comments on commit ce4aefe

Please sign in to comment.