[24365] trunk/dports/net/nedi

source_changes at macosforge.org source_changes at macosforge.org
Mon Apr 23 14:08:50 PDT 2007


Revision: 24365
          http://trac.macosforge.org/projects/macports/changeset/24365
Author:   markd at macports.org
Date:     2007-04-23 14:08:49 -0700 (Mon, 23 Apr 2007)

Log Message:
-----------
1) Add startupitems for NeDi alert daemon and OS X's snmptrapd daemon.
2) Install nedi.conf as nedi.conf.sample to make upgrades safe.
3) Update ui_msg's to cover enabling alerts and SNMP traps.

Modified Paths:
--------------
    trunk/dports/net/nedi/Portfile

Added Paths:
-----------
    trunk/dports/net/nedi/files/
    trunk/dports/net/nedi/files/org.macports.snmptrapd.plist

Modified: trunk/dports/net/nedi/Portfile
===================================================================
--- trunk/dports/net/nedi/Portfile	2007-04-23 20:44:50 UTC (rev 24364)
+++ trunk/dports/net/nedi/Portfile	2007-04-23 21:08:49 UTC (rev 24365)
@@ -1,47 +1,52 @@
-# $Id$
+# $Id:
 
 PortSystem	1.0
 
-name				nedi
-version				1.0.w
-revision			1
-categories			net
-maintainers			markd at macports.org
-platforms			darwin
+name			nedi
+version			1.0.w
+revision		2
+categories		net
+maintainers		markd at macports.org
+platforms		darwin
 
-description			Network Discovery Suite
+description		Network Discovery Suite
 
-long_description	        A low noise network discovery, management, and inventory \
-				system for Cisco networks with a user friendly web interface.
+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
+homepage		http://www.nedi.ch/
+master_sites	        sourceforge
 
-distname                        ${name}-${version}
-extract.suffix			.tgz
+distname		${name}-${version}
+extract.suffix		.tgz
+worksrcdir		${name}
+checksums		md5 cd1ce2df6bac11d51679bd491619f564
+default_variants	+server
 
-checksums			md5 cd1ce2df6bac11d51679bd491619f564
-default_variants		+server
+depends_lib		port:perl5.8 \
+			port:mysql5 \
+			port:p5-net-snmp \
+			port:p5-net-ssh-perl \
+			port:p5-net-telnet \
+			port:p5-net-telnet-cisco \
+			port:p5-algorithm-diff \
+			port:p5-dbi \
+			port:p5-dbd-mysql \
+			port:rrdtool
 
-depends_lib			port:perl5.8 \
-				port:mysql5 \
-				port:p5-net-snmp \
-				port:p5-net-ssh-perl \
-				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.
+# variant in the mysql5 port in cases where mysql5 was not already installed.
 }
 
-use_configure			no
+startupitem.create	yes
+startupitem.name	nedimonitor
+startupitem.start	"${prefix}/share/${name}/moni.pl"
+
+variant snmptrapd {
+}
+
+use_configure		no
 patch {}
 build {}
 
@@ -49,16 +54,10 @@
 	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
+# Fix general paths
        eval reinplace "s|/usr/bin/perl|${prefix}/bin/perl|g" \
                 [glob ${destroot}${prefix}/share/${name}/*.pl] \
 		[glob ${destroot}${prefix}/share/${name}/inc/*.pl] \
@@ -69,7 +68,7 @@
 
         reinplace "s|/etc/nedi.conf|${prefix}/share/nedi/nedi.conf|g" \
                 ${destroot}${prefix}/share/${name}/html/inc/libmisc.php
-# RRDtool paths
+# Fix 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" \
@@ -77,19 +76,54 @@
 	reinplace "s|\"rrdtool\"|\"${prefix}/bin/rrdtool\"|g" \
                 ${destroot}${prefix}/share/${name}/html/inc/libgraph.php
 
+# Create directory for rrd files
+        xinstall -m 755 -d ${destroot}${prefix}/share/${name}/rrd
+
 # Keep these empty directories
         destroot.keepdirs \
                 ${destroot}${prefix}/share/${name}/db/cfg \
 		${destroot}${prefix}/share/${name}/html/log \
 		${destroot}${prefix}/share/${name}/rrd
+
+# Rename nedi.conf to nedi.conf.sample so port upgrades don't overwrite an installed nedi.conf
+# Also set permissions on nedi.conf because it has passwords.
+	file rename ${destroot}${prefix}/share/${name}/nedi.conf \
+		${destroot}${prefix}/share/${name}/nedi.conf.sample
+		system "chmod 600 ${destroot}${prefix}/share/${name}/nedi.conf.sample"
 }
 
+pre-install {
+# MacPorts currently only supports one startupitem per portfile, and if the snmptrapd
+# variant was invoked that makes two.  So use the snmptrapd.plist file from filespath
+# and copy and link it as startupitem's do.
+	if { [variant_isset snmptrapd] } {
+	file mkdir ${destroot}${prefix}/etc/LaunchDaemons/org.macports.snmptrapd/
+	file copy ${filespath}/org.macports.snmptrapd.plist \
+		${destroot}${prefix}/etc/LaunchDaemons/org.macports.snmptrapd/
+	system "cd /Library/LaunchDaemons && ln -sf \
+		${prefix}/etc/LaunchDaemons/org.macports.snmptrapd/org.macports.snmptrapd.plist"
+	}
+}
 
 post-activate {
 
 ui_msg "\n#### To complete the NeDi OS X installation ####
 
-1) Setup MySQL (for new installs)
+
+1) Using NeDi as an SNMP trap receiver
+----------------------------------------------
+-If you want to use NeDi to receive SNMP traps, you must install the NeDi port
+ using the MacPorts variant +snmptrapd as shown:
+
+	sudo port install nedi +snmptrapd 
+
+-If the snmptrapd variant was not used to install NeDi, remove NeDi so it can be reinstalled.
+
+	sudo port uninstall nedi
+	sudo port clean --all nedi
+
+
+2) Setup MySQL (for new installs)
 -----------------------------------------------
 -Configure MySQL:
         sudo -u mysql ${prefix}/lib/mysql5/bin/mysql_install_db
@@ -101,17 +135,17 @@
    Follow the instructions that were given after you executed 'mysql_install_db' above.
 
 
-2) Install PHP5 with SNMP support and Apache 2
+3) 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
+4) Turn on Apache 2
 ------------------------------------------------
-   Turn off Apple's Apache 1.3 (Personal Web Sharing in System Preferences).  Then execute
-   these commands:
+-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
@@ -122,7 +156,7 @@
 	sudo launchctl load -w /Library/LaunchdDaemons/org.macports.apache2.plist
 
 
-4) Configure NeDi, initialize database, and Login to NeDi
+5) Configure NeDi, initialize database, and Login to NeDi
 -----------------------------------------------
 -Set NeDi owner: sudo chown -R <nedi-user>:<nedi-group> ${prefix}/share/${name}/
 -Apache symlink: ln -s ${prefix}/share/${name}/html/  ${prefix}/apache2/htdocs/nedi
@@ -154,7 +188,7 @@
 	Initial user/pass is 'admin'/'admin'
 
 
-5) Discover Your Network with NeDi
+6) Discover Your Network with NeDi
 -----------------------------------------------
 -Edit nedi.conf Device Acc. variables: sudo pico ${prefix}/share/${name}/nedi.conf
 
@@ -172,5 +206,21 @@
 	NeDi every hour, the cron entry is:
 
 0 * * * * cd ${prefix}/share/${name} ; ./nedi.pl -c >> /dev/null 2>&1
+
+
+7) Set NeDi to receive device alerts and SNMP traps.  (optional)
+-----------------------------------------------
+-To enable NeDi alerts"
+
+	sudo load lauchctl load -w /Library/LaunchDaemons/org.macports.nedimonitor.plist
+
+-To enable the NeDi SNMP trap receiver: (See Step 1 about the +snmptrapd variant)
+ Use the snmpconf Unix utility to create an snmptrapd.conf file with the entry:
+
+	traphandle      default ${prefix}/share/nedi/trap.pl
+
+-Then load the startup script to run the Unix snmptrapd daemon:
+
+	sudo load lauchctl load -w /Library/LaunchDaemons/org.macports.snmptrapd.plist
 \n"
 }

Added: trunk/dports/net/nedi/files/org.macports.snmptrapd.plist
===================================================================
--- trunk/dports/net/nedi/files/org.macports.snmptrapd.plist	                        (rev 0)
+++ trunk/dports/net/nedi/files/org.macports.snmptrapd.plist	2007-04-23 21:08:49 UTC (rev 24365)
@@ -0,0 +1,37 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
+http://www.apple.com/DTDs/PropertyList-1.0.dtd >
+<plist version='1.0'>
+<dict>
+
+<key>Label</key><string>org.macports.snmptrapd</string>
+<key>ProgramArguments</key>
+<array>
+	<string>/usr/sbin/snmptrapd</string>
+</array>
+
+<key>Debug</key><false/>
+<key>Disabled</key><false/>
+<key>OnDemand</key><false/>
+<key>RunAtLoad</key><false/>
+
+
+<key>inetdCompatibility</key>
+        <dict>
+                <key>Wait</key>
+                <false/>
+        </dict>
+	<key>InitGroups</key>
+        <true/>
+	<key>Sockets</key>
+        <dict>
+                <key>Listeners</key>
+                <dict>
+                        <key>SockServiceName</key>
+                        <string>snmptrap</string>
+                </dict>
+        </dict>
+
+
+</dict>
+</plist>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070423/b68ec46f/attachment.html


More information about the macports-changes mailing list