Closed ulfhednarnix closed 2 months ago
"Unable to detect prompt" means that the actual prompt of the device does not match with the regular expression set in the model file. Which is the prompt of the device? You should try to match the prompt with the regular expression using an online regex tester and find out why it doesn't match.
Hello. I'm a beginner Linux administrator. I installed and configured oxidized. I launched mikrotik on the model, everything works well. When starting the SNR 2985 and EdgeCore ES3528M models, edgeos and nos, respectively, a problem occurs with prompt. I searched and read a lot, including on GitHub, but I didn’t find a solution. I understand that the problem is in regular harvesting, but I don’t know how it will be solved. Who can tell me how to solve this?
Example log for EdgeCore:
Dec 20 14:47:40 oxidized oxidized[15785]: lib/oxidized/worker.rb: 1 jobs running in parallel Dec 20 14:47:41 oxidized oxidized[15785]: 10.0.7.46 raised Oxidized::PromptUndetect with msg "unable to detect prompt: (?-mix:@.*?:~\$\s)" Dec 20 14:47:41 oxidized oxidized[15785]: lib/oxidized/node.rb: Oxidized::Telnet failed for edgecore Dec 20 14:47:41 oxidized oxidized[15785]: lib/oxidized/job.rb: Config fetched for edgecore at 2023-12-20 08:47:41 UTC Dec 20 14:47:41 oxidized oxidized[15785]: /edgecore status no_connection, retry attempt 1 Dec 20 14:47:41 oxidized oxidized[15785]: lib/oxidized/worker.rb: Jobs running: 0 of 1 - ended: 0 of 1 Dec 20 14:47:41 oxidized oxidized[15785]: lib/oxidized/worker.rb: Added /edgecore to the job queue Dec 20 14:47:41 oxidized oxidized[15785]: lib/oxidized/worker.rb: 1 jobs running in parallel Dec 20 14:47:41 oxidized oxidized[15785]: lib/oxidized/job.rb: Starting fetching process for edgecore at 2023-12-20 08:47:41 UTC Dec 20 14:47:42 oxidized oxidized[15785]: lib/oxidized/worker.rb: 1 jobs running in parallel
File model edgeos.rb:
class Edgeos < Oxidized::Model prompt /@.*?:~\$\s/ cmd :all do |cfg| cfg.lines.to_a[1..-2].join end
cmd :secret do |cfg| cfg.gsub! /encrypted-password (\S+)./, 'encrypted-password'
cfg.gsub! /plaintext-password (\S+). /, 'plaintext-password '
cfg.gsub! /password (\S+)./, 'password '
cfg.gsub! /pre-shared-secret (\S+). /, 'pre-shared-secret '
cfg.gsub! /community (\S+) {/, 'community {'
cfg
end
cmd 'show version' do |cfg| cfg.gsub! /^Uptime:\s.+/, '' comment cfg end
cmd 'show running-config'
cfg :telnet do username /login:\s/ password /^Password:\s/ end
cfg :telnet, :ssh do pre_logout 'exit' end end
Conf file oxidized:
username: admin password: ** model: junos resolve_dns: false interval: 300 use_syslog: true debug: true threads: 30 timeout: 60 retries: 3 rest: 10.0.0.162:8888 next_adds_job: false vars: {} groups: {} models: {} pid: "/home/oxidized/.config/oxidized/pid" log: "/home/oxidized/.config/oxidized/log" crash: directory: "/home/oxidized/.config/oxidized/crashes" hostnames: false stats: history_size: 10 input: default: telnet debug: true ssh: secure: false ftp: passive: true utf8_encoded: true output: default: git git: user: oxidized