Monthly Archives: June 2019

Reconfigure Hyper-V replica replication interval

I like the feature of Hyper-V replica – but sometimes if you are configuring it quickly you might fail to set the right replication interval (by default 5 minutes). There is a possibility in PowerShell to change the interval so for example if you have configured your replication to happen every 5 minutes and you want to change that to 30 seconds you can do it by using this cmdlet (this one will change all current replicas to 30 seconds – you can do it for individual replication also):

Get-VMReplication | Set-VMReplication -ReplicationFrequencySec 30




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=

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!

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:

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


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:

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 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 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 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 subject=”Host x.x.x.x Up” body=”Host x.x.x.x Up! Up!”;}
:tool netwatch enable numbers=0