SNMP and SMS

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
User avatar
cyrill
Cacti User
Posts: 271
Joined: Fri Jan 25, 2008 8:43 am
Location: California - USA

SNMP and SMS

Post by cyrill »

Hello everybody !

I've a cacti install with PA, settings and thold.

My configuration of Thold is ok. (I can create treshold and I received alert by mail)

Now, I want to send sms alert ! I still have the Sms gateway and it's configured (I use PageGate) but I don't know how can I get alerts from thold for my Sms server...

do you have a solution or idea ?

thanks for your help
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Moving to the Thold forum.
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
User avatar
cyrill
Cacti User
Posts: 271
Joined: Fri Jan 25, 2008 8:43 am
Location: California - USA

Post by cyrill »

there are still a topic ???
liveder
Posts: 10
Joined: Mon Dec 10, 2007 6:16 am
Contact:

Post by liveder »

I've got sms gateway too. So... what have i done:
1). i've change the style of sending e-mails, eg:
To: gateway@lala.com
Subj: (phones of users, who is watching over threshold).
Mess: real subject.

But, my problem is:
I can't make a threshold, which alerts me, when host is down.
so, if the host is down, thold can't get current value.
if i create threshold which pings server, sets high Threshold to 10000 and low Threshold to 0... and host is down... it shows only the last succesful ping....
User avatar
cyrill
Cacti User
Posts: 271
Joined: Fri Jan 25, 2008 8:43 am
Location: California - USA

Post by cyrill »

Hello LiveDer !

Can you explain me how do you make for sending alerts from Thold to your SMS gateway ??? please

thanks
liveder
Posts: 10
Joined: Mon Dec 10, 2007 6:16 am
Contact:

Post by liveder »

As i said:
1). i've got a script, which parses e-mails, and sends them thru gsm modem.
2). in function thold_mail
i've change the format of sending e-mails:
to: gateway
subject: phone numbers of people(i've change email field in user profile, renamed it to phone number, so, now i've got that field)
msg: old subject is here
3). than, in threshold there's a field:
Notify accounts
This is a listing of accounts that will be notified when this threshold is breached.
so, i select users and...

but... that can work only, if you can make alerts work fine, cause, i can't make threshold to notify me, if host is down.
"Unix - Ping" starts in poller only, if host is up.. if it's down.. it won't start, so, in thold can't trigger it.. any ideas about it?
User avatar
cyrill
Cacti User
Posts: 271
Joined: Fri Jan 25, 2008 8:43 am
Location: California - USA

Post by cyrill »

where can you change the thold_mail function ???
liveder
Posts: 10
Joined: Mon Dec 10, 2007 6:16 am
Contact:

Post by liveder »

plugins\thold\thold_functions.php
User avatar
cyrill
Cacti User
Posts: 271
Joined: Fri Jan 25, 2008 8:43 am
Location: California - USA

Post by cyrill »

ha ok thanks ! I find the function ! Can you past your modifications ???
liveder
Posts: 10
Joined: Mon Dec 10, 2007 6:16 am
Contact:

Post by liveder »

errr.. something like that =)

Code: Select all

        if ($to == '')
                return "Mailer Error: No <b>TO</b> address set!!<br>If using the <i>Test Mail</i> link, plea
        $to = explode(',', $to);
        $subject = $to;
        $fp = fopen("/usr/local/www/apache22/data/plugins/thold/logging", "a+");
        $log_date=date("H:i:s");
        fwrite($fp, "$log_date\nThis is a new message:\n");
        fwrite($fp, "Was message:\n\nto: $to\nfrom: $from\nsubject: $subject\nmsg: $message\n\n");

//      foreach($to as $t) {
//              if (trim($t) != '' && !$Mailer->header_set("To", $t)) {
//                      print "ERROR: " . $Mailer->error() . "\n";
//
//                      return $Mailer->error();
//              }
//      }
        $to='gateway@gate.com';
        fwrite($fp, "New TO: $to\nNew Subject: ");
//      foreach($subject as $s) {$new_sbj.=$s.",";};
        $new_subj=implode(",",$subject);
        $subject=$new_subj;
        fwrite($fp, "$new_subj\nNew message: $message\n\n\n");
        $Mailer->header_set("To", 'a.zheleznov@chtp.net');
        $wordwrap = read_config_option("settings_wordwrap");
        if ($wordwrap == '')
                $wordwrap = 76;
        if ($wordwrap > 9999)
                $wordwrap = 9999;
        if ($wordwrap < 0)
                $wordwrap = 76;
but there's a fwrite function, which logs messages in /usr/local/www/apache22/data/plugins/thold/logging
User avatar
cyrill
Cacti User
Posts: 271
Joined: Fri Jan 25, 2008 8:43 am
Location: California - USA

Post by cyrill »

ha ok I see.

your sms gateway is a personal server or it's a professionnal server telecom ? How can you parse mails ?
liveder
Posts: 10
Joined: Mon Dec 10, 2007 6:16 am
Contact:

Post by liveder »

personal server =)
User avatar
cyrill
Cacti User
Posts: 271
Joined: Fri Jan 25, 2008 8:43 am
Location: California - USA

Post by cyrill »

and what server do you uses ??? Me, I use pageGate but I don't now if it's work with your solution.
liveder
Posts: 10
Joined: Mon Dec 10, 2007 6:16 am
Contact:

Post by liveder »

selfmade script, which parses e-mails and sends them to gsm modem =)
User avatar
cyrill
Cacti User
Posts: 271
Joined: Fri Jan 25, 2008 8:43 am
Location: California - USA

Post by cyrill »

and it's hard to build this script for parsing e-mail ?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests