Sending SMS Alerts using SMPP Bind along with Email Alerts.
Moderators: Developers, Moderators
Sending SMS Alerts using SMPP Bind along with Email Alerts.
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.
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
Error on Line 151
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
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
-
- Posts: 34
- Joined: Thu Dec 27, 2007 3:07 am
Error on Line 151
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
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
want to know about cacti server
i want to know more about Cacti server.and also about the location of the path cacti/plugins.thold/directory.smpp.php..
Re: Sending SMS Alerts using SMPP Bind along with Email Aler
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
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
Re: Sending SMS Alerts using SMPP Bind along with Email Aler
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
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
Re: Sending SMS Alerts using SMPP Bind along with Email Aler
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
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
Pizu
Re: Sending SMS Alerts using SMPP Bind along with Email Aler
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
Re: Sending SMS Alerts using SMPP Bind along with Email Aler
Hey,rovshango wrote:Check this files. Works perfectly for me!
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
Pizu
Re: Sending SMS Alerts using SMPP Bind along with Email Aler
managed found settings in the smpp config and changed them. now am trying to add this script for the monitor plugin.
Regards,
Pizu
Pizu
Who is online
Users browsing this forum: No registered users and 1 guest