not able get backup from cisco ASA with multiple context
Console ERRROR :
E, [2016-09-08T16:26:43.300638 #5278] ERROR -- : 192.168.3.3 raised NoMethodError with msg "undefined method `join' for nil:NilClass", /home/bob/.config/oxidized/crash.192.168.3.3 saved
W, [2016-09-08T16:26:43.964686 #5278] WARN -- : 192.168.3.3 status no_connection, retry attempt 1
E, [2016-09-08T16:26:48.280792 #5278] ERROR -- : 192.168.3.3 raised NoMethodError with msg "undefined method `join' for nil:NilClass", /home/bob/.config/oxidized/crash.192.168.3.3 saved
W, [2016-09-08T16:26:48.966803 #5278] WARN -- : 192.168.3.3 status no_connection, retry attempt 2
E, [2016-09-08T16:26:53.296440 #5278] ERROR -- : 192.168.3.3 raised NoMethodError with msg "undefined method `join' for nil:NilClass", /home/bob/.config/oxidized/crash.192.168.3.3 saved
W, [2016-09-08T16:26:53.968757 #5278] WARN -- : 192.168.3.3 status no_connection, retry attempt 3
E, [2016-09-08T16:26:58.312140 #5278] ERROR -- : 192.168.3.3 raised NoMethodError with msg "undefined method `join' for nil:NilClass", /home/bob/.config/oxidized/crash.192.168.3.3 saved
W, [2016-09-08T16:26:58.970590 #5278] WARN -- : 192.168.3.3 status no_connection, retries exhausted, giving up
Crash file ::
2016-09-08 10:56:58 UTC
undefined method `join' for nil:NilClass [NoMethodError]
--------------------------------------------------
/var/lib/gems/2.3.0/gems/oxidized-0.16.3/lib/oxidized/model/asa.rb:34:in `block in <class:ASA>'
/var/lib/gems/2.3.0/gems/oxidized-0.16.3/lib/oxidized/model/model.rb:94:in `instance_exec'
/var/lib/gems/2.3.0/gems/oxidized-0.16.3/lib/oxidized/model/model.rb:94:in `cmd'
/var/lib/gems/2.3.0/gems/oxidized-0.16.3/lib/oxidized/model/model.rb:136:in `block in get'
/var/lib/gems/2.3.0/gems/oxidized-0.16.3/lib/oxidized/model/model.rb:135:in `each'
/var/lib/gems/2.3.0/gems/oxidized-0.16.3/lib/oxidized/model/model.rb:135:in `get'
/var/lib/gems/2.3.0/gems/oxidized-0.16.3/lib/oxidized/input/cli.rb:14:in `get'
/var/lib/gems/2.3.0/gems/oxidized-0.16.3/lib/oxidized/node.rb:61:in `run_input'
/var/lib/gems/2.3.0/gems/oxidized-0.16.3/lib/oxidized/node.rb:38:in `block in run'
/var/lib/gems/2.3.0/gems/oxidized-0.16.3/lib/oxidized/node.rb:33:in `each'
/var/lib/gems/2.3.0/gems/oxidized-0.16.3/lib/oxidized/node.rb:33:in `run'
/var/lib/gems/2.3.0/gems/oxidized-0.16.3/lib/oxidized/job.rb:9:in `block in initialize'
Issue seems to happen here https://github.com/ytti/oxidized/blob/master/lib/oxidized/model/asa.rb#L34
Implication is, we're not getting four lines of text, which causes us to return nil which we cannot join.
What do you get as output when you manually run more system:running-config
I've never logged in on an ASA, so I may be of little use. Perhaps @sts @fspijkerman @nickhilliard @gcotone @thakala or @funzoneq can help.
@ytti I don't have one with multiple contexts available atm. But this is the result of a 'normal' ASA:
ABCD-FW1/pri/act# more system:running-config
: Saved
:
: Serial Number: FCH18A37B4G
: Hardware: ASA5555, 16384 MB RAM, CPU Lynnfield 2792 MHz, 1 CPU (8 cores)
: Written by oxidized at 14:09:46.563 CEDT Thu Sep 8 2016
!
ASA Version 9.4(2)6
!
hostname ABCD-FW1
no clue. i never used multiple contexts because they caused too many features to stop working.
Hi, Thanks for your response. I found why the backup is not working for cisco ASA in multiple context mode, because more command will not work in "admin" context. To take a backup of cisco ASA in multiple context mode , First we need to login to admin context with management ip address, the we need to switch to system context by executing command changeto context system . from system context we can take backup of multiple contexts by executing belwo given commands
changeto context system more system:running-config --> this will provide the system context backup
show context count Total active Security Contexts: 3 --> this shows the number of active contexts in cisco asa
more disk0:/context1.cfg --> this command will take context 1 backup more disk0:/context2.cfg --> this will take context 2 backup more disk0:/admin.cfg --> this will take admin context backup
@rammanokar there's any command we can use to test if the device is using multiple contexts?
The way I see it, we have two options:
- create two models
- check somehow if multiple contexts are used and run the appropriate commands
Any preferences @ytti ?
I really hope we could detect multi-context from CLI itself, that would be most userfriendly, then call own methods for both cases.
There's an open pull request for multi context support, but needs some cleanup. #479
You can run the command "show mode" and it will show you if you are in single or multi context, then you can switch to the system mode and backup the config files. The pull request iterates through the contexts where it should perform a more on the configs.
I may take a look at cleaning up the code when I get a bit of free time.
Hello I interesting in this function, there is any news ?
This should now be resolved as #859 was merged in.