First setup the server - the clients use the server to pull down the installation scripts.
- Use git to checkout the latest version or download the zip file and put all files in the root directory of your website (for subdirs, see below).
- Create config.php in the root directory of your website. Make sure this file starts with
<?php
and has no whitespace before that, don't add the closing tag for php. config.php overrides the settings in config_default.php. To configure, simply copy relevant settings over from config_default.php to config.php and make the changes in config.php. - Database setup: when using SQLite as backend (which is the default), check if the directory /app/db/ is writeable by the webserver. If you want to use MySQL, check config_default.php for the proper values.
You're done with the server.
- Visit the site with a webbrowser, you'll be prompted to create a user and password
- Append the generated hash line to config.php
- Now refresh the page in your browser, and you should be able to log in with the credentials you just created.
If you want to deploy munkireport without authentication (because you run your own authentication method), add the following line to config.php
$conf['auth']['auth_noauth'] = array();
By default munkireport will only install 2 basic reporting modules: 'machine' and 'reportdata'. If you want the client to report on more items, visit:
http://example.com/index.php?/install/dump_modules/config
Paste the resulting $conf['modules'] = array(...);
in your config.php file. Remove items that you don't need reporting on from the array (e.g. 'servermetrics', 'certificate' and 'service' only make sense when installed on a client that runs Mac OSX server).
Now you can setup a client to test if all is ok:
- Open Terminal.app
- Type:
sudo /bin/bash -c "$(curl -s http://example.com/index.php?/install)"
When the client reporting goes well, you can create an installer package using the following:
- Create the installer
bash -c "$(curl http://example.com/index.php?/install)" bash -i ~/Desktop
- Run
/usr/local/munki/munkiimport ~/Desktop/munkireport-2.2.0.pkg
(changing the version number as needed). - Run
makecatalogs
, and be sure to add the newly imported package to a manifest.
Note: There is also an AutoPkg recipe for creating munkireport packages, you can read more on how to setup those on Setup AutoPkg for munkireport
When Munkireport is installed on the client, 3 directories are generated:
preflight.d
- this directory is used by munkireport to run scripts on preflight, it contains at leastsubmit.preflight
. Scripts that exit with a non-zero status will not abort the run.preflight_abort.d
- this directory is empty and can be used for additional scripts that check if managedsoftwareupdate should run. Scripts that exit with a non-zero status will abort the run.postflight.d
- this directory is empty and can be used for additional scripts that should run on postflight.
All scripts have a timeout limit of 10 seconds, after that they're killed.
Munkireport should able to detect if it is running from a subdirectory. If automatic detection fails, you can also specify the subdirectory in config.php. So if you want to run munkireport from http://munki.mysite.org/report/ add the following to config.php:
$conf['subdirectory'] = '/report/';
<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName munkireport-php.example.com
ServerAlias munkireport-php.example.com
AddDefaultCharset utf-8
DocumentRoot /srv/munkireport-php
<Directory />
Options FollowSymLinks
</Directory>
LogLevel warn
CustomLog /var/log/apache2/munkireport-php.example.com-access.log combined
ErrorLog /var/log/apache2/munkireport-php.example.com-error.log
</VirtualHost>
If you're running munkireport on an apache webserver and you want to use mod_rewrite (which gives you nicer urls), you'll have to change the following:
- Add
$conf['index_page'] = '';
to config.php