Sending SMS Alerts using SMPP Bind along with Email Alerts.

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
mohits
Posts: 9
Joined: Wed Jun 06, 2007 6:48 pm
Location: Lagos
Contact:

Sending SMS Alerts using SMPP Bind along with Email Alerts.

Post by mohits »

Dear All,

I have found a way to send SMS alerts on any Threshhold Breach from cacti along with Email alerts. You need to have an user account on any service provider SMSC so that you can establish SMPP bind.

Attached are two files 'SMPP.php' and 'thold_functions.php'. You need to place these files in your //cacti/plugins.thold/ directory. 'SMPP.php' is the class file for SMPP bind.
I have modified the original 'thold_function.php' file with the below lines inserted in evert If loop where it is trying to trigger the email function.
PS:you need to change the extension of the attached files to .php instead of .txt
---------------------------
//print "<pre>";
require_once "smpp.php";
$tx=new SMPP("SMSC IP",SMSC PORT);
//$tx->debug=true;
$tx->system_type="WWW";
$tx->addr_npi=1;
//print "open status: ".$tx->state."\n";
$tx->bindTransmitter("Username","Password");
$tx->sms_source_addr_npi=1;
//$tx->sms_source_addr_ton=1;
$tx->sms_dest_addr_ton=1;
$tx->sms_dest_addr_npi=1;
$tx->sendSMS("2000","Mobile Number",$subject);
$tx->close();
unset($tx);
---------------------------------
You need to replace 'SMSC IP', 'SMSC PORT','Username','Password', 'Mobile Number' with the actual values for you.

This script will always send the subject line of the email alret as SMS to the programmed mobile number.

Enjoy!!

Mohit C. Saxena
Sr. Network Architect
Starcomms PLC
hcl_msaxena@yahoo.com

Note: Use of the above method and attached file doesn't guarantee to work for all. The author of this post bears no liability of any loss/harm arising out of use of the above method and files.
Attachments
smpp.php.txt
(10.12 KiB) Downloaded 1346 times
thold_functions.php.txt
(38.21 KiB) Downloaded 1547 times
archana
Posts: 5
Joined: Tue Mar 03, 2009 4:54 am

Post by archana »

its coming a error like "syntax error, unexpected T_STRING in line 151 thold_function.php" :(
mohits
Posts: 9
Joined: Wed Jun 06, 2007 6:48 pm
Location: Lagos
Contact:

Error on Line 151

Post by mohits »

Hello Archana,

Can you please open the tholdfunction.php file in a text editor and let me know what you have on line number 151 ??
I believe there is a small syntax error there which might have crept into while editing the file.
Else you may email me that file on hcl_msaxena@yahoo.com

br,

Mohit
tracky2007
Posts: 34
Joined: Thu Dec 27, 2007 3:07 am

Post by tracky2007 »

the 151 line is:
$tx=new SMPP('SMSC IP',SMSC PORT);

and errors comes:
Parse error: syntax error, unexpected T_STRING in /usr/local/apache/htdocs/cacti/plugins/thold/thold_functions.php on line 151
mohits
Posts: 9
Joined: Wed Jun 06, 2007 6:48 pm
Location: Lagos
Contact:

Error on Line 151

Post by mohits »

Dear Tracky,

you need to replace ('SMSC IP', SMSC PORT) with a valid value like
('10.18.19.1',5018);

and ensure rechability of your cacati server to the smsc on the specified port and it will work.

br,

Mohit
abhilash
Posts: 1
Joined: Wed Sep 30, 2009 2:17 am
Location: Chennai
Contact:

want to know about cacti server

Post by abhilash »

i want to know more about Cacti server.and also about the location of the path cacti/plugins.thold/directory.smpp.php..
dami1111
Posts: 2
Joined: Wed Sep 01, 2010 6:19 am

Post by dami1111 »

1. Podany tylko numer telefonu usługi SMSC - czy dzięki tej funkcji będzie możliwa wymiana informacji?
2. Operator generuje certyfikat dostępu do usługi.

Jakieś pomysły?
dami1111
Posts: 2
Joined: Wed Sep 01, 2010 6:19 am

Post by dami1111 »

1st Only enter the SMSC phone number service - do with this function will be possible to exchange information?
2nd The operator generates a certificate of service.

Any ideas?
mosiausi
Posts: 14
Joined: Thu Mar 03, 2011 3:02 am

Re: Sending SMS Alerts using SMPP Bind along with Email Aler

Post by mosiausi »

Hi,

after i entered the values, i get this message:


Fatal error: Call to undefined function thold_initialize_rusage() in /www/htdocs/cacti/plugins/thold/thold_graph.php on line 37
thekids
Posts: 1
Joined: Wed Sep 28, 2011 1:18 am

Re: Sending SMS Alerts using SMPP Bind along with Email Aler

Post by thekids »

i'm not really understand about it.

ho to find the SMSC IP and SMSC PORT.

if I'm install in laptop (localhost) for testing, can i use IP Address localhost became SMSC IP and use port 80,

and how about username and password, this is username and password database.

thank very much for your kind information, i'm sorry cause still newbie

regard,
thekids
User avatar
pizu
Posts: 42
Joined: Thu Nov 17, 2011 5:15 pm

Re: Sending SMS Alerts using SMPP Bind along with Email Aler

Post by pizu »

Hi,

is it possible to use a group that is created in cacti .. and even better more then 1 group? instead of a mobile number in the code?

Thanks
Regards,
Pizu
rovshango
Posts: 11
Joined: Tue Feb 10, 2015 3:56 am

Re: Sending SMS Alerts using SMPP Bind along with Email Aler

Post by rovshango »

Check this files. Works perfectly for me!
Attachments
thold_functions.php.txt
(122.62 KiB) Downloaded 274 times
class.smpp.php.txt
(4.68 KiB) Downloaded 274 times
User avatar
pizu
Posts: 42
Joined: Thu Nov 17, 2011 5:15 pm

Re: Sending SMS Alerts using SMPP Bind along with Email Aler

Post by pizu »

rovshango wrote:Check this files. Works perfectly for me!
Hey,

This worked perfect for me too, now my provider changed few settings and i need to add the TON/NPI settings, is this possible?

Thanks,
Regards,
Pizu
User avatar
pizu
Posts: 42
Joined: Thu Nov 17, 2011 5:15 pm

Re: Sending SMS Alerts using SMPP Bind along with Email Aler

Post by pizu »

managed :) found settings in the smpp config and changed them. now am trying to add this script for the monitor plugin.
Regards,
Pizu
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest