Hello,
i need to check if nagiosxi has smpp interface to send sms messages (notifications) to sms center through network.
i know that API and 3rd parties like isms are supported, however, what i know is that most of the monitoring systems include smpp interfaces...(sometimes optional)
smpp interface
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: smpp interface
Is this along the lines of what you were looking for?:
http://exchange.nagios.org/directory/Ad ... pp/details
http://exchange.nagios.org/directory/Ad ... pp/details
-
ahmad.zuhd
- Posts: 44
- Joined: Sun Jul 01, 2012 2:33 am
Re: smpp interface
thanks for the reply.. actually after setting the proper values at the code, i have the following error when trying to send message to any number:
Can't call method "bind_transmitter" on an undefined value at /usr/share/perl5/vendor_perl/Net/SMPP.pm line 2230.
ok the code is working now after some modification.... However the text in the message is distributed along more than one message, which is difficult to view in case many alarms received.
i'm trying to check the possibility to have the long message concatenated.
Please advice.
Can't call method "bind_transmitter" on an undefined value at /usr/share/perl5/vendor_perl/Net/SMPP.pm line 2230.
ok the code is working now after some modification.... However the text in the message is distributed along more than one message, which is difficult to view in case many alarms received.
i'm trying to check the possibility to have the long message concatenated.
Please advice.
-
ahmad.zuhd
- Posts: 44
- Joined: Sun Jul 01, 2012 2:33 am
Re: smpp interface
finally i'm able to send long sms below are the changes:
can you arrange to change the code that was created by Arsen Ghevondyan to below?
can you arrange to change the code that was created by Arsen Ghevondyan to below?
Code: Select all
#!/usr/bin/perl
use Net::SMPP;
use Data::Dumper;
$trace = 1;
$Net::SMPP::trace = 0;
$sysid = "sysid";
$pw = "password";
$host = 'ip-address';
$port = port;
$facil = 0x00010003; # NF_PDC | GF_PVCY
$dest_number = @ARGV[0];
my $mymsg = join (" ", @ARGV);
$mymsg = substr($mymsg,length($dest_number)+1,length($mymsg));
my $multimsg = 0;
if (length ($mymsg) > 128) {
$multimsg = 1;
}
#$vers = 0x34; # versionsof SMPP server
#$if_vers = 0x34;
$vers = 0x4; # versionsof SMPP server
$if_vers = 0x4;
### Connect and bind
($smpp, $resp) = Net::SMPP->new_transmitter($host,
smpp_version => $vers,
interface_version => $if_vers,
system_id => $sysid,
password => $pw,
source_addr_ton => 0x0,
source_addr_npi => 0x0,
dest_addr_ton => 0x0,
dest_addr_npi => 0x0,
system_type => '',
facilities_mask => $facil,
port => $port,
)
or die "Can't contact server: $!";
$sent_no = 0;
$origref = $ref = 0xa;
$textptr = 0;
$finished = 0;
if (length ($mymsg) > 128) {
$multimsg_maxparts = int (length ($mymsg) / 128);
if (length ($mymsg) % 128) {
$multimsg_maxparts++;
}
$multimsg_curpart = 1;
print "multimsgsparts: $multimsg_maxparts\n";
}
$msgtext = substr ($mymsg, 0, 128, "");
while (length ($msgtext)) {
if($multimsg_maxparts)
{
@udh_ar = map { sprintf "%x", $_ } $origref, $multimsg_maxparts, $multimsg_curpart;
$udh = pack("hhhhhh",0x05, 0x00, 0x03 , @udh_ar);
@array = unpack ("hhhhhh","$udh");
}
$resp = $smpp->submit_sm(
source_addr_ton =>0x05,
source_addr_npi => 0x01,
source_addr => 'Nagios',
dest_addr_ton => 0x01,
dest_addr_npi => 0x01,
destination_addr => $dest_number,
short_message => $udh . $msgtext,
esm_class=> Net::SMPP::ESM_feature_UDHI,
);
$multimsg_curpart++;
$msgtext = substr ($mymsg, 0, 128, "");
}
### warn Dumper $resp;
$resp = $smpp->unbind();
# warn Dumper $resp;
# warn "Done.";
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: smpp interface
I'm afraid I do not understand what you are asking. Plugins uploaded by other users on Nagios Exchange are not modified by us, if it needs to be changed I suggest you attempt to contact the uploader.
-
ahmad.zuhd
- Posts: 44
- Joined: Sun Jul 01, 2012 2:33 am
Re: smpp interface
Ok thanks i will do. Issue solved
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: smpp interface
Glad to hear you got it worked out. Did the uploader update the plugin?
-
ahmad.zuhd
- Posts: 44
- Joined: Sun Jul 01, 2012 2:33 am
Re: smpp interface
I have Noted that the code was an update to the original sendmessage.pl script included in the perl module NET::SMPP. (http://search.cpan.org/~sampo/Net-SMPP/SMPP.pm)
so i have updated the code as below to accept single and long sms:
where you have to update the below values in the code to match your environment:
system_id
password
host_address
port
system_type
Sender_Name
so i have updated the code as below to accept single and long sms:
where you have to update the below values in the code to match your environment:
system_id
password
host_address
port
system_type
Sender_Name
Code: Select all
#!/usr/bin/perl
use Net::SMPP;
use Data::Dumper;
$trace = 1;
$Net::SMPP::trace = 0;
$sysid = "system_id";
$pw = "password";
$host = 'host_address';
$port = port;
$facil = 0x00010003; # NF_PDC | GF_PVCY
$dest_number = @ARGV[0];
my $mymsg = join (" ", @ARGV);
$mymsg = substr($mymsg,length($dest_number)+1,length($mymsg));
my $multimsg = 0;
if (length ($mymsg) > 128) {
$multimsg = 1;
}
$vers = 0x34; # versionsof SMPP server
$if_vers = 0x34;
### Connect and bind
($smpp, $resp) = Net::SMPP->new_transmitter($host,
smpp_version => $vers,
interface_version => $if_vers,
system_id => $sysid,
password => $pw,
source_addr_ton => 0x0,
source_addr_npi => 0x0,
dest_addr_ton => 0x0,
dest_addr_npi => 0x0,
system_type => 'system_type',
facilities_mask => $facil,
port => $port,
)
or die "Can't contact server: $!";
my $range = 100;
my $random_number = int(rand($range));
$sent_no = 0;
$origref = $random_number;
#$origref = 0xa;
$textptr = 0;
$finished = 0;
print $origref . "\n";
if (length ($mymsg) > 128) {
$multimsg_maxparts = int (length ($mymsg) / 128);
if (length ($mymsg) % 128) {
$multimsg_maxparts++;
}
$multimsg_curpart = 1;
print "multimsgsparts: $multimsg_maxparts\n";
$msgtext = substr ($mymsg, 0, 128, "");
while (length ($msgtext)) {
@udh_ar = map { sprintf "%x", $_ } $origref, $multimsg_maxparts, $multimsg_curpart;
$udh = pack("hhhhhh",0x05, 0x00, 0x03 , @udh_ar);
$resp = $smpp->submit_sm(
source_addr_ton =>0x05,
source_addr_npi => 0x01,
source_addr => 'Sender_Name',
dest_addr_ton => 0x01,
dest_addr_npi => 0x01,
destination_addr => $dest_number,
short_message => $udh . $msgtext,
esm_class=> Net::SMPP::ESM_feature_UDHI,
);
$multimsg_curpart++;
$msgtext = substr ($mymsg, 0, 128, "");
}
} else
{
$resp = $smpp->submit_sm(
source_addr_ton =>0x05,
source_addr_npi => 0x01,
source_addr => 'Sender_Name',
dest_addr_ton => 0x01,
dest_addr_npi => 0x01,
destination_addr => $dest_number,
short_message => $mymsg,
);
}
### warn Dumper $resp;
$resp = $smpp->unbind();
# warn Dumper $resp;
# warn "Done.";Re: smpp interface
Hi team,
I am looking to send SMS using SMPP 3.4. I am using the script provided here, however, i encountered the same error 'Can't call method "bind_transmitter" on an undefined value at /usr/share/perl5/vendor_perl/Net/SMPP.pm line 2230' mentioned here.
Can you please guide me on this?
Thanks.
I am looking to send SMS using SMPP 3.4. I am using the script provided here, however, i encountered the same error 'Can't call method "bind_transmitter" on an undefined value at /usr/share/perl5/vendor_perl/Net/SMPP.pm line 2230' mentioned here.
Can you please guide me on this?
Thanks.