source: trunk/dports/net/monarch/Portfile @ 125738

Last change on this file since 125738 was 125738, checked in by mf2k@…, 5 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: 7.1 KB
Line 
1# $Id: Portfile 125738 2014-09-25 14:43:03Z mf2k@macports.org $
2PortSystem      1.0
3
4name                    monarch
5version                 2.5.0
6revision                1
7categories              net
8maintainers             nomaintainer
9description             A GUI configuration tool for Nagios written in perl
10long_description        ${description}
11homepage                http://sourceforge.net/projects/monarch
12platforms               darwin
13master_sites            sourceforge
14checksums               md5 68658989ff485ac58a42035c3a927362
15patchfiles              patch-nmap_scan-nmap_scan.c
16depends_build           port:nagios
17depends_lib             path:bin/mysql_config5:mysql5 \
18                        port:p5.12-libwww-perl \
19                        port:p5.12-xml-namespacesupport \
20                        port:p5.12-xml-sax \
21                        port:p5.12-xml-libxml \
22                        port:p5.12-nmap-scanner \
23                        port:p5.12-dbi \
24                        port:p5.12-dbd-mysql \
25                        port:p5.12-cgi-ajax \
26                        port:p5.12-class-accessor
27patch.post_args         -F 3
28use_configure           no
29build {}
30
31variant server  {
32# This variant doesn't do anything in this port, it only exists to trigger the server
33# variant in the mysql5 port.
34}
35
36variant_set server
37
38set monarchdir ${prefix}/groundwork/monarch
39
40destroot {
41        xinstall -m 755 -d ${destroot}${monarchdir}
42        system "cp -R ${worksrcpath}/* ${destroot}${monarchdir}"
43}
44
45post-destroot {
46        eval reinplace "s|/usr/bin/perl|${prefix}/bin/perl5.12|g" \
47                [glob ${destroot}${monarchdir}/*.pl]
48
49        eval reinplace "s|/usr/local/groundwork/bin/perl|${prefix}/bin/perl5.12|g" \
50                [glob ${destroot}${monarchdir}/*.cgi]
51
52        eval reinplace "s|/usr/local/groundwork/bin/perl|${prefix}/bin/perl5.12|g" \
53                [glob ${destroot}${monarchdir}/*.p*] 
54
55        eval reinplace "s|/usr/local/groundwork/monarch|${monarchdir}|g" \
56                [glob ${destroot}${monarchdir}/*.*]
57
58# Fix mysqldump location
59        reinplace "s|/usr/bin/mysqldump|${prefix}/bin/mysqldump5|g" \
60                ${destroot}${monarchdir}/MonarchStorProc.pm
61
62# Enable Nmap Scanner
63        xinstall -m 755 -d ${destroot}${monarchdir}/bin
64
65        reinplace "s|/usr/local/groundwork|${monarchdir}|g" \
66                ${destroot}${monarchdir}/nmap_scan_one.pl
67
68        xinstall -m 755 ${destroot}${monarchdir}/nmap_scan_one.pl \
69                ${destroot}${monarchdir}/bin
70
71        reinplace "s|__PREFIX__|${prefix}|g" \
72                ${worksrcpath}/nmap_scan/nmap_scan.c
73
74        system "cd ${worksrcpath}/nmap_scan && gcc -g -O2 -Wall -o nmap_scan_one nmap_scan.c"
75
76# Install nmap_scan_one with mode 4750 and chown it to root (below) to allow normal user to run nmap with root privs
77        xinstall -m 4750 ${worksrcpath}/nmap_scan/nmap_scan_one \
78                ${destroot}${monarchdir}/bin
79
80# Delete precompiled Linux version of nmap_scan_one and leftover nmap_scan_one.pl
81        file delete ${destroot}${monarchdir}/nmap_scan_one
82        file delete ${destroot}${monarchdir}/nmap_scan_one.pl
83
84# End enable Nmap-Scanner
85
86# Set permissions & modes
87        system "chown -R nagios:nagios ${destroot}${monarchdir}/*"
88        system "chmod +x ${destroot}${monarchdir}/*.cgi"
89        system "chown root ${destroot}${monarchdir}/bin/nmap_scan_one"
90}
91
92post-activate {
93
94ui_msg "\n **** To complete the Monarch installation ****
95       
96Read the README at ${prefix}/share/groundwork/monarch/ for full information.
97
981) Configure Nagios with the default sample files or begin with a Nagios configuration you created manually.
99
100
1012) Setup MySQL and create the Monarch user
102   Configure MySQL (new MySQL installs)
103        sudo -u mysql ${prefix}/lib/mysql5/bin/mysql_install_db
104 
105   Start MySQL.
106        sudo ${prefix}/share/mysql5/mysql/mysql.server start
107
108   Set MySQL to start at system boot (optional)
109        sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
110
111   Set a root MySQL password.
112        Follow the instructions that were given after you executed 'mysql_install_db' above.
113
114   Create the Monarch MySQL user and password and set the account's permissions
115        mysql5 -u root -p (login with new root password when prompted)
116        mysql> grant CREATE,INSERT,SELECT,DELETE,UPDATE on monarch.* to monarch@localhost;
117        mysql> grant CREATE,INSERT,SELECT,DELETE,UPDATE on monarch.* to monarch;
118        mysql> SET PASSWORD FOR monarch@localhost = PASSWORD('my-password');
119        mysql> exit
120
121
1223) Create the Monarch MySQL database and initialize it using monarch_setup.pl.
123   Login to MySQL and the create Monarch database
124        mysql5 -u root -p (login with new root password when prompted)
125        mysql> create database monarch;
126
127   Run monarch_setup.pl
128        cd ${monarchdir}
129        sudo ./monarch_setup.pl
130
131   Responses for the monarch_setup.pl program
132        What is the host name of your MySQL database server? - localhost
133        What is the name of the user that will have access to the database? - monarch
134        What is the password for user monarch to access the database monarch - <my-password>
135        What is the name of the database you will use for your Monarch installation? - monarch
136        Enter web server's user account - nagios
137        Enter web server's user group - nagios
138        Please enter your web server's relative path to cgi-bin - /cgi-bin
139        What is your web server's document root - /Library/WebServer/Documents
140        Enter the full path of your cgi-bin directory - /Library/WebServer/CGI-Executables/
141        Enter the full installation path for Monarch - ${monarchdir}
142        Enter the full path to your nagios.cfg file - ${prefix}/etc/nagios
143        Enter the full path to your nagios binary file - ${prefix}/bin
144       
145   Verify Monarch DB:
146        mysql5 -u root -p
147        mysql> use monarch;
148        mysql> show tables;
149        mysql> exit
150
151NOTE: If you wish to delete the monarch database to start over: a) log into MySQL as
152      root; b) execute 'drop database monarch'; c) repeat Step 2.  There is no need
153      to repeat step 1 because the Monarch user/pass and permissions are not deleted
154      by dropping (deleting) the database.
155
156
1574) Set your Apache user and group to the Nagios user
158        sudo pico /etc/httpd/httpd.conf
159       
160        user nagios
161        group nagios
162
163
1645) Initial Monarch setup at http://localhost/cgi-bin/monarch.cgi
165
166        Login with the default user/pass \"super_user\" \"password\"
167
168Control menu
169   Setup -> Nagios Version -> 2.x
170   Nagios Main Configuration -> Load from nagios.cfg (to import existing Nagios configuration)
171   Nagios CGI Configuration -> Load from cgi.cfg (to import existing CGI configuration)
172   Load (to populate the Monarch database with sample Nagios object files or manually created ones)
173
174Now setup your hosts, services, etc using the Monarch GUI.
175
176
1776) Optionally use the simplified Monarch interface
178
179   After the initial Monarch setup you may setup your hosts, services, etc with the optional
180   Monarch EZ GUI if you intend to use default settings for the advanced options and/or use
181   nmap host discovery to add hosts to Nagios, use the simplified Monarch interface.
182
183   To do this, first copy monarch_ez.cgi and monarch_scan.cgi to your cgi-bin/ directory
184        cd ${monarchdir}
185        sudo cp -p monarch_ez.cgi /Library/WebServer/CGI-Executables/
186        sudo cp -p monarch_scan.cgi /Library/WebServer/CGI-Executables/
187
188   Now go to http://localhost/cgi-bin/monarch_ez.cgi
189
190   You may revert to using the full Monarch interface at any time.
191
192NOTE: No login is required for the monarch_ez.cgi interface, so you will need to use Apache
193      username(s)/password(s) just like you use for the Nagios monitor interface to maintain
194      secure access.
195\n"
196}
Note: See TracBrowser for help on using the repository browser.