Syed Jahanzaib Personal Blog to Share Knowledge !

November 2, 2013

Mikrotik DUDE SMS Notification !

Filed under: Mikrotik Related — Tags: , , — Syed Jahanzaib / Pinochio~:) @ 7:25 PM

1- Send SMS from Windows base DUDE using Mikrotik attached GSM Modem

2- Send SMS from Windows base DUDE using Linux Base KANNEL SMS Gateway  [updated 10th Oct 2015]


SCENARIO # 1


 

 

1- Send SMS from Windows base DUDE using Mikrotik attached GSM Modem

Assumptions:

GSM device is connected with Mikrotik for SEND/RECEIVE purposes.

DUDE is installed in another windows base PC.

As far as my research goes, there is no direct method in Dude to send SMS using DUDE own mechanism, you must have to involve / call 3rd party tool to accomplish the sms sending task. It can be windows CLI base SMS sender program like smssender.exe/gammu for win32 , sms base HTTP gateway or whatever.

You can also connect gsm device to your windows base PC, but in my scenario, my gsm device was not supported in 64 bit version of Windows 7, that’s why I had to take a long route of sending sms via mikrotik, also my mikrotik is set to receive sms to to perform various function like reboot, wan status etc , so chill 🙂 )

Now the simple task is that we want to send DUDE notification via SMS using Mikrotik GSM/Mobile device, Just in case any critical device/server goes down.

We have to configure both Mirkotik server as well as DUDE too. so first Mikrotik section.

↓

MIKROTIK Section:

First make sure you have configured your gsm/mobile device properly in mikrotik and you have tested it by sending an test SMS. Read the following article for reference.

https://aacable.wordpress.com/2012/11/22/howto-enable-mikrotik-to-sendreceive-sms-using-gsm-modem/

Also don’t forget to enable SSH service in Mikrotik as we will use ssh to execute sms send command from DUDE server.
[Note: Be careful , enabling SSH service can potentially open door for some unwanted guests/possible hackers, So better to allow only DUDE server IP for ssh access via filter rule]

.

DUDE Section:

First Download PLINK which will be used to SSH in to Mikrotik and execute send sms command on behalf of dude. click here to download plink and copy it to any folder like c:\temp\ , Also turn off File Run warning from Windows Firewall.

http://the.earth.li/~sgtatham/putty/latest/x86/plink.exe

Now at DUDE Service, on the left menu, Goto Notifications and add new one by click on + sign or right click/add.

↓

As showed in the image below . . .

↓

add-notify

Now use following details.

Name = SMS Notification

Type = Execute on Server

Command:

c:\temp\plink.exe -ssh -l admin -pw 123 192.168.1.11 "/tool sms send phone-number=03333021909 usb3 message=[Probe.Name]_on_[Device.Name]_is_now__[Service.Status]"

or as mentioned by Tarquin Douglass ,

c:\plink.exe -ssh -l admin -pw 123 x.x.x.x "/tool sms send phone-number=12345678 usb3 message=\"[Probe.Name] on [Device.Name] is now [Service.Status]\""

[Change the password + IP + mobile number + USB Port number from above command]

Make sure your device name and message have no BLANK SPACES in it, thats why I used underscore or dash.
It took me 3-4 hours just to figure out that spaces were not supported or create problems with brackets [( )]
hope this will help some one ☺

↓

As showed in the image below . . .

↓

sms-notify-image

.

From your MAP, select the device you want to monitor and receive sms alert for.
Goto POLLING , and click on USE NOTIFICATION

Now you will “SMS NOTIFICATION” , Simply Select it, and click on APPLY/OK.
As showed in image below . . .

↓

 

dude-monitor-target.

Now test it by disconnecting that target device (or for test change the IP address to some unreachable IP in target IP)
You should receive the alert on your SMS :). Do monitor the Mikrotik LOG window for the activities. also enable GSM debug so that you can aware of its activity.


 

2- Send SMS from Windows base DUDE using Linux Base KANNEL SMS Gateway [updated 10th Oct 2015]

Download WGET for windows from WGET  and Copy it in any folder of your choice. example c:\wget , you will get wget.exe in c:\wget\bin folder. Adjust it in dude notification command section accordingly…

Now in DUDE , Goto NOTIFICATIONS and add new notification as showed below …

Name: SMS
Type: Execute on SERVER
[make sure you have copied the wget file into the appropriate folder or change the location as per requirement]
Command: C:\wget\wget.exe  “http://kannel_gw_ip:13013/cgi-bin/sendsms?username=kannel&password=kannel_password&to=03333021909&text=AGP ALERT: [TimeAndDate] Service [Probe.Name] on [Device.Name] is now [Service.Status] ([Service.ProblemDescription])”

Note: Change the kannel gateway ip address, kannel authentication data, and mobile number.

As showed in the image below …

notifi

 

Now add this SMS notification to any probe of your choice, like

notific-2

End result 😀

agp_alert


 

☺

☺

Regard’s
Syed Jahanzaib

%d bloggers like this: