Category Archives: Utility

Sending SMS using Infobip service and MikroTik tool / fetch feature

My recent article related to enhancement of Netwatch feature in MikroTik was created as a prerequisite for a simple alerting solution with e-mail / SMS notifications channels.

I am using Infobip SMS platform and they have clear and simple API solution (nicely documented) for sending SMS messages (I was able to make it work from Powershell – documented here.).

I was searching a bit and I saw that MikroTik changed something in the way tool called fetch works when we need to send header fields – as it can be read here, here and in official documentation here.

The working command – tested on MikroTik with RouterOS 6.44.3 (june 2019) is:

/tool fetch http-method=post mode=https http-header-field=”content-type:application/json,Authorization:Basic key23123832″ http-data=”{ \”from\”:\”MyMonitoring\”, \”to\”:[\”386xxyyyzzz\”], \”text\”:\”HOST x.x.x.x DOWN\”}” url=https://api.infobip.com/sms/1/text/single

So – the important thing to point out is the way you provide http-header-field:
http-header-field=”content-type:application/json,Authorization:Basic key23123832″

Hope it helps!

Advertisements

MikroTik – Netwatch enhanced (updated June 2019)

With MikroTik one can create an excellent e-mail / SMS alerting system when a host goes down or returns up.
In Tools there is Netwatch feature – but it has one disadvantage – it triggers “up” or “down” commands / scripts – but sometimes one missed ping does not mean that the host is permanently offline / online. Because of that I have written a script that can extend the ping checks (in my example for another 10 seconds – after first ping failed (triggered by Netwatch)) and only after being absolutely sure that host is offline or online triggers an event – e-mail message or SMS message (using some SMS gateway – covered in this article).

As you can see scripts can successfully handle event when host goes offline and when it comes online again:
example

Scripts can also handle “flapping host” (host going down and returning up in less then 10 seconds) behavior:

example2

What do you need to setup such monitoring system:
1. Tools / Netwatch – create two entries for same host:
example 3

2. System / Scripts – you will need to create two scripts – for down and up events:
scripts

on-down – script:
:log error message=”Host x.x.x.x is down! Disabling Netwatch host down monitoring – taking over with script on-down – checking reachability of host x.x.x.x each second for ten seconds!”
:tool netwatch disable numbers=0
:local countup value=0
:while (($countup < 10) && ([:ping address=x.x.x.x interval=1 count=1]=0)) do={:set countup value=($countup+1); :delay 1000ms; :log error message=”Host x.x.x.x is offline. Check number: $countup” };
:if ($countup < 10) do={:log warning message=”Host x.x.x.x online again in less than ten seconds/checks – up on check number: $countup. Enabling netwatch.”; :tool netwatch enable numbers=0; :tool e-mail send to=my.email@gmail.com subject=”Host Up after $countup” body=”Host Up after $countup”; } else={:log error message=”After ten seconds/checks host x.x.x.x is still offline – probably there is an major issue/outage – sending e-mail/SMS.”; :tool e-mail send to=my.email@gmail.com subject=”Host x.x.x.x Down” body=”Host x.x.x.x Down! Host x.x.x.x Down!”;}
:tool netwatch enable numbers=1

on-up – script:
:log warning message=”Host x.x.x.x is up! Disabling Netwatch host up monitoring – taking over with script on-up – checking reachability of host x.x.x.x each second for ten seconds!”
:tool netwatch enable numbers=0
:local countdown value=0
:while (($countdown < 10) && ([:ping address=x.x.x.x interval=1 count=1]=1)) do={:set countdown value=($countdown+1); :delay 1000ms; :log warning message=”Host x.x.x.x is online. Check number: $countdown” };
:if ($countdown < 10) do={:log error message=”Host x.x.x.x offline again in less than ten seconds/checks – down on check number: $countdown. Enabling netwatch monitoring.”; :tool netwatch enable numbers=1; :tool e-mail send to=luka@manojlovic.net subject=”Host x.x.x.x Down after $countup” body=”Host x.x.x.x Down after $countup”; } else={:log warning message=”After ten seconds/checks host x.x.x.x is still online – probably everything is ok – sending e-mail/SMS.”; :tool e-mail send to=luka@manojlovic.net subject=”Host x.x.x.x Up” body=”Host x.x.x.x Up! Up!”;}
:tool netwatch enable numbers=0

 

The Greenbow IPSec VPN client

I was searching Google for an “universal” IPSec VPN client for Windows and I passed by website http://www.thegreenbow.com. I decided to give a try to their product called TheGreenBow IPSec VPN Client. I saw that they have also a mobile version but I need VPN client for my laptop so I decided to try this first.

I was impressed by simple installation and ease of use… I decided to write a short article and to attach some screenshots for you to see how simple it is to create / configure VPN tunnels with The Greenbow VPN Client.

Another great thing is that they have configuration examples for gateways on their website. If you are using let say Zyxel routers/firewalls/VPN gateways or let say m0n0wall VPN gateway just follow the examples on http://www.thegreenbow.com/vpn_gateway.html

Check my overview:
The Greenbow VPN client overview.docx
The Greenbow VPN client overview.pdf

NT Backup notification sender configuration utility

If you want to get NT Backup logs to your mailbox you can take advantage of IIS SMTP pickup folder or Exchange pickup folder installed on your server. Pickup folder “grabs” generated mail message and sends it to the address. This utility allows you to create VBS and BATch file that you need to complete this action. You just need to run the utility and then to schedule BATch file. If you would like to change something you can do it as the source is published. / Ce zelite poročila (log datoteke) programa NT backup poslati na vaš e-mail naslov lahko izkorstite IIS-evo SMTP pickup mapo ali pickup mapo vasih Exchange streznikov (2000, 2003, 2007). Iz Pickup folder-ja SMTP servis “pograbi” zgenerirano mail datoteko in jo nato dostavi na elektronski naslov. Moje orodje omogoca izdelavo VBS in BATch datoteke, ki pripravita vse potrebno za izvršitev takšne akcije. Po tem, ko zaženete orodje in izdelate konfiguracijski datoteki pripravite scheduled task s katerem ob določeni uri poganjate BATch datoteko. Ce zelite v programu kaj spremeniti to lahko naredite, saj je poleg izvršilnega programa (.exe) objavljena tudi izvorna koda.

NTBackup-NSCU.exe – Executable

NTBackup-NSCU.zip – Source code (Microsoft C# Express)

Velikost map v raziskovalčevem oknu Windows2000/XP/2003 / Map size in explorer window Windows2000/XP/2003

Velikokrat se zgodi, da bi rad pregledal velikosti map kar v raziskovalčevem oknu. Še posebej je ta primer izrazit pri “Users shared folders” na strežniku, kjer bi radi enostavno ugotovili kateri uporabnik zasede na strežniškem diskovju največ prostora. !!!Pozor, ne instalirajte programske opreme na streznik temveč na eno od delovnih postaj. In prej preberite rubriko “Known issues!”!!! / It happens sometimes that you would like to know the size of folders directly from explorer window. My experience is that I am sometimes curious to see which user uses most server disk space in “Users shared folders” on server. I suggest to try the folowing software – for me, it worked perfectly. !!!Do not install it directly on server – install it on a workstation. And first read “Known issues!”!!!

http://foldersize.sourceforge.net/