test the svn and make some little modification to work proper
and from previous version
have to change manual the default value for thold_send_email under host table
and update value to 1 to set global to all host
Code: Select all
mysql -e "ALTER TABLE host MODIFY thold_send_email int(10) DEFAULT '1'" cacti
mysql -e "update host set thold_send_email='1'" cacti
Code: Select all
--- includes/polling.php 2011-10-10 23:12:47.000000000 +0300
+++ /var/www/htdocs/cacti/plugins/thold/includes/polling.php 2011-10-14 15:10:58.000000000 +0300
@@ -274,10 +274,10 @@
case '1': // Global List
break;
case '2': // Host List Only
- $alert_email = get_thold_notification_emails($host['thold_host_email']);
+ $alert_email = $host['thold_host_email'];
break;
case '3': // Global and Host List
- $alert_email = $alert_email . ',' . get_thold_notification_emails($host['thold_host_email']);
+ $alert_email = $alert_email . ',' . $host['thold_host_email'];
break;
}
@@ -285,7 +285,7 @@
cacti_log('THOLD: Can not send a Host Recovering Email since the \'Alert Email\' setting is not set !', true, 'POLLER');
} elseif ($host['thold_send_email'] == '0') {
cacti_log('THOLD: Did not send a Host Recovering Email, disabled per host setting : ' . $host['description'] . ' !', true, 'POLLER');
- } elseif ($alert_email != '') {
+ } else {
thold_mail($alert_email, '', $subject, $msg, '');
}
}
@@ -363,10 +363,10 @@
case '1': // Global List
break;
case '2': // Host List Only
- $alert_email = get_thold_notification_emails($host['thold_host_email']);
+ $alert_email = $host['thold_host_email'];
break;
case '3': // Global and Host List
- $alert_email = $alert_email . ',' . get_thold_notification_emails($host['thold_host_email']);
+ $alert_email = $alert_email . ',' . $host['thold_host_email'];
break;
}
@@ -374,7 +374,7 @@
cacti_log('THOLD: Can not send a Host Down Email since the \'Alert Email\' setting is not set !', true, 'POLLER');
} elseif ($host['thold_send_email'] == '0') {
cacti_log('THOLD: Did not send a Host Down Email, disabled per host setting : ' . $host['description'] . ' !', true, 'POLLER');
- } elseif ($alert_email != '') {
+ } else {
thold_mail($alert_email, '', $subject, $msg, '');
}
}
Code: Select all
--- includes/database.php 2011-10-10 16:59:29.000000000 +0300
+++ /var/www/htdocs/cacti/plugins/thold/includes/database.php 2011-10-14 15:14:59.000000000 +0300
@@ -179,7 +179,7 @@
api_plugin_db_table_create ('thold', 'plugin_notification_lists', $data);
api_plugin_db_add_column ('thold', 'host', array('name' => 'thold_send_email', 'type' => 'int(10)', 'unsigned' => true, 'NULL' => false, 'default' => '1', 'after' => 'disabled'));
- api_plugin_db_add_column ('thold', 'host', array('name' => 'thold_host_email', 'type' => 'int(10)', 'unsigned' => true, 'NULL' => false, 'after' => 'thold_send_email'));
+ api_plugin_db_add_column ('thold', 'host', array('name' => 'thold_host_email', 'type' => 'varchar(512)', 'unsigned' => true, 'NULL' => false, 'after' => 'thold_send_email'));
api_plugin_db_add_column ('thold', 'thold_data', array('name' => 'notify_warning', 'type' => 'int(10)', 'unsigned' => true, 'NULL' => false, 'default' => '1', 'after' => 'notify_warning_extra'));
api_plugin_db_add_column ('thold', 'thold_data', array('name' => 'notify_alert', 'type' => 'int(10)', 'unsigned' => true, 'NULL' => false, 'default' => '1', 'after' => 'notify_warning_extra'));
@@ -423,7 +423,7 @@
api_plugin_register_hook('thold', 'host_edit_bottom', 'thold_host_edit_bottom', 'setup.php');
api_plugin_db_add_column ('thold', 'host', array('name' => 'thold_send_email', 'type' => 'int(10)', 'NULL' => false, 'default' => '1', 'after' => 'disabled'));
- api_plugin_db_add_column ('thold', 'host', array('name' => 'thold_host_email', 'type' => 'int(10)', 'NULL' => false, 'after' => 'thold_send_email'));
+ api_plugin_db_add_column ('thold', 'host', array('name' => 'thold_host_email', 'type' => 'varchar(512)', 'NULL' => false, 'after' => 'thold_send_email'));
$data = array();
$data['columns'][] = array('name' => 'id', 'type' => 'int(12)', 'NULL' => false, 'unsigned' => true, 'auto_increment' => true);
Code: Select all
--- includes/settings.php 2011-10-14 05:51:56.000000000 +0300
+++ /var/www/htdocs/cacti/plugins/thold/includes/settings.php 2011-10-14 14:34:41.000000000 +0300
@@ -105,17 +105,18 @@
'description' => 'Which Notification List(s) of should be notified about Host Up/Down events?',
'value' => '|arg1:thold_send_email|',
'on_change' => 'changeNotify()',
- 'default' => '0',
+ 'default' => '1',
'form_id' => false
);
$fields_host_edit3['thold_host_email'] = array(
'friendly_name' => 'Notification List',
'description' => 'Additional Email address, separated by commas for multi Emails.',
- 'method' => 'drop_sql',
- 'sql' => "SELECT id,name FROM plugin_notification_lists ORDER BY name",
+ 'method' => 'textbox',
+// 'sql' => "SELECT id,name FROM plugin_notification_lists ORDER BY name",
'value' => '|arg1:thold_host_email|',
'default' => '',
- 'none_value' => 'None'
+ 'max_length' => 255,
+// 'none_value' => 'None'
);
}
}