Global Variables

Whilst following the How-to to send an email when a connected UPS goes on battery, I noticed the actual checking of the UPS state is accomplished by checking the value of $on-battery. Is this value set by RouterOS and if so, is there a list somewhere of other global variables that are set up by the system?

Thanks.

:environment print

Regarding the $on-battery variable: I’ve not seen this script, but most likely the variable was explicitly set somewhere before.

[admin@MT] > :environment print
Global Variables
Local Variables
[admin@MT] >

???

The script is here:

http://www.mikrotik.com/docs/ros/2.8/howto/howto

Scroll down to “How to Configure Router to Send E-mails When Power Failure has Occured?”

The value of $on-battery is not set in the script.

This local variable is set automatically by monitor command.

/system ups monitor once do {:environment print}

Eugene

a similar question: why global variables are not global variables?

They are global, you need to declare them before accessing, read this:
https://wiki.mikrotik.com/wiki/Manual:Scripting#Variables