# Hotwired hotwired sends SNMP queries to defined CIDR ranges and populates SQL database based on nodes found. Some particular problems it tries to deal with: * Only discover one node once * To that effect it has priority list of idDescr lo0.0, loopback0, vlan2 etc. Higher priority will always replace lower priority interface (say you have MGMT in loop0 but giga0/2.42 has valid MGMT address towards L2 metro) * Tries to handle gracefully renumbering, renaming, etc # Install Add this line to your application's Gemfile: ```ruby gem 'hotwired' ``` And then execute: $ bundle install Or install it yourself as: $ gem install hotwired ## Usage 1. gem install hotwired 2. hotwired 3. ^C (break it) 4. edit ~/.config/hotwired/config 5. put hotwired in crontab as hotwired|mail -E -s 'new nodes found' foo@example.com_ # Config * You need to configure SNMP community * You need to define CIDR to poll and CIDRs to ignore (subset of those you poll) * CIDR in example config is list, but can be replaced with 'string' which points to file, where CIDRs are listed # CLI execute sample ```shell careline@careline:~/.config/hotwired -h Usage: hotwired [options] [argument] -d, --debug Debugging on -p, --poll Poll CIDR [argument] -r, --remove Remove [argument] from DB -m, --max-delete Maximum number to delete, default 1 -o, --purge-old Remove records order than [argument] days -s, --simulate Simulate, do not change DB -h, --help Display this help message. % hotwired -p 192.0.2.0/28 # poll specific CIDR % hotwired -r core-sw1 # remove specific record % hotwired -o 7 # remore records older than 7 days careline@careline:~/.config/hotwired % ll 22-04-17 - 16:42:14 总用量 20K -rw-r--r-- 1 careline careline 245 4月 17 16:39 config -rw-r--r-- 1 careline careline 12K 4月 17 16:42 hotwired.db -rw-r--r-- 1 careline careline 67 4月 17 16:09 log careline@careline:~/.config/hotwired % rm -rf hotwired.db 22-04-17 - 16:43:10 careline@careline:~/.config/hotwired % hotwired -d 22-04-17 - 16:43:12 I, [2022-04-17T16:43:18.909105 #599481] INFO -- : ptr [R1.cisco.com] sysName [RUBY_R1.cisco.com] ip [192.168.8.80] I, [2022-04-17T16:43:18.918306 #599481] INFO -- : ptr [R4.cisco.com] sysName [R4.cisco.com] ip [192.168.8.83] I, [2022-04-17T16:43:18.925623 #599481] INFO -- : ptr [R10.cisco.com] sysName [R10.cisco.com] ip [192.168.8.89] I, [2022-04-17T16:43:18.930507 #599481] INFO -- : ptr [R5.cisco.com] sysName [R5.cisco.com] ip [192.168.8.84] I, [2022-04-17T16:43:18.936821 #599481] INFO -- : ptr [R2.cisco.com] sysName [R2.cisco.com] ip [192.168.8.81] I, [2022-04-17T16:43:18.942099 #599481] INFO -- : ptr [R8.cisco.com] sysName [R8.cisco.com] ip [192.168.8.87] I, [2022-04-17T16:43:18.947214 #599481] INFO -- : ptr [R3.cisco.com] sysName [R3.cisco.com] ip [192.168.8.82] I, [2022-04-17T16:43:18.953543 #599481] INFO -- : ptr [R7.cisco.com] sysName [R7.cisco.com] ip [192.168.8.86] I, [2022-04-17T16:43:18.969960 #599481] INFO -- : ptr [R9.cisco.com] sysName [R9.cisco.com] ip [192.168.8.88] ``` ## Development After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/ciscolive/hotwired-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ciscolive/hotwired-ruby/blob/main/CODE_OF_CONDUCT.md). ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). ## Code of Conduct Everyone interacting in the Hotwired project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ciscolive/hotwired-ruby/blob/main/CODE_OF_CONDUCT.md).