Email notification update off monitor device

Support questions about the Threshold plugin

Moderators: Developers, Moderators

User avatar
dragossto
Cacti User
Posts: 86
Joined: Tue May 15, 2007 5:24 am
Location: Romania
Contact:

Re: Email notification update off monitor device

Post by dragossto »

ok , i will take now
and put to work :)

I forgot to add in
database.php
the line

Code: Select all

		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'));
thank you for complete the missing code
Cacti - 0.8.7h
Plugin Architecture - 3.0
Poller Type - SPINE 0.8.7g
Server Info - Linux 2.6.35.10 - Slackware 13.1
Web Server - Apache/2.2.17 (Unix) DAV/2 PHP 5.3.5
MySQL - 5.1.53 ;RRDTool - 1.4.5 ;SNMP - 5.6.1
Plugins
  • (tools - v0.3) (Thold - v0.4.6) (Ntop - v0.2) (Discovery - v1.2a) (Monitor - v1.2)
User avatar
dragossto
Cacti User
Posts: 86
Joined: Tue May 15, 2007 5:24 am
Location: Romania
Contact:

Re: Email notification update off monitor device

Post by dragossto »

in polling.php
remove the line 259

Code: Select all

$msg = $msg . "<br><br>Host was down for ";
because
the message body it read from config
it read at line 280

Code: Select all

$msg = read_config_option('thold_up_text');
Cacti - 0.8.7h
Plugin Architecture - 3.0
Poller Type - SPINE 0.8.7g
Server Info - Linux 2.6.35.10 - Slackware 13.1
Web Server - Apache/2.2.17 (Unix) DAV/2 PHP 5.3.5
MySQL - 5.1.53 ;RRDTool - 1.4.5 ;SNMP - 5.6.1
Plugins
  • (tools - v0.3) (Thold - v0.4.6) (Ntop - v0.2) (Discovery - v1.2a) (Monitor - v1.2)
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Email notification update off monitor device

Post by TheWitness »

Well, that's boiling it 'way' down (was half asleep) ;) Are there any other forks, to you knowledge, that review/incorporation before we cut this release and make it official?

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
ETETETET
Posts: 3
Joined: Wed Oct 05, 2011 11:53 pm

Re: Email notification update off monitor device

Post by ETETETET »

Hi Guys, I have updated the thold to 0.4.6, but I am still not able to see the email alert when there is host down, does anyone know why ?

Thanks for help.
User avatar
dragossto
Cacti User
Posts: 86
Joined: Tue May 15, 2007 5:24 am
Location: Romania
Contact:

Re: Email notification update off monitor device

Post by dragossto »

first check the email setting,
and try to see if your setting are good
and receive the email test
Cacti - 0.8.7h
Plugin Architecture - 3.0
Poller Type - SPINE 0.8.7g
Server Info - Linux 2.6.35.10 - Slackware 13.1
Web Server - Apache/2.2.17 (Unix) DAV/2 PHP 5.3.5
MySQL - 5.1.53 ;RRDTool - 1.4.5 ;SNMP - 5.6.1
Plugins
  • (tools - v0.3) (Thold - v0.4.6) (Ntop - v0.2) (Discovery - v1.2a) (Monitor - v1.2)
ETETETET
Posts: 3
Joined: Wed Oct 05, 2011 11:53 pm

Re: Email notification update off monitor device

Post by ETETETET »

Indeed, I get emails when the host returned from DOWN state.

But I don't get emails when the host down.

Thanks
User avatar
dragossto
Cacti User
Posts: 86
Joined: Tue May 15, 2007 5:24 am
Location: Romania
Contact:

Re: Email notification update off monitor device

Post by dragossto »

you take the last svn ?
because i see that it was modify
and i don't test yet the new svn

if use the thold from my first post have to work
because it used and tested by me
and for me work just fine
Cacti - 0.8.7h
Plugin Architecture - 3.0
Poller Type - SPINE 0.8.7g
Server Info - Linux 2.6.35.10 - Slackware 13.1
Web Server - Apache/2.2.17 (Unix) DAV/2 PHP 5.3.5
MySQL - 5.1.53 ;RRDTool - 1.4.5 ;SNMP - 5.6.1
Plugins
  • (tools - v0.3) (Thold - v0.4.6) (Ntop - v0.2) (Discovery - v1.2a) (Monitor - v1.2)
ETETETET
Posts: 3
Joined: Wed Oct 05, 2011 11:53 pm

Re: Email notification update off monitor device

Post by ETETETET »

From you first post mate, svn thold 0.4.6
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Email notification update off monitor device

Post by TheWitness »

Thold 0.4.6 has officially been released. If you installed an early beta from SVN, you may have to do the following to get the table updates:

Code: Select all

mysql -e "update settings set value='0.4.4' where name='thold_version'" cacti
Then goto the Thold tab to re-upgrade.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
dragossto
Cacti User
Posts: 86
Joined: Tue May 15, 2007 5:24 am
Location: Romania
Contact:

Re: Email notification update off monitor device

Post by dragossto »

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'
                        );
                }
        }
Cacti - 0.8.7h
Plugin Architecture - 3.0
Poller Type - SPINE 0.8.7g
Server Info - Linux 2.6.35.10 - Slackware 13.1
Web Server - Apache/2.2.17 (Unix) DAV/2 PHP 5.3.5
MySQL - 5.1.53 ;RRDTool - 1.4.5 ;SNMP - 5.6.1
Plugins
  • (tools - v0.3) (Thold - v0.4.6) (Ntop - v0.2) (Discovery - v1.2a) (Monitor - v1.2)
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Email notification update off monitor device

Post by TheWitness »

This change is not supported in mainline. We are moving to notification lists to handle the emails from a single location. You can remain on this fork, but your changes will have to be maintained by you. I suggest you revert the changes and adopt the notification lists.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
dragossto
Cacti User
Posts: 86
Joined: Tue May 15, 2007 5:24 am
Location: Romania
Contact:

Re: Email notification update off monitor device

Post by dragossto »

ok , no problem , but the email handler it not ready
from what i see when install
the plugin , but not able to define the emails list

so when will be ready
i will remain only whit svn and no any other modification
Cacti - 0.8.7h
Plugin Architecture - 3.0
Poller Type - SPINE 0.8.7g
Server Info - Linux 2.6.35.10 - Slackware 13.1
Web Server - Apache/2.2.17 (Unix) DAV/2 PHP 5.3.5
MySQL - 5.1.53 ;RRDTool - 1.4.5 ;SNMP - 5.6.1
Plugins
  • (tools - v0.3) (Thold - v0.4.6) (Ntop - v0.2) (Discovery - v1.2a) (Monitor - v1.2)
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Email notification update off monitor device

Post by TheWitness »

Revert to the current SVN and then let me know what is broken. Make sure that you re-perform the database upgrade by running the following command in mysql:

Code: Select all

update settings set value='0.4.4' where name='plugin_thold_version';
Then goto the Thold tab and the missing tables will be added.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
dragossto
Cacti User
Posts: 86
Joined: Tue May 15, 2007 5:24 am
Location: Romania
Contact:

Re: Email notification update off monitor device

Post by dragossto »

Hello Witness

I test the patch for Ugroup and the thold and work just fine.

I don't test yet the thresholds

please let me know when the
patch will be integrated into PIA

Have a nice day.
Cacti - 0.8.7h
Plugin Architecture - 3.0
Poller Type - SPINE 0.8.7g
Server Info - Linux 2.6.35.10 - Slackware 13.1
Web Server - Apache/2.2.17 (Unix) DAV/2 PHP 5.3.5
MySQL - 5.1.53 ;RRDTool - 1.4.5 ;SNMP - 5.6.1
Plugins
  • (tools - v0.3) (Thold - v0.4.6) (Ntop - v0.2) (Discovery - v1.2a) (Monitor - v1.2)
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests