Not correct subject my email about host UP or DOWN

Support questions about the Threshold plugin

Moderators: Developers, Moderators

mirage
Posts: 24
Joined: Fri Feb 18, 2011 7:20 am

Not correct subject my email about host UP or DOWN

Post by mirage »

Hi all.
When my host falls, I receive a letter about it. In the body of written
that this host is down or a host up. A subject line is always
is the same: "Host Notice: DESK (10.120.6.20) returned from DOWN state"

For example:
The host down, subject line: "Host Notice: DESK (10.120.6.20) returned from
DOWN state "
Host up, subject line: "Host Notice: DESK (10.120.6.20) returned
from DOWN state "

A message body is different, where the proper notification of the UP \ DOWN host


I tried to change the field "Recovering Host Subject" to "Host Notice: <DESCRIPTION> (<HOSTNAME>) is <DOWN/UP> state". But this box is not working variable <DOWN/UP>

What should I do?
GrahamF
Posts: 7
Joined: Thu Feb 10, 2011 7:37 pm

Re: Not correct subject my email about host UP or DOWN

Post by GrahamF »

I have the same issue.

0.8.7g
PIA 2.9
Settings .7
thold 0.4.3-3 (anything higher doesn't recognize thresholds getting crossed)

Edit retracted.
Last edited by GrahamF on Wed Mar 02, 2011 1:56 pm, edited 2 times in total.
User avatar
dragossto
Cacti User
Posts: 86
Joined: Tue May 15, 2007 5:24 am
Location: Romania
Contact:

Re: Not correct subject my email about host UP or DOWN

Post by dragossto »

for host subject
you may set different subjects
for down and for up
the only value changed in the subject
and work,it <HOSTNAME> and <DESCRIPTION>
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)
mirage
Posts: 24
Joined: Fri Feb 18, 2011 7:20 am

Re: Not correct subject my email about host UP or DOWN

Post by mirage »

Look.
Topics different but all messages have the same subject "Recovering Host
Subject "-" Recovering Host "

host is DOWN - subject "Recovering Host"
host is UP - subject massege "Recovering Host"
Attachments
qqq.PNG
qqq.PNG (32.09 KiB) Viewed 4886 times
User avatar
dragossto
Cacti User
Posts: 86
Joined: Tue May 15, 2007 5:24 am
Location: Romania
Contact:

Re: Not correct subject my email about host UP or DOWN

Post by dragossto »

hello

you have 2 option ,
first make one upgrade of thold , but it necessary PIA 2.9
before make the upgrade first make backup ,because if you have any threshold
when uninstall the plugin , it possible to lase data from told
u make update from http://forums.cacti.net/viewtopic.php?f=17&t=36235

or

modify from directory include under thold plugin
the file polling.php
in function thold_update_host_status
around the line 250 you find this line

Code: Select all

$subject = str_replace('<DESCRIPTION>', $host['description'], $subject);
and the line

Code: Select all

$subject = strip_tags($subject);
between them put this line

Code: Select all

$subject = str_replace('<DOWN/UP>', 'UP', $subject);
also around line 320 u will have again the line mentioned above ,
but this time you should have between this two line
this line

Code: Select all

$subject = str_replace('<DOWN/UP>', 'DOWN', $subject);
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)
beone
Posts: 4
Joined: Thu Mar 31, 2011 12:27 am

Re: Not correct subject my email about host UP or DOWN

Post by beone »

Hi,

I got a strange issue.
Everything is working, but on a host down notification there are always 3 e-mails sent per down host.
On host up, only one e-mail is sent (as it should be)

Any ideas why we always get 3 e-mails on host down notification?

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

Re: Not correct subject my email about host UP or DOWN

Post by dragossto »

there it a little mistake in the code
even host go down u receive the email only whit up

u have 2 option
first it to correct the mistake by your self
in polling.php , or
try to use my one whit few extra option
from hear http://forums.cacti.net/viewtopic.php?f=17&t=36235
but before make update , first a backup because
when uninstall the version that u have , it possible also
to erase your thold configurations

Good luck
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)
mirage
Posts: 24
Joined: Fri Feb 18, 2011 7:20 am

Re: Not correct subject my email about host UP or DOWN

Post by mirage »

dragossto wrote:hello

you have 2 option ,
first make one upgrade of thold , but it necessary PIA 2.9
before make the upgrade first make backup ,because if you have any threshold
when uninstall the plugin , it possible to lase data from told
u make update from http://forums.cacti.net/viewtopic.php?f=17&t=36235

or

modify from directory include under thold plugin
the file polling.php
in function thold_update_host_status
around the line 250 you find this line

Code: Select all

$subject = str_replace('<DESCRIPTION>', $host['description'], $subject);
and the line

Code: Select all

$subject = strip_tags($subject);
between them put this line

Code: Select all

$subject = str_replace('<DOWN/UP>', 'UP', $subject);
also around line 320 u will have again the line mentioned above ,
but this time you should have between this two line
this line

Code: Select all

$subject = str_replace('<DOWN/UP>', 'DOWN', $subject);

Thank you for responding to my problem.

Solved it this way:
I changed polling.php as you said, but it did not help me. Then I removed from the WEB interface cacti, messages in threads they were taken from the file polling.php and then I worked.

and after that everything works:)))
And if you want to change the subject of letters, then I correct them in a file polling.php. It's a pity that the Russian subjects can not write, but it's not important
Attachments
cactiClear.PNG
cactiClear.PNG (9.12 KiB) Viewed 4627 times
User avatar
dragossto
Cacti User
Posts: 86
Joined: Tue May 15, 2007 5:24 am
Location: Romania
Contact:

Re: Not correct subject my email about host UP or DOWN

Post by dragossto »

it good when the job it done :)

very well , you figure out how to fix your problem 8)

Good luck.
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: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Not correct subject my email about host UP or DOWN

Post by TheWitness »

This post is giving me a headache. I've been away for a while and now I'm totally confused. Going to try to do some additional QA on the pending 0.4.4 based upon this thread.
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: Not correct subject my email about host UP or DOWN

Post by dragossto »

unfortunately i was in same position and don't have time to make update after svn
after 1 oct , i will have time to update my post after new svn and make test with them.

Have a nice weekend
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)
millhouse
Posts: 1
Joined: Tue Sep 27, 2011 6:32 pm

Re: Not correct subject my email about host UP or DOWN

Post by millhouse »

To get it to work properly, you need to make an additional change to thold/include/poller.php

Around line 309, change:

Code: Select all

$subject = read_config_option('thold_up_subject');
to the obvious:

Code: Select all

$subject = read_config_option('thold_down_subject');
The reason why clearing the web GUI's input field resulted in a correct "DOWN" message was due to the lines immediately following the bug:

Code: Select all

   if ($subject == '') {
    $subject = 'Host Error: <DESCRIPTION> (<HOSTNAME>) is DOWN';
  }
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Not correct subject my email about host UP or DOWN

Post by TheWitness »

cool.
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
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Not correct subject my email about host UP or DOWN

Post by TheWitness »

millhouse wrote:To get it to work properly, you need to make an additional change to thold/include/poller.php

Around line 309, change:

Code: Select all

$subject = read_config_option('thold_up_subject');
to the obvious:

Code: Select all

$subject = read_config_option('thold_down_subject');
The reason why clearing the web GUI's input field resulted in a correct "DOWN" message was due to the lines immediately following the bug:

Code: Select all

   if ($subject == '') {
    $subject = 'Host Error: <DESCRIPTION> (<HOSTNAME>) is DOWN';
  }
You are obviously not using:

cacti_plugins/thold/branches/stable/

Which does not have this issue.

TheWtiness
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: Not correct subject my email about host UP or DOWN

Post by dragossto »

yes don't have this issue
but have other problem
around line 344
the line

Code: Select all

$subject = str_replace('<DOWN/UP>', 'UP', $subject);
had to be

Code: Select all

$subject = str_replace('<DOWN/UP>', 'DOWN', $subject);
i post all the diff between stable from date 25.11.2011 and my modif in this thread
http://forums.cacti.net/viewtopic.php?f=17&t=36235

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 2 guests