netdisco can be a pain… even just getting it to run…

I found some neat installation scripts for installing netdisco on some other linux flavors, but I prefer ubuntu. I took those scripts and quickly hammered out one that’s ubuntu-specific. It’s not as pretty, and doesn’t allow you to do as much config by responding to script questions, but it gets netdisco up and running. You’ll likely tweak the config files in ways that make full configuration through the installation script not worthwhile anyways.

I tested this on Ubuntu 10.04beta. Just copy it into a file (or click the download link), make it executable, and be sure to run as root.

Cheers!

download here

Preview:

# courtesy of http://www.mattvsworld.com
 
# This script will install Netdisco on an Ubuntu system
# using apache2 and mod_perl2.
# UNSUPPORTED -  Please use at your own risk.
# Parts of this script were inspired by another script contributed by Kaven Rousseau and was modified for CentOS by Walter Gould:
# http://www.auburn.edu/~gouldwp/netdisco/
 
# Note: - this script should be run as root (sudo ./install_netdisco_ubuntu.sh)
#       - you may STILL need to make modifications to netdisco.conf and netdisco.crontab to make it work on your network
#       - you will likely also want to run the following after installation:
#         /usr/local/netdisco/netdisco -r [your central network device]
#         /usr/local/netdisco/netdisco -m
#         /usr/local/netdisco/netdisco -g
 
# install required packages
apt-get install postgresql apache2 graphviz libnet-snmp-perl libapache2-mod-perl2 libapache-session-wrapper-perl libhtml-mason-perl libdbd-pg-perl libgraphviz-perl libio-zlib-perl libapache2-request-perl libnet-nbname-perl libsnmp-info-perl libapache-dbi-perl libmasonx-request-withapachesession-perl libparallel-forkmanager-perl libgraph-perl
 
# get/extract netdisco source
wget http://downloads.sourceforge.net/project/netdisco/netdisco/1.0/netdisco-1.0_with_mibs.tar.gz?use_mirror=iweb
tar xzvf netdisco-1.0_with_mibs.tar.gz
 
# move to /usr/local/netdisco
mkdir -p /usr/local/netdisco
mv netdisco-1.0/* /usr/local/netdisco
 
# ensure needed directories
sudo mkdir -p /usr/local/netdisco/data/logs
 
# create netdisco user
useradd -d /usr/local/netdisco netdisco
chown -R netdisco:netdisco /usr/local/netdisco
 
# ensure apache modules enabled
a2enmod perl
a2enmod apreq
 
# alter postgres config
mv /etc/postgresql/8.4/main/pg_hba.conf /etc/postgresql/8.4/main/pg_hba.conf.orig
cat /etc/postgresql/8.4/main/pg_hba.conf.orig | sed "s/# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD/# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD\n# netdisco\nlocal sameuser netdisco trust/g" > /etc/postgresql/8.4/main/pg_hba.conf
 
# restart postgres
/etc/init.d/postgresql-8.4 restart
 
# set up db
/usr/local/netdisco/sql/pg --init
 
# set up crontab
crontab -u netdisco /usr/local/netdisco/netdisco.crontab
 
# set up daemon
ln -s /usr/local/netdisco/bin/netdisco_daemon /etc/init.d/netdisco
update-rc.d netdisco defaults
 
# add apache config
echo "Include /usr/local/netdisco/netdisco_apache.conf" > /etc/apache2/conf.d/netdisco.conf
echo "Include /usr/local/netdisco/netdisco_apache_dir.conf" >> /etc/apache2/conf.d/netdisco.conf
 
# restart apache
/etc/init.d/apache2 restart
 
# create first admin user
/usr/local/netdisco/netdisco -u admin
 
# init oui data
curdir = `pwd`
cd /usr/local/netdisco 
make oui
cd $curdir
 
# per Kelly Schuerman's comments on mattvsworld.com (thanks!):
# uncomment the next two lines to set ownership of front-end files to www-data:www-data
#chown -R www-data:www-data /usr/local/netdisco/html
#chown -R www-data:www-data /usr/local/netdisco/mason 
 
# start up front end
/etc/init.d/netdisco start

{ 7 comments }

autotest with rspec-2.0 beta

March 19, 2010

Just saw this, made me happy:
http://github.com/rspec/rspec-core/commit/c1d600cd4367fb24a333c3f27f3b27693745ad14
So you can now run autotest without a bunch of (uglier) hacks just by adding the file autotest/discover.rb to the root of your project with this inside:

Autotest.add_discovery { "rspec2" }

note that you’ll need at least rspec version 2.0.0.beta4 (beta3 does *not* have this)
and once again return to autotest bliss…
cheez!

Read the full article →

rails 3, bundler, capistrano

March 17, 2010

Deploying a rails app with capistrano got just a little bit trickier with the new bundler integration. Here’s a super-simplified task you can tack onto the end of your deployment recipe to make sure that your server gets a bundle set up (and updated, if need be):

namespace :bundler do
task :create_symlink, :roles => :app [...]

Read the full article →

word movement in mac os x terminal (bash) — ctrl-left and ctrl-right

March 15, 2010

I’ve been irritated by this for quite a while, I’m surprised it took me this long to “fix”…
In bash there are two keyboard shortcuts that generally work by default on most linux systems: control-left and control-right, mapped to movement by word. For some reason on mac os x (at least for me), the default [...]

Read the full article →

rails 3 beta – “uninitialized constant ActionDispatch::Integration::Session::Test”

March 15, 2010

I just set up a new rails project with the 3.0 beta, and when I tried to run some cucumber tests I got the following:

uninitialized constant ActionDispatch::Integration::Session::Test (NameError)

Seems that there isn’t an explicit require of ‘test/unit/testcase’ in rails/actionpack/lib/action_dispatch/testing/integration.rb, but here is this line:

127
include Test::Unit::Assertions

To get around the problem you [...]

Read the full article →

disable php in an apache virtualhost

March 14, 2010

As long as I’m messing with apache configs, I’ll share another quick tip. If you have PHP generally enabled in apache, but you want to disable it in a certain VirtualHost, just add the line “php_admin_value engine off” and you’ll be all good. PHP will work elsewhere, but it will be off inside [...]

Read the full article →

controlling the default site in apache configs

March 14, 2010

I configure apache about once every 3 months, so every time I get into the files I feel like I’m learning it all over again. Apache has a ton of config options, and a ton of documentation, as well as all kinds of random sites with “help” on setting it up. This means [...]

Read the full article →