Hello sodium
i take your update and put my in your update
but i have some issue whit my update
1) it that, when i make uninstall of thold the column putted in database host
whit thold_send_email and thold_host_email they bean erased , they bean erased from the database
2) the update it work only when install the plugin if run from cli
once after the plugin it installed from the plugin management
and other problem whit
Notice: Undefined index: 6 in /var/www/htdocs/cacti/plugins/thold/thold_templates.php on line 429 Notice: Undefined index: 24 in /var/www/htdocs/cacti/plugins/thold/thold_templates.php on line 429 Notice: Undefined index: 288 in /var/www/htdocs/cacti/plugins/thold/thold_templates.php on line 429 Mandatory settings
when i try to make a template of advanced ping for loss
the modification made by me don't include this file thold_templates.php
i will make some check tomorrow
The changes made by me (only the diff -Nau2r yourfile.php myfile.php)
Code: Select all
+++ polling.php 2011-02-14 22:51:44.000000000 +0200
@@ -181,2 +181,3 @@
$snmp_contact = '';
+ $snmp_uptime = '';
$uptimelong = '';
@@ -226,3 +227,2 @@
$downtime_seconds = $downtime - ($downtime_days * 86400) - ($downtime_hours * 3600) - ($downtime_minutes * 60);
- $msg = $msg . "<br><br>Host was down for ";
if ($downtime_days > 0 ) {
@@ -270,4 +270,10 @@
$msg = str_replace("\n", '<br>', $msg);
- if ($alert_email == '') {
- cacti_log('THOLD: Can not send Host Recovering email since the \'Alert e-mail\' setting is not set!', true, 'POLLER');
+ if ($host['thold_send_email'] == 'on' && $host['thold_host_email'] != '' ) {
+ $alert_email = $alert_email . ',' . $host['thold_host_email'];
+ }
+ if ($host['thold_send_email'] != 'on' && $host['thold_host_email'] != '' ) {
+ $alert_email = $host['thold_host_email'];
+ }
+ if ($alert_email == '' || ($host['thold_send_email'] != 'on' && $host['thold_host_email'] == '' )) {
+ cacti_log('THOLD: Can not send Host Recovering email since the \'Alert e-mail\' setting is not set or disable per host!', true, 'POLLER');
} else {
@@ -336,4 +342,10 @@
$msg = str_replace("\n", '<br>', $msg);
- if ($alert_email == '') {
- cacti_log('THOLD: Can not send Host Down email since the \'Alert e-mail\' setting is not set!', true, 'POLLER');
+ if ($host['thold_send_email'] == 'on' && $host['thold_host_email'] != '' ) {
+ $alert_email = $alert_email . ',' . $host['thold_host_email'];
+ }
+ if ($host['thold_send_email'] != 'on' && $host['thold_host_email'] != '' ) {
+ $alert_email = $host['thold_host_email'];
+ }
+ if ($alert_email == '' || ($host['thold_send_email'] != 'on' && $host['thold_host_email'] == '' )) {
+ cacti_log('THOLD: Can not send Host Recovering email since the \'Alert e-mail\' setting is not set or disable per host!', true, 'POLLER');
} else {
Code: Select all
+++ database.php 2011-02-14 20:43:03.000000000 +0200
@@ -80,3 +80,5 @@
-
+ // Added in thold v0.4.3 to disable email fosr host or send email to extra account
+ api_plugin_db_add_column ('thold', 'host', array('name' => 'thold_send_email', 'type' => 'char(3)', 'NULL' => false, 'default' => 'on', 'after' => 'disabled'));
+ api_plugin_db_add_column ('thold', 'host', array('name' => 'thold_host_email', 'type' => 'text', 'NULL' => false, 'after' => 'thold_send_email'));
// Update our hooks
Code: Select all
+++ settings.php 2011-02-14 22:35:27.000000000 +0200
@@ -74,2 +74,32 @@
+function thold_config_form () {
+ global $fields_host_edit;
+ $fields_host_edit2 = $fields_host_edit;
+ $fields_host_edit3 = array();
+ foreach ($fields_host_edit2 as $f => $a) {
+ $fields_host_edit3[$f] = $a;
+ if ($f == 'disabled') {
+ $fields_host_edit3['thold_send_email'] = array(
+ 'method' => 'checkbox',
+ 'friendly_name' => 'Thold Email Host',
+ 'description' => 'Check this box to send Email for Host/Up.',
+ 'value' => '|arg1:thold_send_email|',
+ 'default' => '',
+ 'form_id' => false
+ );
+ $fields_host_edit3['thold_host_email'] = array(
+ 'friendly_name' => 'Additional Email address',
+ 'description' => 'Additional Email address, separated by commas for multi Emails.',
+ 'method' => 'textarea',
+ 'max_length' => 1000,
+ 'textarea_rows' => 1,
+ 'textarea_cols' => 30,
+ 'value' => '|arg1:thold_host_email|',
+ 'default' => '',
+ );
+ }
+ }
+ $fields_host_edit = $fields_host_edit3;
+}
+
function thold_config_settings () {
@@ -199,3 +229,3 @@
'friendly_name' => 'Down Host Message',
- 'description' => 'This is the message that will be displayed as the message body of all UP / Down Host Messages (255 Char MAX). HTML is allowed, but will be removed for text only emails. There are several descriptors that may be used.<br><HOSTNAME> <DESCRIPTION> <UPTIME> <UPTIMETEXT> <DOWNTIME> <MESSAGE> <SUBJECT> <DOWN/UP> <SNMP_HOSTNAME> <SNMP_LOCATION> <SNMP_CONTACT> <SNMP_SYSTEM> <LAST_FAIL> <AVAILABILITY> <CUR_TIME> <AVR_TIME> <NOTES>',
+ 'description' => 'This is the message that will be displayed as the message body of all UP / Down Host Messages (255 Char MAX). HTML is allowed, but will be removed for text only emails. There are several descriptors that may be used.<br><HOSTNAME> <DESCRIPTION> <UPTIME> <UPTIMETEXT> <DOWNTIME> <MESSAGE> <SUBJECT> <DOWN/UP> <SNMP_HOSTNAME> <SNMP_LOCATION> <SNMP_CONTACT> <SNMP_SYSTEM> <LAST_FAIL> <AVAILABILITY> <CUR_TIME> <AVG_TIME> <NOTES>',
'method' => 'textarea',
@@ -214,3 +244,3 @@
'friendly_name' => 'Recovering Host Message',
- 'description' => 'This is the message that will be displayed as the message body of all UP / Down Host Messages (255 Char MAX). HTML is allowed, but will be removed for text only emails. There are several descriptors that may be used.<br><HOSTNAME> <DESCRIPTION> <UPTIME> <UPTIMETEXT> <DOWNTIME> <MESSAGE> <SUBJECT> <DOWN/UP> <SNMP_HOSTNAME> <SNMP_LOCATION> <SNMP_CONTACT> <SNMP_SYSTEM> <LAST_FAIL> <AVAILABILITY> <CUR_TIME> <AVR_TIME> <NOTES>',
+ 'description' => 'This is the message that will be displayed as the message body of all UP / Down Host Messages (255 Char MAX). HTML is allowed, but will be removed for text only emails. There are several descriptors that may be used.<br><HOSTNAME> <DESCRIPTION> <UPTIME> <UPTIMETEXT> <DOWNTIME> <MESSAGE> <SUBJECT> <DOWN/UP> <SNMP_HOSTNAME> <SNMP_LOCATION> <SNMP_CONTACT> <SNMP_SYSTEM> <LAST_FAIL> <AVAILABILITY> <CUR_TIME> <AVG_TIME> <NOTES>',
'method' => 'textarea',
Code: Select all
+++ setup.php 2011-02-14 21:12:08.000000000 +0200
@@ -31,2 +31,3 @@
api_plugin_register_hook('thold', 'config_arrays', 'thold_config_arrays', 'includes/settings.php');
+ api_plugin_register_hook('thold', 'config_form', 'thold_config_form', 'includes/settings.php');
api_plugin_register_hook('thold', 'config_settings', 'thold_config_settings', 'includes/settings.php');
@@ -276,2 +277,12 @@
}
+
+ if (isset($_POST['thold_send_email']))
+ $save['thold_send_email'] = form_input_validate($_POST['thold_send_email'], 'thold_send_email', '', true, 3);
+ else
+ $save['thold_send_email'] = form_input_validate('', 'thold_send_email', '', true, 3);
+ if (isset($_POST['thold_host_email']))
+ $save['thold_host_email'] = form_input_validate($_POST['thold_host_email'], 'thold_host_email', '', true, 3);
+ else
+ $save['thold_host_email'] = form_input_validate('', 'thold_host_email', '', true, 3);
+
return $save;
Have good night.