Netdot
De Linuxmemo.
(→Perl deps) |
(→Astuces) |
||
(21 versions intermédiaires masquées) | |||
Ligne 4 : | Ligne 4 : | ||
sources: https://osl.uoregon.edu/redmine/ | sources: https://osl.uoregon.edu/redmine/ | ||
- | ==Installation== | + | ==Installation v1.0.2== |
+ | *Apache2 et dépendances | ||
+ | # apt-get install apache2 apache2-dev libapache2-mod-perl2 libapache2-mod-perl2-dev \ | ||
+ | build-essential libapreq2 libapache2-request-perl librrds-perl libsql-translator-perl \ | ||
+ | libnet-netmask-perl | ||
+ | |||
+ | *mibs (/usr/share/netdisco/mibs) | ||
+ | #apt-get install netdisco-mibs-installer | ||
+ | #netdisco-mibs-download | ||
+ | (via wgetrc pour le proxy - netdisco-mibs-installer si ca se passe mal...) | ||
- | + | *rrdtool et mysql | |
# apt-get install rrdtool mysql-client mysql-server | # apt-get install rrdtool mysql-client mysql-server | ||
Choose a mysql 'root' admin password and remember it | Choose a mysql 'root' admin password and remember it | ||
+ | |||
+ | *installation de la base de données | ||
+ | #cd /path/to/netdot-1.0.2 | ||
+ | # make installdb | ||
- | + | *Dépendances PERL | |
- | + | ||
- | + | ||
# make installdeps | # make installdeps | ||
(voir [[Perl]] pour utilisation avec serveur proxy) | (voir [[Perl]] pour utilisation avec serveur proxy) | ||
+ | ou | ||
+ | make installdeps-apt-get | ||
(Modules Perl supplémentaire) | (Modules Perl supplémentaire) | ||
Ligne 20 : | Ligne 33 : | ||
>install Apache2::SiteControl | >install Apache2::SiteControl | ||
+ | *test des dépendances PERL | ||
#make testdeps | #make testdeps | ||
pour teste que toute les dépendance necessaire sont bien installées | pour teste que toute les dépendance necessaire sont bien installées | ||
+ | *installation de netdot | ||
# vim etc/Default.conf | # vim etc/Default.conf | ||
- | # | + | # make install APACHEUSER=www-data APACHEGROUP=www-data |
- | + | avec les flags: DB_TYPE=mysql DB_HOST=localhost DB_NETDOT_USER=netdot DB_NETDOT_PASS=netdot | |
==Configuration== | ==Configuration== | ||
Ligne 39 : | Ligne 54 : | ||
# ln -s /usr/local/netdot/etc/netdot_apache2_local.conf sites-available/netdot | # ln -s /usr/local/netdot/etc/netdot_apache2_local.conf sites-available/netdot | ||
# a2ensite netdot | # a2ensite netdot | ||
+ | |||
+ | *snmp(client) | ||
+ | # vim /etc/snmp/snmp.conf | ||
+ | mibs /usr/share/netdisco/mibs/hp | ||
+ | |||
+ | *injection des switch via un fichier au format "nom_machine communauté" | ||
+ | # bin/updatedevices.pl -E <text-file> -I | ||
==Erreurs d'install== | ==Erreurs d'install== | ||
Ligne 159 : | Ligne 181 : | ||
En attente d'un nouveau etc/netdot.meta dans le dépot. | En attente d'un nouveau etc/netdot.meta dans le dépot. | ||
+ | |||
+ | I fixed this by adding the same key for unique as for primary_key in netdot.meta | ||
+ | e.g. | ||
+ | primary_key => 'id', | ||
+ | unique => [ ['id' ] ], | ||
+ | |||
+ | ===snmp bug === | ||
+ | |||
+ | ERROR: Device::_get_snmp_session: Cannot connect to... | ||
+ | |||
+ | vim /etc/snmp/snmp.conf | ||
+ | |||
+ | # | ||
+ | # As the snmp packages come without MIB files due to license reasons, loading | ||
+ | # of MIBs is disabled by default. If you added the MIBs you can reenable | ||
+ | # loaging them by commenting out the following line. | ||
+ | # mibs : | ||
+ | #defversion 1 | ||
+ | mibdirs +/usr/share/netdisco/mibs/rfc | ||
+ | mibdirs +/usr/share/mibs/netsnmp | ||
+ | mibdirs +/usr/share/netdisco/mibs/net-snmp | ||
+ | mibdirs +/usr/share/mibs/ietf | ||
+ | mibdirs +/usr/share/mibs/iana | ||
+ | #mibdirs /var/lib/mibs/iana | ||
+ | #mibdirs /var/lib/mibs/ietf | ||
+ | mibdirs +/usr/share/netdisco/mibs/hp | ||
+ | mibdirs +/usr/share/netdisco/mibs/allied | ||
+ | mibdirs +/usr/share/netdisco/mibs/arista | ||
+ | mibdirs +/usr/share/netdisco/mibs/aruba | ||
+ | mibdirs +/usr/share/netdisco/mibs/asante | ||
+ | mibdirs +/usr/share/netdisco/mibs/cabletron | ||
+ | mibdirs +/usr/share/netdisco/mibs/cisco | ||
+ | mibdirs +/usr/share/netdisco/mibs/cyclades | ||
+ | mibdirs +/usr/share/netdisco/mibs/dell | ||
+ | mibdirs +/usr/share/netdisco/mibs/enterasys | ||
+ | mibdirs +/usr/share/netdisco/mibs/extreme | ||
+ | mibdirs +/usr/share/netdisco/mibs/foundry | ||
+ | mibdirs +/usr/share/netdisco/mibs/juniper | ||
+ | mibdirs +/usr/share/netdisco/mibs/netscreen | ||
+ | mibdirs +/usr/share/netdisco/mibs/nortel | ||
+ | #mibreplacewithlatest yes | ||
+ | |||
+ | ===Mot de passe root Mysql=== | ||
+ | |||
+ | Attention pas de $ dans le mot de passe car $ a un autre sens pour Perl. | ||
+ | |||
+ | ===table rrloc=== | ||
+ | CREATE TABLE `rrloc` ( `altitude` bigint NOT NULL, `horiz_pre` varchar(32) NULL, `id` bigint NOT NULL auto_increment, `latitude` bigint NOT NULL, `longitude` bigint NOT NULL, `rr` bigint NOT NULL, `size` varchar(32) NULL, `ttl` varchar(32) NULL, `vert_pre` varchar(32) NULL, UNIQUE INDEX `rrloc1` (`rr`), INDEX `RRLOC2` (`'''id'''`), PRIMARY KEY (`id`), CONSTRAINT `fk_rr_4` FOREIGN KEY (`rr`) REFERENCES `rr` (`id`) ) ENGINE=InnoDB; | ||
+ | Query OK, 0 rows affected (0.00 sec) | ||
==Commande== | ==Commande== | ||
+ | |||
+ | *premier import depuis un fichier | ||
+ | |||
+ | /usr/local/netdot/bin# ./updatedevices.pl -E device.txt -I | ||
==Automatisation== | ==Automatisation== | ||
==Astuces== | ==Astuces== | ||
+ | *arpsweep | ||
+ | for i in $(seq 1 254); do ping -c1 172.21.0.${i}; arp -n |grep "172.21.0.${i}" >> ici.txt; done | ||
==Demo vmware== | ==Demo vmware== | ||
mdp | mdp | ||
netdot:netdot | netdot:netdot |
Version actuelle en date du 7 décembre 2012 à 14:44
Network Documentation Tool project
sources: https://osl.uoregon.edu/redmine/
Sommaire |
[modifier] Installation v1.0.2
- Apache2 et dépendances
# apt-get install apache2 apache2-dev libapache2-mod-perl2 libapache2-mod-perl2-dev \ build-essential libapreq2 libapache2-request-perl librrds-perl libsql-translator-perl \ libnet-netmask-perl
- mibs (/usr/share/netdisco/mibs)
#apt-get install netdisco-mibs-installer #netdisco-mibs-download (via wgetrc pour le proxy - netdisco-mibs-installer si ca se passe mal...)
- rrdtool et mysql
# apt-get install rrdtool mysql-client mysql-server Choose a mysql 'root' admin password and remember it
- installation de la base de données
#cd /path/to/netdot-1.0.2 # make installdb
- Dépendances PERL
# make installdeps (voir Perl pour utilisation avec serveur proxy) ou make installdeps-apt-get (Modules Perl supplémentaire) #perl -MCPAN -e shell; >install Apache2::SiteControl
- test des dépendances PERL
#make testdeps pour teste que toute les dépendance necessaire sont bien installées
- installation de netdot
# vim etc/Default.conf # make install APACHEUSER=www-data APACHEGROUP=www-data avec les flags: DB_TYPE=mysql DB_HOST=localhost DB_NETDOT_USER=netdot DB_NETDOT_PASS=netdot
[modifier] Configuration
- netdot
$cd /usr/local/netdot/etc $cp Default.conf Site.conf $vim Site.conf
- apache2
$ a2enmod perl # cd /etc/apache2 # ln -s /usr/local/netdot/etc/netdot_apache2_local.conf sites-available/netdot # a2ensite netdot
- snmp(client)
# vim /etc/snmp/snmp.conf mibs /usr/share/netdisco/mibs/hp
- injection des switch via un fichier au format "nom_machine communauté"
# bin/updatedevices.pl -E <text-file> -I
[modifier] Erreurs d'install
[modifier] Perl deps
# make testdeps Testing for required Perl modules /usr/bin/perl bin/perldeps.pl test RRDs..............................................ok GraphViz..........................................ok Module::Build.....................................ok CGI...............................................ok Class::DBI........................................ok Class::DBI::AbstractSearch........................ok Apache2::Request..................................ok HTML::Mason.......................................ok Apache::Session...................................ok URI::Escape.......................................ok SQL::Translator...................................ok SNMP::Info 2.06...................................ok NetAddr::IP.......................................ok Apache2::AuthCookie...............................ok Apache2::SiteControl..............................ok Log::Dispatch.....................................ok Log::Log4perl.....................................ok Parallel::ForkManager.............................ok Net::Patricia 1.19_01.............................ok Authen::Radius....................................ok Test::Simple......................................ok Net::IRR..........................................MISSING Time::Local.......................................ok File::Spec........................................ok Net::Appliance::Session...........................ok BIND::Config::Parser..............................ok Net::DNS..........................................ok Text::ParseWords..................................ok Carp::Assert......................................ok Digest::SHA.......................................ok Net::DNS::ZoneFile::Fast..........................ok Socket6...........................................ok XML::Simple.......................................ok
# apt-get install libnet-irr-perl Lecture des listes de paquets... Fait Construction de l'arbre des dépendances Lecture des informations d'état... Fait E: Impossible de trouver le paquet libnet-irr-perl
Sous Ubuntu 12.04.1 LTS le paquet n'existe pas :(
via CPAM
cpan[1]> install Net::IRR Going to read '/root/.cpan/Metadata' Database was generated on Tue, 06 Nov 2012 15:43:03 GMT Running install for module 'Net::IRR' Running make for T/TC/TCAINE/Net-IRR-0.08.tar.gz Checksum for /root/.cpan/sources/authors/id/T/TC/TCAINE/Net-IRR-0.08.tar.gz ok Scanning cache /root/.cpan/build for sizes ............................................................................DONE CPAN.pm: Going to build T/TC/TCAINE/Net-IRR-0.08.tar.gz Checking if your kit is complete... Looks good Writing Makefile for Net::IRR Writing MYMETA.yml and MYMETA.json cp lib/Net/IRR.pm blib/lib/Net/IRR.pm Manifying blib/man3/Net::IRR.3pm TCAINE/Net-IRR-0.08.tar.gz /usr/bin/make -- OK Running make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/01_methods.t .. 3/21 # Failed test 'connected to whois.radb.net' # at t/01_methods.t line 9. # Failed test '->can(...)' # at t/01_methods.t line 11. # can_ok() called with empty class or reference Can't call method "get_irrd_version" on an undefined value at t/01_methods.t line 12. # Looks like you planned 21 tests but ran 4. # Looks like you failed 2 tests of 4 run. # Looks like your test exited with 110 just after 4. t/01_methods.t .. Dubious, test returned 110 (wstat 28160, 0x6e00) Failed 19/21 subtests Test Summary Report ------------------- t/01_methods.t (Wstat: 28160 Tests: 4 Failed: 2) Failed tests: 3-4 Non-zero exit status: 110 Parse errors: Bad plan. You planned 21 tests but ran 4. Files=1, Tests=4, 64 wallclock secs ( 0.02 usr 0.01 sys + 0.04 cusr 0.00 csys = 0.07 CPU) Result: FAIL Failed 1/1 test programs. 2/4 subtests failed. make: *** [test_dynamic] Erreur 110 TCAINE/Net-IRR-0.08.tar.gz /usr/bin/make test -- NOT OK //hint// to see the cpan-testers results for installing this module, try: reports TCAINE/Net-IRR-0.08.tar.gz Running make install make test had returned bad status, won't install without force Failed during this command: TCAINE/Net-IRR-0.08.tar.gz : make_test NO
[modifier] sql shema
La table "accessright" n'est pas créée...
http://comments.gmane.org/gmane.network.netdot.user/651
Well, that must be it. Did you install that via CPAN? It looks like the Ubuntu package is 0.11010. You could uninstall the current one and then do: $ sudo apt-get install libsql-translator-perl Or, the other option is to edit etc/netdot.meta and remove all the lines that have empty unique constraints: unique => [ [ ] ], I'll try to push another release soon, but there are other priorities at the moment. cv
En attente d'un nouveau etc/netdot.meta dans le dépot.
I fixed this by adding the same key for unique as for primary_key in netdot.meta e.g. primary_key => 'id', unique => [ ['id' ] ],
[modifier] snmp bug
ERROR: Device::_get_snmp_session: Cannot connect to...
vim /etc/snmp/snmp.conf
# # As the snmp packages come without MIB files due to license reasons, loading # of MIBs is disabled by default. If you added the MIBs you can reenable # loaging them by commenting out the following line. # mibs : #defversion 1 mibdirs +/usr/share/netdisco/mibs/rfc mibdirs +/usr/share/mibs/netsnmp mibdirs +/usr/share/netdisco/mibs/net-snmp mibdirs +/usr/share/mibs/ietf mibdirs +/usr/share/mibs/iana #mibdirs /var/lib/mibs/iana #mibdirs /var/lib/mibs/ietf mibdirs +/usr/share/netdisco/mibs/hp mibdirs +/usr/share/netdisco/mibs/allied mibdirs +/usr/share/netdisco/mibs/arista mibdirs +/usr/share/netdisco/mibs/aruba mibdirs +/usr/share/netdisco/mibs/asante mibdirs +/usr/share/netdisco/mibs/cabletron mibdirs +/usr/share/netdisco/mibs/cisco mibdirs +/usr/share/netdisco/mibs/cyclades mibdirs +/usr/share/netdisco/mibs/dell mibdirs +/usr/share/netdisco/mibs/enterasys mibdirs +/usr/share/netdisco/mibs/extreme mibdirs +/usr/share/netdisco/mibs/foundry mibdirs +/usr/share/netdisco/mibs/juniper mibdirs +/usr/share/netdisco/mibs/netscreen mibdirs +/usr/share/netdisco/mibs/nortel #mibreplacewithlatest yes
[modifier] Mot de passe root Mysql
Attention pas de $ dans le mot de passe car $ a un autre sens pour Perl.
[modifier] table rrloc
CREATE TABLE `rrloc` ( `altitude` bigint NOT NULL, `horiz_pre` varchar(32) NULL, `id` bigint NOT NULL auto_increment, `latitude` bigint NOT NULL, `longitude` bigint NOT NULL, `rr` bigint NOT NULL, `size` varchar(32) NULL, `ttl` varchar(32) NULL, `vert_pre` varchar(32) NULL, UNIQUE INDEX `rrloc1` (`rr`), INDEX `RRLOC2` (`id`), PRIMARY KEY (`id`), CONSTRAINT `fk_rr_4` FOREIGN KEY (`rr`) REFERENCES `rr` (`id`) ) ENGINE=InnoDB; Query OK, 0 rows affected (0.00 sec)
[modifier] Commande
- premier import depuis un fichier
/usr/local/netdot/bin# ./updatedevices.pl -E device.txt -I
[modifier] Automatisation
[modifier] Astuces
- arpsweep
for i in $(seq 1 254); do ping -c1 172.21.0.${i}; arp -n |grep "172.21.0.${i}" >> ici.txt; done
[modifier] Demo vmware
mdp netdot:netdot