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

21 Comments »

  1. Assalaam u alaikum Sir i hope you are fine as well

    i have need training for mikrotik.

    On Sat, Nov 2, 2013 at 3:25 PM, Syed Jahanzaib Personnel Blog to Share

    Like

    Comment by Comnet_Solution — November 4, 2013 @ 5:33 AM

  2. Just an update, the reason it will not work with spaces is because the message needs to be surrounded by quotes like this: 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]\””

    Like

    Comment by Tarquin Douglass — December 11, 2013 @ 9:12 AM

  3. Hi Syed, i’m trying to get the functions works for voltage device. I got the function, and it shows me on the devices on screen the correct voltage. I want to notify me whenever a voltage goes down threshold. How can i show the variable Voltage in the email fields? Actually i have in the email object: Service [Probe.Name] on [Device.Name] is now [Service.ProbeInterval] but i want to show the voltage value. This is the voltage function: oid(“iso.org.dod.internet.private.enterprises.mikrotik.mikrotikExperimentalModule.mtXRouterOs.mtxrHealth.8.0”)/10

    Please can you help me?
    Best Regards!

    Like

    Comment by Paolo — June 14, 2014 @ 3:12 PM

  4. Mikrotik Compatible 3g modem available for SMS Call 0312-8642411

    Like

    Comment by Umair — October 26, 2014 @ 7:25 PM

  5. hello, and thanks for your description, i have installed everything as per your recommendation, and if i test this line though the command prompt om windows 7, i get the sms from the mikrotik router C:\temp\plink.exe -ssh -l admin -pw XXXXXXXX 192.168.1.3 “/tool sms send phone-number=40107602 usb3 message=hello but when i make a new notification in the dude as type “execute on server” and insert the exact same line, and press test, nothing happens, in the mikrotik log i can see that it doesn’t get the command when using the dude, but when sending the same command from command prompt it shows up in the log, it seems that the dude, isn’t passing the command though correctly, i have tried to disable firewall in windows , but that doesn’t help?

    any help would appreciated

    Sincerely

    Carsten Larsen
    Denmark

    Like

    Comment by Carsten Larsen — December 29, 2014 @ 9:56 PM

    • @Carsten Larsen, use EXECUTE LOCALLY

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — December 30, 2014 @ 8:27 AM

      • Hello Sayed Jahanzaib. A lot of your configuration sample has really helped. On this particular one (SMS notification from Dude) I have the same experience like Carston (above), I changed from execute of server to execute locally, but the command doesn’t get to the Mikrotik hosting the Modem.

        Sincerely Nurudeen

        Like

        Comment by Nurudeen — March 7, 2015 @ 5:33 PM

  6. I finally resolved the problem. Its the way the command was formatted. I simply copied your pasted and edited the user+password+IP+phone number. Once again thanks a lot.

    Like

    Comment by Nurudeen — March 7, 2015 @ 6:10 PM

  7. Hi Sayed, Do you have any SMS Web Gateway services in your country. If yes then you should buy some SMS credits and integrate it with DUDE its works excellent. I have deployed it. Disadvantage of sending SMS through Modem is that its very slow. If you have 15 Recepients and if the link flaps it will get busy for 15Minutes as it uses first in first out mechanism where as SMS Web Gateway can send send all 15 at a single go.

    Like

    Comment by Samir Sawant — May 5, 2015 @ 5:33 PM

    • For heavy commercial network, one should must get commercial sms gateway services for sure. But usually its not financially suitable for a smaller network. Let me give local example.
      In my country, SMS are really really cheap. I can buy 100,000 sms for whole year in just 7$. So its pretty cheap to ahve your own gateway. Also you can do heavy customization if you have your gateway. An Example is here …

      Fun With SMS Management System [playSMS]

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — May 8, 2015 @ 4:41 PM

      • I would use an SMS gateway service, most unfortunately for structure I have in my company I have some disadvantages, for my company to be located in the state of Amazonas, Brazil, Amazon Rainforest, the only way we found to bring internet to our city was through ptp network, link, several repeaters along the way, so if one of these repeaters lose communication or fail, I will not have internet in my town, and I do not have internet, as will send sms? remembering that mobile operators in my town has a very poor mobile service, and may not use them either for this service, so the only alternative I have this script and it’s here in the forum, more in my case I could not make it work .

        Like

        Comment by ALEX CAMPOS — May 8, 2015 @ 5:57 PM

  8. Personally, I could not make it work not put the modem in mikrotik, and enter the settings and the command line in the dude, most did not work, can anyone help me?

    Like

    Comment by ALEX CAMPOS — May 6, 2015 @ 5:47 PM

    • i have mine working, on a windows 7 machine, with a mikrotik with an usb modem and a 3g sim card, i did take some tweaking for the script to work

      Like

      Comment by Carsten Larsen — May 8, 2015 @ 4:46 PM

      • Okay my friend, I’m working on it a day and so far nothing tested to a script by telnet to another friend made for me, but does not work, the integration between the dude for mikrotik, will not, within the mikrotik I I can send an sms, more when I go to the dude for sending sms by the script that’s here in the forum, it will not. I’m sorry for the English, I am Brazilian and I can not speak English, so I used a translator on line. I’ll be waiting for a response from you or if anyone knows. Thank you for your attention.

        Like

        Comment by ALEX CAMPOS — May 8, 2015 @ 5:42 PM

  9. some new friends?

    Like

    Comment by ALEX CAMPOS — May 20, 2015 @ 7:00 PM

  10. Hi,

    I subscribed to blog because your numerous tools have been so helpful.

    I have use the plink with dude for sms alert and it working well. But is there a way to send sms to multiple phone numbers

    Thank you

    Nurudeen

    Like

    Comment by Nurudeen — January 26, 2016 @ 12:58 PM

  11. syed hello , I was trying the new dude 6 , I do not know how to set sms allert , you could create a guide to set it up ?

    Like

    Comment by antonino — January 31, 2016 @ 1:45 PM

  12. Hello,
    First of all, great post.
    I am trying to send SMS from Windows base DUDE using Linux Base KANNEL SMS Gateway, but I am not sure about some parameters.

    How to find kannel gateway ip address, kannel authentication data?

    Like

    Comment by Nikola — February 10, 2016 @ 6:20 PM

  13. […] via Mikrotik DUDE SMS Notification ! — Syed Jahanzaib Personal Blog to Share Knowledge ! […]

    Like

    Pingback by Mikrotik DUDE SMS Notification ! — Syed Jahanzaib Personal Blog to Share Knowledge ! – Ever Smile IT — November 3, 2016 @ 12:20 AM


RSS feed for comments on this post. TrackBack URI

Leave a comment