Feature Request (improvement)
BETA Testing and Feature Suggestions for the next RouterOS release (ROS v7)

12 posts   •   Page 1 of 1
User avatar
Belyivulk
Member Candidate
Member Candidate
 
Posts: 279
Joined: Mon Mar 06, 2006 11:53 pm
Location: Whangarei, New Zealand

Feature Request (improvement)

by Belyivulk » Wed May 10, 2006 12:55 pm

What would be useful (nice) and im not sure it exists, when a client with a MT router shuts down the router, or if the router looses power when it comes back up an event message sent back to the log of the AP its connecting too explaining if it were power outage, deliberate shutdown, lost wireless, or whatever the case may be. Helps to diagnose faults.

User avatar
cmit
Forum Guru
Forum Guru
 
Posts: 1551
Joined: Fri May 28, 2004 12:49 pm
Location: Germany

by cmit » Wed May 10, 2006 1:10 pm

You already have a log entry in the clients' log stating "unclean reboot because of power failure" or something along that lines if it was a un-clean shutdown. You could just look into the log of the client (which you probably can arrange access to)...

Best regards,
Christian Meis

User avatar
normis
MikroTik Support
MikroTik Support
 
Posts: 19295
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

by normis » Wed May 10, 2006 1:20 pm

plus, use the safe mode (crtl+x) so that unwanted shutdowns or disconnections don't happen

User avatar
Belyivulk
Member Candidate
Member Candidate
 
Posts: 279
Joined: Mon Mar 06, 2006 11:53 pm
Location: Whangarei, New Zealand

by Belyivulk » Thu May 11, 2006 2:00 pm

Go on? Ctrl-X how does that work?

I was looking at a router last night that just "vanished" off our network, but still remained pingable (hard to explain) and at first i thought the client had restarted, i couldnt get into mac telnet or winbox and there was nothing in the logs on the ap to suggest a reboot. In that situation a log in the AP would be handy i suppose. Turned out the gf unplugged it to connect a hair curler, but as it was a new link installed in the afternoon over a particularly long distance we were watching it like hawks.

Anyway, CTRL-X. What do you mean normis?

User avatar
normis
MikroTik Support
MikroTik Support
 
Posts: 19295
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

by normis » Thu May 11, 2006 2:08 pm

hit ctrl+x and it will start safe mode. in this mode you can do all the same stuff, but if by some mistake you manage to disconnect from the router (disable all interfaces for example) then the safe mode will undo the last actions and you will be able to connect again.

User avatar
Belyivulk
Member Candidate
Member Candidate
 
Posts: 279
Joined: Mon Mar 06, 2006 11:53 pm
Location: Whangarei, New Zealand

by Belyivulk » Thu May 11, 2006 2:11 pm

You have just made my day. I love you. I want you to have my babies! I was unaware of this feature that could make my life SOOOOOO much easier!

At which stage do i press ctrl-x?

User avatar
normis
MikroTik Support
MikroTik Support
 
Posts: 19295
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

by normis » Thu May 11, 2006 2:19 pm

any stage. in winbox you open the terminal window and hit ctrl+x there. the safe mode will then stay enabled for all that you do in either terminal or winbox. to turn it off, again hit ctrl+x in terminal.

in general you go to safe mode before attempting some important configuration

we will make a button for it in winbox

User avatar
Belyivulk
Member Candidate
Member Candidate
 
Posts: 279
Joined: Mon Mar 06, 2006 11:53 pm
Location: Whangarei, New Zealand

by Belyivulk » Thu May 11, 2006 2:22 pm

Great! that will stop ALOT of misshaps that we seem to encounter, for example choosing a frequency that "bricks" the router. If it would switch back to the original freq and re-establish connection now THAT is handy

changeip
Forum Guru
Forum Guru
 
Posts: 3730
Joined: Fri May 28, 2004 5:22 pm

by changeip » Thu May 11, 2006 7:00 pm

Normis,

Allowing for safe mode in a script also would be handy as well... using SSH to run commands or scripting to run commands and being able to turn on/off safe mode would be good. As well as being able to detect safe mode.

:safe on
:safe off
:put [:safe]

Sam

eflanery
Member
Member
 
Posts: 373
Joined: Fri May 28, 2004 10:11 pm
Location: Moscow, ID

by eflanery » Tue May 23, 2006 8:12 pm

It is quite possible to take safe mode in remote scripts, this little chunk of python (similar constructs are possable in other languages, of course) is what I use:

Code: Select all
    def lock(self, take):
        tries = 0
        success = -1
        modes = [["] > "], ["] <SAFE> "]]
        try:
            self.refreshconnection()
            while success != 0:
                if tries >= 30:
                    raise error("Locking failed")
                tries = tries + 1
                self.connection.write("\x18\n")
                success = self.connection.expect(modes[take], 1)[0]
        except:
            raise error("Locking failed")

The important part is this: self.connection.write("\x18\n")

Particularly, the \x18\n bit.

The \x18 sends a literal ^x, and the \n sends a newline which generates a fresh prompt.

Very useful for preventing multiple asynchronous scripts from colliding, and leaving the router in an indeterminate state (and preventing the script from locking itself, and you, out of the router). It can be used just like a thread lock, and could even be abstracted further to create semaphores and such.

--Eric

changeip
Forum Guru
Forum Guru
 
Posts: 3730
Joined: Fri May 28, 2004 5:22 pm

by changeip » Tue May 23, 2006 8:24 pm

Thats excellent!

I would still like to see some ice commands for placing the router into safe mode for scripting directly on the MT ... many scripts I run directly from the MT scripting language and there isn't a way I know of the place router into safe mode directly.

Sam

eflanery
Member
Member
 
Posts: 373
Joined: Fri May 28, 2004 10:11 pm
Location: Moscow, ID

by eflanery » Tue May 23, 2006 8:38 pm

Indeed, I know of no way to initiate safe mode from within local MT scripts.

Would be quite useful.

--Eric

12 posts   •   Page 1 of 1

Who is online

Users browsing this forum: No registered users and 14 guests

It is currently Thu Nov 27, 2014 6:53 pm