source: trunk/dports/net/monarch/Portfile

Last change on this file was 151888, checked in by mojca@…, 11 months ago

monarch: switch to perl5.24 (#52081)

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