source: trunk/dports/net/nedi/Portfile @ 128981

Last change on this file since 128981 was 128981, checked in by devans@…, 4 years ago

nedi: update to version 1.0.9, switch from perl5.12 to perl5.16, fix up destroot processing (#40700, #44405).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.4 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 128981 2014-12-01 23:52:47Z devans@macports.org $
3
4PortSystem          1.0
5
6name                nedi
7version             1.0.9
8license             GPL-3
9categories          net
10maintainers         nomaintainer
11platforms           darwin
12
13description         Network Discovery Suite
14
15long_description    A low noise network discovery, management, and inventory \
16                    system for Cisco networks with a user friendly web interface.
17
18homepage            http://www.nedi.ch/
19master_sites        http://www.nedi.ch/pub
20
21extract.mkdir       yes
22extract.suffix      .tgz
23
24checksums           rmd160  776b178b4fd3fe139796dbc367ae0e626f6ccaa1 \
25                    sha256  cf004dafb781f1ac638b2291ea565d3c3972eb5dd049f9119b46dbc66f722f13
26
27depends_lib         port:perl5.16 \
28                    path:bin/mysql_config5:mysql5 \
29                    port:p5.16-net-snmp \
30                    port:p5.16-net-ssh-perl \
31                    port:p5.16-net-telnet \
32                    port:p5.16-net-telnet-cisco \
33                    port:p5.16-libwww-perl \
34                    port:p5.16-algorithm-diff \
35                    port:p5.16-dbi \
36                    port:p5.16-dbd-mysql \
37                    port:rrdtool \
38                    port:fping
39
40
41# Set some useful variables
42set nedidir         ${prefix}/share/${name}
43set rrdbin          ${prefix}/bin/rrdtool
44set rrdfiles        ${nedidir}/rrd
45set fpingpath       ${prefix}/sbin
46set cacticlidir     ${prefix}/share/cacti/cli
47
48startupitem.create  yes
49startupitem.name    nedimonitor
50startupitem.executable  ${nedidir}/moni.pl
51
52use_configure       no
53build {}
54
55destroot {
56# create directories
57    file mkdir ${destroot}/Library/LaunchDaemons
58    file mkdir ${destroot}${nedidir}
59
60# copy content to destroot
61    eval copy [glob ${worksrcpath}/*] ${destroot}${nedidir}
62}
63
64post-destroot {
65
66# Fix general paths
67    eval reinplace "s|^#!.*|#!${prefix}/bin/perl5.16|" \
68        [glob ${destroot}${nedidir}/*.pl] \
69        [glob ${destroot}${nedidir}/contrib/*.pl] \
70        [glob ${destroot}${nedidir}/inc/*.pl]
71
72    reinplace "s|netstat|/usr/sbin/netstat|g" \
73        ${destroot}${nedidir}/inc/libmisc.pm
74
75    reinplace "s|/etc/nedi.conf|${nedidir}/nedi.conf|g" \
76        ${destroot}${nedidir}/html/inc/libmisc.php
77
78# Fix rrdcmd location in nedi.conf
79    reinplace "s|rrdtool|${rrdbin}|g" \
80        ${destroot}${nedidir}/nedi.conf
81
82# Fix fping path
83    reinplace "s|/usr/local/sbin|${fpingpath}|g" \
84        ${destroot}${nedidir}/html/Nodes-Toolbox.php
85
86# Fix Cacti paths in nedi.conf
87    reinplace "s|/usr/bin/php /var/www/html/cacti/cli|${prefix}/bin/php ${cacticlidir}|g" \
88        ${destroot}${nedidir}/nedi.conf
89
90# Create directory for rrd files
91        xinstall -m 755 -d ${destroot}${rrdfiles}
92
93# Keep these empty directories
94        destroot.keepdirs \
95                ${destroot}${nedidir}/db/cfg \
96        ${destroot}${nedidir}/html/log \
97        ${destroot}${rrdfiles}
98
99# Rename nedi.conf to nedi.conf.sample so port upgrades don't overwrite an installed nedi.conf
100# Also set permissions on nedi.conf because it has passwords.
101    file rename ${destroot}${nedidir}/nedi.conf \
102        ${destroot}${nedidir}/nedi.conf.sample
103        system "chmod 600 ${destroot}${nedidir}/nedi.conf.sample"
104
105# MacPorts can create only one startupitem per portfile.  So copy nedisyslog.plist
106# from filespath and link it into /Library/LaunchDaemons as startupitem's do.
107
108    xinstall -m 755 -d ${destroot}${prefix}/etc/LaunchDaemons/org.macports.nedisyslog/
109    xinstall -m 755 ${filespath}/org.macports.nedisyslog.plist \
110        ${destroot}${prefix}/etc/LaunchDaemons/org.macports.nedisyslog/
111    ln -s ${prefix}/etc/LaunchDaemons/org.macports.nedisyslog/org.macports.nedisyslog.plist \
112        ${destroot}/Library/LaunchDaemons
113}
114
115notes \
116  "**** To complete the NeDi OS X installation ****
117
118
1191) Setup MySQL (for new installs)
120-----------------------------------------------
121-Configure MySQL:
122        sudo -u mysql ${prefix}/lib/mysql5/bin/mysql_install_db
123
124-Start MySQL and set it to run at system boot:
125    sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
126
127-Set the root MySQL password (replace <mypassword> with your chosen password):
128    sudo ${prefix}/lib/mysql5/bin/mysqladmin -u root password <mypassword>
129
130
1312) Install PHP5 with SNMP support and MacPorts Apache
132------------------------------------------------
133    sudo port install php5 +apache2 +mysql5 +snmp
134
135    sudo ${prefix}/apache2/bin/apxs -a -e -n \"php5\" libphp5.so
136
137NOTE: Check to make sure the PHP variable \"mysql.default_socket\" is set to path
138 ${prefix}/var/run/mysql5/mysqld.sock by viewing the output of this terminal command:
139        php -i
140
141
1423) Turn on MacPorts Apache
143------------------------------------------------
144-Turn off Apple's built-in Apache (Personal Web Sharing in System Preferences).  Then execute
145   these commands:
146    cd ${prefix}/apache2/conf
147    sudo cp httpd.conf.sample httpd.conf
148
149-Edit your httpd.conf
150   Change the user/group variables in the Apache httpd.conf to be the Unix user/group that
151     you'll use to run the NeDi executable
152
153   Add an alias statement:
154    Alias /nedi \"${prefix}/share/nedi/html\"
155
156-Start Apache and set it to run at system boot:
157    sudo launchctl load -w /Library/LaunchdDaemons/org.macports.apache2.plist
158
159
1604) Configure NeDi, initialize NeDi database, and Login to NeDi
161-----------------------------------------------
162-Set NeDi owner: sudo chown -R <nedi-user>:<nedi-group> ${nedidir}
163
164-Edit nedi.conf Backend/Authen/Device Access sections: sudo pico ${nedidir}/nedi.conf
165    Leave nedi.conf permissions at 600 to protect your network passwords!
166
167backend     MSQ
168dbpass      <nedidb-password>
169authuser    mysql
170
171comm <my-community-string> (community string of your Cisco devices)
172<usr> <pass> <enablepass> (user/pass of your Cisco devices)
173
174-Initialize the NeDi database:
175    cd ${nedidir}
176    sudo ./nedi.pl -i
177    When prompted for \"MySQL admin user:\" and enter 'root' and then MySQL root password.
178
179-Verify the NeDi DB:
180        mysql -u root -p
181        mysql> use nedi;
182        mysql> show tables;
183        mysql> exit;
184
185-Login to the NeDi web interface: http://localhost/nedi
186    Initial user/pass is 'admin'/'admin'
187
188
1895) Discover Your Network with NeDi
190-----------------------------------------------
191-Edit nedi.conf Device Acc. variables: sudo pico ${nedidir}/nedi.conf
192
193comm <my-community-string>
194<usr>  <pass>  <enablepass>
195
196-Make any other desired changes in nedi.conf
197
198-Start NeDi data collection:
199    cd ${nedidir}
200    sudo -u <nedi-user> nedi.pl -pr (options shown set CDP and routing tables for discovery)
201
202-Put a command in the crontab to discover your network at regular intervals.
203    A typical interval is 1 hour; to get accurate NeDi rrdtool graphs at
204    NeDi's default settings you must run NeDi at 1 hour intervals.
205    Otherwise, you must adjust NeDi's default rrdtool settings.  To run
206    NeDi every hour, the cron entry is:
207
2080 * * * * cd ${nedidir} ; ./nedi.pl -pr >> /dev/null 2>&1
209
210
2116) Set NeDi to receive device alerts, syslogs, and SNMP traps.  (optional)
212-----------------------------------------------
213-To enable NeDi alerts
214
215    sudo launchctl load -w /Library/LaunchDaemons/org.macports.nedimonitor.plist
216
217-To enable the NeDi syslog daemon:
218
219    sudo launchctl load -w /Library/LaunchDaemons/org.macports.nedisyslog.plist"
220
221livecheck.type      regex
222livecheck.url       http://www.nedi.ch/download/
223livecheck.regex     "current\.*${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
Note: See TracBrowser for help on using the repository browser.