# $Id$ PortSystem 1.0 name netmrg version 0.20 categories net maintainers nomaintainer description An RRDtool frontend for network monitoring, reporting, and graphing \ that generates day/week/month MRTG style graphs. long_description ${description} homepage http://www.netmrg.net/ platforms darwin master_sites http://www.netmrg.net/download/release/ checksums md5 47bec3b8a4d3a5c06c70925ee8d280be depends_lib path:bin/mysql_config5:mysql5 \ port:rrdtool \ port:libxml2 configure.args --with-mysql_config=${prefix}/lib/mysql5/bin/mysql_config \ --with-snmp-lib-dir=/usr/lib \ --with-rrdtool=${prefix}/bin variant server { # This variant doesn't do anything in this port, it only exists to trigger the server # variant in the mysql5 port. } variant_set server post-extract { reinplace "s|mysql/mysql.h|${prefix}/include/mysql5/mysql/mysql.h|g" \ ${worksrcpath}/src/include/db.h reinplace "s||${prefix}/var/run/mysql5/mysqld.sock|g" \ ${worksrcpath}/etc/netmrg.xml.in reinplace "s|1.0|1.2|g" \ ${worksrcpath}/etc/netmrg.xml.in } post-destroot { xinstall -m 755 -d ${destroot}${prefix}/var/log/netmrg destroot.keepdirs ${destroot}${prefix}/var/log/netmrg system "chown -R www:www ${destroot}${prefix}/var/lib/netmrg/rrd/" system "chown -R www:www ${destroot}${prefix}/var/log/netmrg" } post-activate { ui_msg "\n ****************************************************************** **** Complete the NetMRG Installation **** ****************************************************************** Full information at http://wiki.netmrg.net/wiki/Users_Manual. 1) Setup MySQL Configure MySQL: sudo -u mysql ${prefix}/lib/mysql5/bin/mysql_install_db Start MySQL: sudo ${prefix}/share/mysql5/mysql/mysql.server start Set MySQL 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 PHP 4 or 5 (not covered) Set mysql.default_socket path to ${prefix}/var/run/mysql5/mysqld.sock in the PHP file: ./phpx/lib/php.ini (in /usr/local, ${prefix}, or /Library depending on PHP package) 3) Setup the NetMRG database mysql5 -u root -p mysql> create database netmrg; mysql> exit Import the netmrg database cd ${prefix}/share/netmrg/db cat netmrg.mysql | mysql5 -u root -p netmrg Verify NetMRG DB: mysql5 -u root -p mysql> use netmrg; mysql> show tables; mysql> exit; Set permissions on the NetMRG database grant all on netmrg.* to netmrg@localhost identified by 'mynetmrg-password'; 4) Set a symlink from the NetMRG web frontend to your Apache root directory sudo ln -s ${prefix}/var/www/netmrg/webfiles //netmrg 5) Edit the NetMRG preferences file ${prefix}/etc/netmrg.xml MySQL preferences: netmrg (MySQL user) (MySQL password) netmrg (MySQL database name) Other preferences if desired: website, polling, and logging 6) Test polling and set polling in cron sudo -u www ${prefix}/bin/netmrg-gatherer -a (-a is for verbose output) NOTE: If you do not run netmrg as user www, then set permissions to that user: sudo chown -R netmrg-user:netmrg-user ${prefix}/var/log/netmrg/ sudo chown -R netmrg-user:netmrg-user ${prefix}/var/lib/netmrg/rrd Once you are satisfied polling is operating correctly, set the netmrg user's crontab to poll every 5 minutes. sudo -u crontab -e */5 * * * * ${prefix}/bin/netmrg-gatherer 7) Point your web browser to http:/loalhost/netmrg and login to NetMRG The default user/pass is admin/nimda ****************************************************************** **** Graphing an Ethernet Switch - Quickstart **** ****************************************************************** 1) Define a custom graph template for your Ethernet switches Click Template Graphs and click the 'Duplicate' icon beside item 'Linux Box - LAN Traffic'. Now edit the duplicate template and change the name and title: Name: Cisco - LAN Traffic Title: %dev_name% - %ifDescr%%n - %ifAlias% (ifAlias is optional) Comment: Interface: %ifDescr% - %ifAlias% (ifAlias is optional) Vert label: bytes / sec Click 'Save Changes'. 2) Monitor an Ethernet switch via SNMP Click Admin and add a Template Group called 'Cisco Switches' Add an Ethernet switch called 'Switch-A' under Monitored Devices for the Cisco Switches group, set the IP or hostname, SNMP version, and community string. Click Save. Click the Recache Interfaces' icon next to the new item Switch-A. NetMRG will draw a table of Switch-A's interfaces including: -Interface index number -Status (Up/Up, Up/Down, etc) -Name (Fa0/1, Gig3/12, etc) -Alias (Cisco IOS user customizable description) -IP address (if any) -Mac Address Select the 'Cisco - LAN Traffic' template in the lower right corner of the window, click the checkbox beside each interface you want to graph, and then click the 'Monitor/Graph All Checked' link. Click Admin -> Cisco Switches -> Switch A and notice that the interface(s) you selected are now listed as sub-devices of Switch-A. 3) View your graphs Click Reporting -> Tree -> Cisco Switches -> Switch-A. The orange graph icon links will display your graphs. 'Device' graph links display graphs for all interfaces on a page. 'Sub-Device' graph links display graphs for a single sub-device interface. \n" }