Age | Commit message (Collapse) | Author |
|
|
|
SQL file in configuration renamed to database.
Should the generated example file have host+user+password+query?
|
|
config option "file" got renamed to "database", added authentication options for other SQL adapters and an optional query argument to overwrite the generic query.
config snipplet:
sql:
adapter: mysql2
user: sqluser
password: sekrit
host: mysql.local
database: inventory
table: devices
query: SELECT `fqhn` AS `name`, lower(`vendor`) AS `model` FROM `devices` INNER JOIN `devtypes` ON (`devtypes`.`id` = `devices`.`model_id`) WHERE (`aktiv` = 'J')
map:
name: name
model: model
|
|
|
|
|
|
a) put metainformation on top, rancid style
b) remove changing data from 'show system'
|
|
Even after manually setting author+committer, it still crashed with:
Config value 'user.name' was not found [Rugged::ConfigError]
Not sure where it would want to use it, after author+committer already
are set, but I guess this method is more robust anyhow.
|
|
Ratioinale is, we want to keep it default, but it should be easy for
people to understand what to do, if they don't want it.
Closes #17
|
|
a) grit is not supported, rugged is
b) grit requires git CLI installed, rugged does not
c) grit needs monkey patching to work, rugged does not
Closes #21
Closes #22
|
|
|
|
Looks like this in syslog:
Jul 11 21:05:53 ytti oxidized[9820]: 10.10.10.10 raised Errno::ENETUNREACH with msg "Network is unreachable - connect(2) for "10.10.10.10" port 22"
Jul 11 21:05:53 ytti oxidized[9820]: 10.10.10.10 raised Errno::ENETUNREACH with msg "Network is unreachable - connect(2) for "10.10.10.10" port 23"
Jul 11 21:05:54 ytti oxidized[9820]: 10.10.10.10 status no_connection, retry attempt 1
Jul 11 21:05:54 ytti oxidized[9820]: 10.10.10.10 raised Errno::ENETUNREACH with msg "Network is unreachable - connect(2) for "10.10.10.10" port 22"
Jul 11 21:05:54 ytti oxidized[9820]: 10.10.10.10 raised Errno::ENETUNREACH with msg "Network is unreachable - connect(2) for "10.10.10.10" port 23"
Jul 11 21:05:55 ytti oxidized[9820]: 10.10.10.10 status no_connection, retry attempt 2
Jul 11 21:05:55 ytti oxidized[9820]: 10.10.10.10 raised Errno::ENETUNREACH with msg "Network is unreachable - connect(2) for "10.10.10.10" port 22"
Jul 11 21:05:55 ytti oxidized[9820]: 10.10.10.10 raised Errno::ENETUNREACH with msg "Network is unreachable - connect(2) for "10.10.10.10" port 23"
Jul 11 21:05:56 ytti oxidized[9820]: 10.10.10.10 status no_connection, retry attempt 3
Jul 11 21:05:56 ytti oxidized[9820]: 10.10.10.10 raised Errno::ENETUNREACH with msg "Network is unreachable - connect(2) for "10.10.10.10" port 22"
Jul 11 21:05:56 ytti oxidized[9820]: 10.10.10.10 raised Errno::ENETUNREACH with msg "Network is unreachable - connect(2) for "10.10.10.10" port 23"
Jul 11 21:05:57 ytti oxidized[9820]: 10.10.10.10 status no_connection, retries exhausted, giving up
|
|
Closes #23
|
|
Closes #20
[ytti@ytti.fi ~/tmp/oxidized]% oxidized
Error loading config: (<unknown>): mapping values are not s context at line 15 column 7
[ytti@ytti.fi ~/tmp/oxidized]%
|
|
if ~/.config/oxidized/model/ios.rb exists it is used, iinstead of the
system-wide model
|
|
thanks to @richih
|
|
How this works in ruby2.0 normally? What component has loaded this
implicitly?
Thanks to @RichiH for spotting.
|
|
|
|
When running Oxidized via oxidized-script you want just one node, and
you specify that as Nodes.new(:node=>x) however as router.db usually
lacks 'ip' field, and only has 'name' field'.
If you have router.db with IP in 'name' field, and you do
Nodes.new(:node='192.0.2.1') it won't return anything, as '192.0.2.1' is
matched against node[:ip] which does not exist.
This change makes IP match against IP and Name.
|
|
In new method, where we no long explicitly set loaded class name for
later resolution we depend on file name being same as class name.
However for File output, this is not true, because I didn't want plain
File in code to resolve to Oxidized::File, and din't want to always
write ::File, File ouput has class name OxFile.
This change allows class names to start optionally with string
'Oxidized' if so, they still match.
|
|
We can't use #match, if IOSXR is seen in source list before IOS, then
IOS will #match on IOSXR class and wrong model is used for IOS devices.
And obviously stupid to use regexp if you don't atbsolutely have to.
|
|
We needed this, because use of 'def inherited' not idempotent, in
Oxidized::Script use case we may need to restart Oxidized, even though
it's already loaded, and we won't get class names populated via 'def
inherited' anymore.
There are quite many optiosn to do this
a) filename == class name
+ no discovery/mapping, very clean
- user 'source' must give us model name in exactly right
capitalization
b) add 'self' at end of files, so eval will return class name
+ deterministic with arbitrary name
- DSL cruft, DSL being light is our main value
(can we do this via parent class? I couldn't find way)
c) load in new module via Module.module_eval X
+ module will contain only consts we just created
- but which one is the one we want?
- if we use eval, load errors won't tell line error
But at least now we got rid of 'inherited' methods and not adding too
much cruft, hope it's better than before.
|
|
|
|
|
|
temporary fix. Maybe node#last should check the type or we shouldn't use
last for the nodes#next in the first place
|
|
|
|
We may need this in future, but as we don't need this in oxidized-script
now after all, I don't want something to be implemented just-in-case
|
|
|
|
We probably should just axe Node#last, as Node#stats contains all it
does and more.
However it would need changing web views and I'm too lazy for that right
now.
Perhaps Nodes/Node also needs some unique ID so two instances of Nodes
can be compared exactly. Right now copying the old stats relies on name
being identical, but can we trust name to be unique? Even with groups
support?
|
|
Bumpup gemspec
|
|
So that we can easily check last time node failed/succceded etc
|
|
- we need config/vars before model
- some whitespace changes
Bump up gemspec
|
|
|
|
in addition:
- move vars helper to separate file
- add csv support for node variables
|
|
Variables can now be fed to model from multiple locations. In order of
preference:
1) node (from source)
2) group
3) global
In a model vars should be accessed via 'vars' helper method though it is
not required. Helper method ignores nil values so care needs to taken
when designing model behaviour.
Support for node level vars is currently available on sql source via
'vars_map' configuration.
Following example populates node vars 'enable' and 'somevariable' from sql
columns 'var_enable' and 'var_somevariable'
sql:
adapter: sqlite
file: /home/aakso/.config/oxidized/sqrouter.db
table: nodes
map:
name: hostname
model: model
group: node_group
username: username
password: password
vars_map:
enable: var_enablepw
somevariable: var_somevariable
|
|
For rancid-like behaviour one can now set username and password for node groups. These parameters are considered in the following order:
1) node parameters (from source)
2) group level parameters
3) global level parameters
example configuration for group 'testlab'
groups:
testlab:
username: testuser
password: testpassword
|
|
|
|
|
|
|
|
1) ssh fails
2) user clicks 'update'
3) node is reset and moved head of queue
4) telnet fails
5) node last time is set to current
net result, head of queue will block until interval has passed, even
though below head there are nodes which need to be processed.
|
|
|
|
Model can inmplement something like
cmd :secret do |cfg|
cfg.sub! / secret (\d+) (\S+).*/, '\\1 SECRET'
cfg
end
Which is called for all commands if CFG.remove_secret is set
|
|
Let's raise OxidizedError instead for known dependencies
|
|
It's useful to run interactively during startup, to get the helpful
messages about missing stuff.
|
|
It is now separately in oxidized-web package
|
|
Not every installation will use git + sql. Try to give helpful error
message on missing dependencies.
|
|
Once web is moved to 'oxidized-web' package and sqlite+git dependencies
are removed, it's lot easier to install 'oxidized-script' + 'oxidized'
on other machines which actually don't intend to run oxidized to collect
config
Now as we depend on puma + sqlite we need to compile native extensions,
which may be problematic and certainly unnecesassary just to run 'oxs'
|
|
Will allow convenience methods such as
cmd :all do |cfg|
cfg.pop.shift
end
instead of:
cmd :all do |cfg|
cfg.each_line.to_a[1..-2].join
end
And what ever convenience configs we come up with
|
|
sh ip bgp | i foo
and you won't see empty line before prompt, ergo, we cannot always
remove it.
But I'm not too surprised JunOS + IOS templates are still mostly exactly
the same they were from my testing to see how Oxidized works over year
ago, they need rework to be production quality.
|
|
Waittime is how long it waits for /more/ input /after/ matching to RE.
This has been wrong always in Oxidized but only after changing default
timeout to 30, it became apparent.
When timeout was 5s, it just gave 5s delay to every command, now it
gives 30s delay.
|
|
|