# $Id$ PortSystem 1.0 name nedi version 1.0.w-rc4 categories net maintainers markd@macports.org platforms darwin description Network Discovery Suite long_description A low noise network discovery, management, and inventory \ system for Cisco networks with a user friendly web interface. homepage http://www.nedi.ch/ master_sites sourceforge distname ${name}-${version} extract.suffix .tgz checksums md5 050933375bb23537ad34e382ee977e07 default_variants +server depends_lib port:perl5.8 \ port:mysql5 \ port:p5-net-snmp \ port:p5-net-telnet \ port:p5-net-telnet-cisco \ port:p5-algorithm-diff \ port:p5-dbi \ port:p5-dbd-mysql \ port:rrdtool worksrcdir ${name} variant server { # This variant doesn't do anything in this port, it only exists to trigger the server # variant in the mysql5 port. } use_configure no patch {} build {} destroot { set nedidir ${prefix}/share/ xinstall -m 755 -d ${destroot}${nedidir} system "cp -R ${worksrcpath} ${destroot}${nedidir}" # Keep nedi.conf from prying eyes because it has passwords! system "chmod 600 ${destroot}${prefix}/share/${name}/nedi.conf" # Create directory for rrd files xinstall -m 755 -d ${destroot}${prefix}/share/${name}/rrd } post-destroot { # Fix paths eval reinplace "s|/usr/bin/perl|${prefix}/bin/perl|g" \ [glob ${destroot}${prefix}/share/${name}/*.pl] \ [glob ${destroot}${prefix}/share/${name}/inc/*.pl] \ [glob ${destroot}${prefix}/share/${name}/html/inc/*.pl] reinplace "s|netstat|/usr/sbin/netstat|g" \ ${destroot}${prefix}/share/${name}/inc/libmisc.pl reinplace "s|/etc/nedi.conf|${prefix}/share/nedi/nedi.conf|g" \ ${destroot}${prefix}/share/${name}/html/inc/libmisc.php # RRDtool paths reinplace "s|\"rrdtool\"|\"${prefix}/bin/rrdtool\"|g" \ ${destroot}${prefix}/share/${name}/inc/libmisc.pl reinplace "s|/var/nedi/rrd|${prefix}/share/${name}/rrd|g" \ ${destroot}${prefix}/share/${name}/html/inc/drawrrd.php reinplace "s|\"rrdtool\"|\"${prefix}/bin/rrdtool\"|g" \ ${destroot}${prefix}/share/${name}/html/inc/drawrrd.php # Keep these empty directories destroot.keepdirs \ ${destroot}${prefix}/share/${name}/db/cfg \ ${destroot}${prefix}/share/${name}/html/log \ ${destroot}${prefix}/share/${name}/rrd } post-activate { ui_msg "\n#### To complete the NeDi OS X installation #### 1) Setup MySQL (for new installs) ----------------------------------------------- -Configure MySQL: sudo -u mysql ${prefix}/lib/mysql5/bin/mysql_install_db -Start MySQL and set it to run at system boot: sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist -Set the root MySQL password: Follow the instructions that were given after you executed 'mysql_install_db' above. 2) Install PHP5 with SNMP support and Apache 2 ------------------------------------------------ sudo port install php5 +apache2 +mysql5 +snmp sudo ${prefix}/apache2/bin/apxs -a -e -n \"php5\" libphp5.so 3) Turn on Apache 2 ------------------------------------------------ Turn off Apple's Apache 1.3 (Personal Web Sharing in System Preferences). Then execute these commands: cd ${prefix}/apache2/conf sudo cp httpd.conf.sample httpd.conf Edit the user/group variables in the Apache 2 httpd.conf to be your selected NeDi user/group. Start Apache 2 and set it to run at system boot: sudo launchctl load -w /Library/LaunchdDaemons/org.macports.apache2.plist 4) Configure NeDi, initialize database, and Login to NeDi ----------------------------------------------- -Set NeDi owner: sudo chown -R : ${prefix}/share/${name}/ -Apache symlink: ln -s ${prefix}/share/${name}/html/ ${prefix}/apache2/htdocs/nedi -Edit nedi.conf Backend/Authen/Device Access sections: sudo pico ${prefix}/share/${name}/nedi.conf Leave nedi.conf permissions at 600 to protect your network passwords! backend MSQ dbpass authuser mysql comm (community string of your Cisco devices) (user/pass of your Cisco devices) -Initialize the NeDi database: cd ${prefix}/share/${name} sudo ./nedi.pl -i When prompted for \"MySQL admin user:\" and enter 'root' and then MySQL root password. -Set Nedi MySQL user to use old style passwords mysql -u root -p mysql> SET PASSWORD FOR nedi@localhost = OLD_PASSWORD(''); -Verify the NeDi DB: mysql -u root -p mysql> use nedi; mysql> show tables; mysql> exit; -Login to the NeDi web interface: http://localhost/nedi/index.php Initial user/pass is 'admin'/'admin' 5) Discover Your Network with NeDi ----------------------------------------------- -Edit nedi.conf Device Acc. variables: sudo pico ${prefix}/share/${name}/nedi.conf comm -Make any other desired changes in nedi.conf -Start NeDi data collection: cd ${prefix}/share/${name}/nedi.pl sudo -u nedi.pl -c -d (debug) -Put a command in the crontab to discover your network at regular intervals. A typical interval is 1 hour; to get accurate NeDi rrdtool graphs at NeDi's default settings you must run NeDi at 1 hour intervals. Otherwise, you must adjust NeDi's default rrdtool settings. To run NeDi every hour, the cron entry is: 0 * * * * cd ${prefix}/share/${name} ; ./nedi.pl -c >> /dev/null 2>&1 \n" }