source: trunk/dports/net/netmrg/Portfile

Last change on this file was 125738, checked in by mf2k@…, 3 years ago

adodb argus-monitor base blt cacti cdpr doclifter eventlog expect gkrellm honeyd iwidgets kchmviewer libdnsres monarch moodss moomps nagios nagios-plugins nedi netmrg network-weathermap nfdump nfsen nrg nrpe nsca ntop p5-archive-zip p5-cgi p5-cgi-speedycgi p5-convert-asn1 p5-libintl-perl p5-mhonarc p5-net p5-perl-ldap rancid rrdtool scotty sendpage smokeping snort sympa syslog-ng tclx tftp-hpa tktable uplog vm-pop3d xserve-raid-tools zabbix: Ports abandoned by markd. (#44782)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.8 KB
Line 
1# $Id: Portfile 125738 2014-09-25 14:43:03Z ryandesign@macports.org $
2
3PortSystem      1.0
4
5name                    netmrg
6version                 0.20
7categories              net
8maintainers             nomaintainer
9description             An RRDtool frontend for network monitoring, reporting, and graphing \
10                        that generates day/week/month MRTG style graphs.
11long_description        ${description}
12homepage                http://www.netmrg.net/
13platforms               darwin
14master_sites            http://www.netmrg.net/download/release/
15checksums               md5 47bec3b8a4d3a5c06c70925ee8d280be
16
17depends_lib             path:bin/mysql_config5:mysql5 \
18                        port:rrdtool \
19                        port:libxml2
20
21configure.args          --with-mysql_config=${prefix}/lib/mysql5/bin/mysql_config \
22                        --with-snmp-lib-dir=/usr/lib \
23                        --with-rrdtool=${prefix}/bin
24
25variant server  {
26# This variant doesn't do anything in this port, it only exists to trigger the server
27# variant in the mysql5 port.
28}
29
30variant_set server
31
32post-extract {
33        reinplace "s|mysql/mysql.h|${prefix}/include/mysql5/mysql/mysql.h|g" \
34                ${worksrcpath}/src/include/db.h
35
36        reinplace "s|<socket></socket>|<socket>${prefix}/var/run/mysql5/mysqld.sock</socket>|g" \
37                ${worksrcpath}/etc/netmrg.xml.in
38
39        reinplace "s|<version>1.0</version>|<version>1.2</version>|g" \
40                ${worksrcpath}/etc/netmrg.xml.in
41}
42
43post-destroot {
44        xinstall -m 755 -d ${destroot}${prefix}/var/log/netmrg
45        destroot.keepdirs ${destroot}${prefix}/var/log/netmrg
46        system "chown -R www:www ${destroot}${prefix}/var/lib/netmrg/rrd/"
47        system "chown -R www:www ${destroot}${prefix}/var/log/netmrg"
48}
49
50post-activate {
51
52ui_msg "\n
53
54        ******************************************************************
55        ****             Complete the NetMRG Installation             ****
56        ******************************************************************
57
58Full information at http://wiki.netmrg.net/wiki/Users_Manual.
59
601) Setup MySQL
61
62   Configure MySQL:
63        sudo -u mysql ${prefix}/lib/mysql5/bin/mysql_install_db
64
65   Start MySQL:
66        sudo ${prefix}/share/mysql5/mysql/mysql.server start
67
68   Set MySQL to run at system boot
69        sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
70
71   Set the root MySQL password:
72        Follow the instructions that were given after you executed 'mysql_install_db' above.
73
74
752) Install PHP 4 or 5 (not covered)
76
77   Set mysql.default_socket path to ${prefix}/var/run/mysql5/mysqld.sock in the PHP file:
78
79        ./phpx/lib/php.ini (in /usr/local, ${prefix}, or /Library depending on PHP package)
80
81
823) Setup the NetMRG database
83        mysql5 -u root -p
84        mysql> create database netmrg;
85        mysql> exit
86
87   Import the netmrg database
88        cd ${prefix}/share/netmrg/db
89        cat netmrg.mysql | mysql5 -u root -p netmrg
90
91   Verify NetMRG DB:
92        mysql5 -u root -p
93        mysql> use netmrg;
94        mysql> show tables;
95        mysql> exit;
96
97   Set permissions on the NetMRG database
98        grant all on netmrg.* to netmrg@localhost identified by 'mynetmrg-password';
99
100
1014) Set a symlink from the NetMRG web frontend to your Apache root directory
102        sudo ln -s ${prefix}/var/www/netmrg/webfiles /<Apache Doc Root>/netmrg
103
104
1055) Edit the NetMRG preferences file ${prefix}/etc/netmrg.xml
106
107   MySQL preferences:
108                <user>netmrg</user>                             (MySQL user)
109                <password><my-netmrg-passsword></password>      (MySQL password)
110                <db>netmrg</db>                                 (MySQL database name)
111
112   Other preferences if desired: website, polling, and logging
113
1146) Test polling and set polling in cron
115
116        sudo -u www ${prefix}/bin/netmrg-gatherer -a (-a is for verbose output)
117
118   NOTE: If you do not run netmrg as user www, then set permissions to that user:
119        sudo chown -R netmrg-user:netmrg-user ${prefix}/var/log/netmrg/
120        sudo chown -R netmrg-user:netmrg-user ${prefix}/var/lib/netmrg/rrd
121
122   Once you are satisfied polling is operating correctly, set the netmrg user's
123   crontab to poll every 5 minutes.
124
125        sudo -u <netmrg-user> crontab -e
126
127        */5 * * * *  ${prefix}/bin/netmrg-gatherer
128
129
1307) Point your web browser to http:/loalhost/netmrg and login to NetMRG
131
132        The default user/pass is admin/nimda
133
134
135
136        ******************************************************************
137        ****        Graphing an Ethernet Switch - Quickstart          ****
138        ******************************************************************
139
140
1411) Define a custom graph template for your Ethernet switches
142
143Click Template Graphs and click the 'Duplicate' icon beside item
144'Linux Box - LAN Traffic'.  Now edit the duplicate template and change
145the name and title:
146
147Name:           Cisco - LAN Traffic
148Title:          %dev_name% - %ifDescr%%n - %ifAlias% (ifAlias is optional)
149Comment:        Interface: %ifDescr% - %ifAlias% (ifAlias is optional)
150Vert label:     bytes / sec
151
152Click 'Save Changes'.
153
154
1552) Monitor an Ethernet switch via SNMP
156
157Click Admin and add a Template Group called 'Cisco Switches'
158
159Add an Ethernet switch called 'Switch-A' under Monitored Devices for the
160Cisco Switches group, set the IP or hostname, SNMP version, and community string.
161Click Save.
162
163Click the Recache Interfaces' icon next to the new item Switch-A.  NetMRG will
164draw a table of Switch-A's interfaces including:
165
166-Interface index number
167-Status (Up/Up, Up/Down, etc)
168-Name (Fa0/1, Gig3/12, etc)
169-Alias (Cisco IOS user customizable description)
170-IP address (if any)
171-Mac Address
172
173Select the 'Cisco - LAN Traffic' template in the lower right corner of the window,
174click the checkbox beside each interface you want to graph, and then click the
175'Monitor/Graph All Checked' link.
176
177Click Admin -> Cisco Switches -> Switch A and notice that the interface(s)
178you selected are now listed as sub-devices of Switch-A.
179
180
1813) View your graphs
182
183Click Reporting -> Tree -> Cisco Switches -> Switch-A.  The orange graph icon links
184will display your graphs.
185
186'Device' graph links display graphs for all interfaces on a page.
187'Sub-Device' graph links display graphs for a single sub-device interface.
188\n"
189}
Note: See TracBrowser for help on using the repository browser.