oxidized icon indicating copy to clipboard operation
oxidized copied to clipboard

Unable to detect prompt with a very simple device

Open morgens opened this issue 8 years ago • 5 comments

Hello everyone. I'm having a problem adding a very simple class to oxidized.

I would like to grab config from Zyxel Keenetic devices, which I have plenty in my network.

So I created a simple class like that:

class KeeneticVOX < Oxidized::Model
  # Zyxel Keenetic VOX

  comment '# '

  cmd 'more startup-config'

  cfg :telnet do
    username /^Login:/
    password /^Password:/
  end

end

and specified a device in router.db But I see only errors in logs:

W, [2018-04-11T13:55:42.423870 #1111]  WARN -- : 10.0.12.1 raised Oxidized::PromptUndetect with msg "unable to detect prompt: (?-mix:^([\w.@-]+[#>]\s?)$)"
W, [2018-04-11T13:55:43.366851 #1111]  WARN -- : azs-12 VOX status no_connection, retries exhausted, giving up

I can track successful logins by oxidized to this router, and the output of specified in this class command should look something like that:

Login: admin
Password: **********
(config)> more startup-config
! $$$ Model: ZyXEL Keenetic VOX
! $$$ Version: 2.0
! $$$ Agent: http/ci
! $$$ Last change: Tue, 25 Jul 2017 06:07:22 GMT
! $$$ Md5 checksum: 61d0d6b632650d2f5423fa0a3f085802

What am I doing wrong? Should I specify a prompt in class? I'm not that great with regular expressions. I also tried enabling debug mode, but oxidized wouldn't start with that. I installed oxidized just recently and have a few dozens of routeros devices backuping by it. It's great! But this issue is driving me crazy. Any advice?

morgens avatar Apr 11 '18 11:04 morgens

So the prompt you've shown above doesn't match the regex ^([\w.@-]+[#>]\s?)$.

You should specify a regex within the new model that will match the prompts on these devices. Lots of examples in existing models you can take a look at.

laf avatar Apr 11 '18 12:04 laf

So I managed to fix this by putting a regexp like this in model class prompt /(\(config >\))*/

So now my model class looks like this

  # Zyxel Keenetic VOX

  prompt /(\(config >\))*/

  comment '# '

  cmd 'more startup-config'

  cfg :telnet do
    username /^Login:/
    password /^Password:/
  end

end

Oxidized indicates that backup was successfull, but when i try to receive the last configuration it say "node not found" and there are no versions of the backup. Which probably indicates that it was empty? Is my class correct and where should I dig?

I also managed to turn on the debug mode and thats what there is about the device i'm trying to backup.

Trying 10.0.12.1...
Connected to 10.0.12.1.
Login: ^[[Kb^[[Ka^[[Kc^[[Kk^[[Ku^[[Kp^[[K
Password: ^[[K

Is it something wrong with this device's encoding? Or there is some other problem?

morgens avatar Apr 11 '18 13:04 morgens

You will need to pastebin the full logs when debug is turned on for this device.

laf avatar Apr 16 '18 12:04 laf

That's what I have in logs if I enable debug. https://pastebin.com/zXJ1Spyg

That's what I have in telnet logs. https://pastebin.com/yReQ0nMG

For some reason I have 1 successfull backup for this particular host, and I have it's config in oxidized storage. But when I make any changes to the config and run oxidized backup again, it doesn't capture anthing, like in the first pastebin. Nothing was captured during that backup.

morgens avatar Apr 18 '18 11:04 morgens

Support for the Zyxel Keenetic product range has been introduced in #1286

wk avatar Apr 28 '18 06:04 wk