Community discussions

MikroTik App
 
GJS
Member
Member
Topic Author
Posts: 418
Joined: Sat May 29, 2004 4:07 pm
Location: London

Global Variables

Sat Apr 02, 2005 4:23 am

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.
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 986
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Sun Apr 03, 2005 2:12 pm

:environment print
Regarding the $on-battery variable: I've not seen this script, but most likely the variable was explicitly set somewhere before.
 
GJS
Member
Member
Topic Author
Posts: 418
Joined: Sat May 29, 2004 4:07 pm
Location: London

Mon Apr 04, 2005 1:56 am

[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.
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 986
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Mon Apr 04, 2005 2:12 pm

This local variable is set automatically by monitor command.
/system ups monitor once do {:environment print}
Eugene
 
pidybi
just joined
Posts: 5
Joined: Wed Nov 25, 2015 11:02 pm

Re: Global Variables

Wed Feb 10, 2021 2:41 pm

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

Image
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7041
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Global Variables

Wed Feb 10, 2021 4:52 pm

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

Who is online

Users browsing this forum: Egate, GoogleOther [Bot] and 19 guests