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 it has at least
<?php
in the top of the file. config.php overrides the settings in config_default.php. To configure, simply copy any settings over from config_default.php to config.php and make the changes there. - Check if the directory /app/db/ is writeable by the webserver (only when using sqlite)
- Note that sqlite is the default, but mysql is also supported. check the config_default.php for the proper values if you wish to substitute a mysql database.
- 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. You can remove items that you don't need reporting on from the array.
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.
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/';
You're done with the server and should be able to see a webpage with an empty table when you visit the website with a browser.
<VirtualHost *:80>
ServerAdmin [email protected]
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