help with syslog email alerts

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Kriegsmarine
Posts: 14
Joined: Tue Jul 10, 2007 3:05 pm

help with syslog email alerts

Post by Kriegsmarine »

I have finally managed to put my haloe plugin working. But I created some rules for notification and I just dont get the emails..

how does the notification works? I use the SMTP function of thold to get emails delivered and thats the only way it will work here

any advice??
Kriegsmarine
Posts: 14
Joined: Tue Jul 10, 2007 3:05 pm

Post by Kriegsmarine »

ALSO, when I click on the GO button for searching logs, it gives me a page not found...

any clues?
Kriegsmarine
Posts: 14
Joined: Tue Jul 10, 2007 3:05 pm

Post by Kriegsmarine »

any help would be welcome....
Kriegsmarine
Posts: 14
Joined: Tue Jul 10, 2007 3:05 pm

Post by Kriegsmarine »

is there any LOG we can see if an email was generated??? i looked for it but couldnt find anything to start looking...
Ahuber
Cacti User
Posts: 59
Joined: Thu Nov 16, 2006 1:57 pm
Location: BC, kootenays

Post by Ahuber »

I have the same problem, but I haven't researched it enough to find an answer....




----------
PHP Network Weathermap (weathermap - v0.92)
Thresholds (thold - v0.3.0)
Device Monitoring (monitor - v0.7)
Network Discovery (discovery - v0.6)
Network Tools (tools - v0.2)
Syslog Monitoring (haloe - v0.4)
mactrack
RRD Cleaner (rrdclean - v1.1)
Update Checker (update - v0.3)
FlowView (flowview - v0.3)
Host Info (hostinfo - v0.1)
Error Images (errorimage - v0.1)
report it! (ReportIt - v0.4.2)
Create Aggregate Graphs (aggregate - v0.62)
Kriegsmarine
Posts: 14
Joined: Tue Jul 10, 2007 3:05 pm

Post by Kriegsmarine »

yeah I think no one uses this feature.....
I can create rules for removal, and it works, but for aleting......no good
socain
Posts: 12
Joined: Tue Jul 24, 2007 8:49 am
Location: Florida, USA

Sendmail

Post by socain »

You can edit sendmail config to send to a smart host to relay the messages. (/etc/mail/sendmail.cf)

# "Smart" relay host (may be null)
DSmail.bellsouth.net

you will have to uncomment the above line and ensure DS is before your smtp relay, as shown above.

Just got it working today after some reading up on sendmail.


You may be able to edit the /var/www/html/cacti/plugins/haloe/class.smtp.php file to send directly to your isp by chagning some variables. Didn't try it though.
Kriegsmarine
Posts: 14
Joined: Tue Jul 10, 2007 3:05 pm

Post by Kriegsmarine »

thanks, I'll try to edit the smtp file, as I have SMTP server on my network and I must use this one
Kriegsmarine
Posts: 14
Joined: Tue Jul 10, 2007 3:05 pm

Post by Kriegsmarine »

can someone tell me what to change in class.smtp ??? that would be very very helpful

thanks!
socain
Posts: 12
Joined: Tue Jul 24, 2007 8:49 am
Location: Florida, USA

Post by socain »

I know very little about php but just by looking at it I would think that you could change the $host, variable.... in the class.smtp file section:

function Connect($host,$port=0,$tval=30) {
# set the error val to null so there is no confusion
$this->error = null;

to

function Connect($host=yourmailserver,$port=0,$tval=30) {
# set the error val to null so there is no confusion
$this->error = null;


Also if you use the sendmail option (send to smart host in the above post) you can have it forward to your internal smtp server as well. I have mine forwarding to an internal Exchange server.

Let me know if it works!
Kriegsmarine
Posts: 14
Joined: Tue Jul 10, 2007 3:05 pm

Post by Kriegsmarine »

I'll try tnks
DrivesMeCrazy
Posts: 30
Joined: Sat Apr 28, 2007 3:57 am

Post by DrivesMeCrazy »

I am using smtp in my Windows environment, and I looked at haloe's php files.
These are the file I see need to update, but I still can't send email.
Any ideas?

class.phpmailer.php

Code: Select all

...
/**
     * Method to send mail: ("mail", "sendmail", or "smtp").
     * @var string
     */
    //var $Mailer            = "mail";
    var $Mailer            = "smtp";
...
/**
     *  Sets the SMTP hosts.  All hosts must be separated by a
     *  semicolon.  You can also specify a different port
     *  for each host by using this format: [hostname:port]
     *  (e.g. "smtp1.example.com:25;smtp2.example.com").
     *  Hosts will be tried in order.
     *  @var string
     */
    //var $Host        = "localhost";
	var $Host        = "192.168.0.1";
...
class.smtp.php (optional) - value of $host should be defined in class.phpmailer.php's $Host

Code: Select all

...
function Connect($host="192.168.0.1",$port=25,$tval=30) {
...
DrivesMeCrazy
Posts: 30
Joined: Sat Apr 28, 2007 3:57 am

Post by DrivesMeCrazy »

Hi guys,

below are additional info I found out about SMTP.

If using smtp, also need to change $mail->IsMail() to $mail->IsSMTP().
haloe's functions.php

Code: Select all

function syslog_mail_alerts($to, $from, $subject, $message) {
...
//$mail->IsMail();                                      // set mailer to use PHPMailer
$mail->IsSMTP();  
...
I created a smtptest php script to call syslog_mail_alerts() function in haloe_alert.php.
smtptest.php (placed this in haloe's directory

Code: Select all

<?php
$to="test@local.com";
$from="test@local.com";
$subject="Testing in Progress...";
$message="Test 123";

chdir('../../');
include_once("plugins/haloe/functions.php");
syslog_mail_alerts($to, $from, $subject, $message);
If everything works fine. You should received a test email.

Now the problem is I still don't get how haloe send out alert email after examine the code.
No where I see is calling the syslog_mail_alerts() function.
Anybody got an idea? :-?
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

I have a new version that will be out shortly which corrects all known issues (uses settings plugin for sending emails).
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

Hi

I think I have found the problem for some of people like me. Instead to insert the trap in the syslog_incoming table we have insert it directly in the syslog .....
I will update my "syslogupd" in order to fill the incoming table (in few days).
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests