Community discussions

MikroTik App
 
MrBZA
just joined
Topic Author
Posts: 4
Joined: Fri Jun 20, 2014 11:05 pm

Netwatch permissions with global variables

Sun Jul 22, 2018 9:35 pm

Netwatch has restricted permissions so it is not able to read or write global variables, this essentially makes it useless for integrating with complex monitoring scripting.
If you want to execute a script from netwatch, it can only have ‘read’ ‘write’ ‘reboot’ 'test’ permissions. Using global variables requires the ‘policy’ permission.

I saw some workarounds to this problem on another thread that essentially scripted the functionality of netwatch in a schedule. Another used static dns entries to replace global variables.

What worked for me was to schedule a status monitor for netwatch:
:global nwstatus  [/tool netwatch get [find comment="my netwatch host comment"] status]
This will be "up" or "down"

Hope it helps and if you have a better way, please share!
 
monfi
just joined
Posts: 5
Joined: Thu May 26, 2016 6:00 am

Re: Netwatch permissions with global variables

Wed Jul 24, 2019 5:51 pm

Thanks friend with this script reference, i did could write my own script in order to read state of an UPS! Kindly regards! from Loja,Ecuador, Latin America
 
User avatar
chechito
Forum Guru
Forum Guru
Posts: 2990
Joined: Sun Aug 24, 2014 3:14 am
Location: Bogota Colombia
Contact:

Re: Netwatch permissions with global variables

Fri Jul 02, 2021 7:27 am

Netwatch has restricted permissions so it is not able to read or write global variables, this essentially makes it useless for integrating with complex monitoring scripting.
If you want to execute a script from netwatch, it can only have ‘read’ ‘write’ ‘reboot’ 'test’ permissions. Using global variables requires the ‘policy’ permission.

I saw some workarounds to this problem on another thread that essentially scripted the functionality of netwatch in a schedule. Another used static dns entries to replace global variables.

What worked for me was to schedule a status monitor for netwatch:
:global nwstatus  [/tool netwatch get [find comment="my netwatch host comment"] status]
This will be "up" or "down"

Hope it helps and if you have a better way, please share!

very useful tip

thank you

Who is online

Users browsing this forum: A9691 and 23 guests