Difference between revisions of "Netdisco"

From HackerNet
Jump to: navigation, search
(Created page with "Netdisco hämtar MAC-tabeller, ARP-tabeller, VLAN-databaser, LLDP/CDP-grannskap, firmwareversioner, m.m från routrar och switchar med hjälp av SNMP. Man schemalägger när d...")
 
Line 12: Line 12:
 
  apt-get update && apt-get -y dist-upgrade && apt-get -y install open-vm-tools build-essential wget lftp mtr-tiny zip ntp
 
  apt-get update && apt-get -y dist-upgrade && apt-get -y install open-vm-tools build-essential wget lftp mtr-tiny zip ntp
  
===Netdisco===
+
===Databas===
  
 
  apt-get -y install libdbd-pg-perl libsnmp-perl postgresql pgtune  
 
  apt-get -y install libdbd-pg-perl libsnmp-perl postgresql pgtune  
Line 20: Line 20:
 
Switch to postgres user and create new SQL user
 
Switch to postgres user and create new SQL user
 
  su - postgres
 
  su - postgres
  createuser -DRSP netdisco
+
  createuser -DRSP netdiscoUSER
 
  Enter some password here
 
  Enter some password here
  createdb -O netdisco netdisco
+
  createdb --owner netdiscoUSER netdiscoDB
  
 
Switch back to root
 
Switch back to root
 
  exit
 
  exit
  
 +
===Netdisco===
 
  adduser netdisco --shell /bin/bash --disabled-password --gecos netdisco && su - netdisco
 
  adduser netdisco --shell /bin/bash --disabled-password --gecos netdisco && su - netdisco
 
  curl -L http://cpanmin.us/ | perl - --notest --local-lib ~/perl5 App::Netdisco
 
  curl -L http://cpanmin.us/ | perl - --notest --local-lib ~/perl5 App::Netdisco
Line 38: Line 39:
 
  cat <<'__EOF__'>~/environments/deployment.yml
 
  cat <<'__EOF__'>~/environments/deployment.yml
 
  database:
 
  database:
   name: 'netdisco'
+
   name: 'netdiscoDB'
   user: 'netdisco'
+
   user: 'netdiscoUSER'
   pass: 'netdisco'
+
   pass: '(PW som sattes tidigare)'
 
  safe_password_store: true
 
  safe_password_store: true
 
  snmp_auth:
 
  snmp_auth:

Revision as of 20:59, 28 December 2014

Netdisco hämtar MAC-tabeller, ARP-tabeller, VLAN-databaser, LLDP/CDP-grannskap, firmwareversioner, m.m från routrar och switchar med hjälp av SNMP. Man schemalägger när data ska samlas in.


Installation Ubuntu 14.04.1 LTS Server x64

Förberedelser

Denna guide är till stor del hämtad från: http://blog.asiantuntijakaveri.fi/2014/08/netdisco2-on-ubuntu-1404.html

sudo su -
apt-get update && apt-get -y dist-upgrade && apt-get -y install open-vm-tools build-essential wget lftp mtr-tiny zip ntp

Databas

apt-get -y install libdbd-pg-perl libsnmp-perl postgresql pgtune 
mv /etc/postgresql/9.3/main/postgresql.conf /etc/postgresql/9.3/main/postgresql.conf.old
pgtune -i /etc/postgresql/9.3/main/postgresql.conf.old -o /etc/postgresql/9.3/main/postgresql.conf

Switch to postgres user and create new SQL user

su - postgres
createuser -DRSP netdiscoUSER
Enter some password here
createdb --owner netdiscoUSER netdiscoDB

Switch back to root

exit

Netdisco

adduser netdisco --shell /bin/bash --disabled-password --gecos netdisco && su - netdisco
curl -L http://cpanmin.us/ | perl - --notest --local-lib ~/perl5 App::Netdisco
mkdir ~/bin
mkdir ~/environments
ln -s ~/perl5/bin/{localenv,netdisco-*} ~/bin/
~/bin/netdisco-daemon status

Här är grunden för deploymenten, lägg till de SNMP-communitys som ska användas. Schemaläggningen är i cron-format. T.ex. discoverall görs 10 över varje timme.

cat <<'__EOF__'>~/environments/deployment.yml
database:
 name: 'netdiscoDB'
 user: 'netdiscoUSER'
 pass: '(PW som sattes tidigare)'
safe_password_store: true
snmp_auth:
 - tag: 'default_1'
   community: 'puplic'
   read: true
   write: false
 - tag: 'default_2'
   community: 'public'
   read: true
   write: false
schedule:
 discoverall:
    when: '10 * * * *'
 macwalk:
    when: '35 * * * *'
 arpwalk:
    when: '45 * * * *'
 nbtwalk:
    when: '55 * * * *'
 expire:
    when: '15 23 * * *'
dns:
 max_outstanding: 50
workers:
 tasks: 'AUTO * 5'
__EOF__
~/bin/netdisco-deploy

Create script to start Netdisco

cat <<'__EOF__' >~/run-netdisco.sh
#!/bin/bash
~/bin/netdisco-web start
sleep 5
~/bin/netdisco-daemon start
__EOF__
chmod a+x ~/run-netdisco.sh
~/run-netdisco.sh

Switch back to root

exit 
echo "( sudo su - netdisco -c '/home/netdisco/run-netdisco.sh' ) &" >/etc/rc.local
reboot