Installing MunkiReport

What is MunkiReport

MunkiReport is a web-based reporting interface for Munki clients. It’s cool to deploy a bunch of Munki clients, but it’d be nice to know how many are out there, and any errors or pending installs there may be on those clients.

If you haven’t set up your Munki server yet, do that first!

Assumptions (for simplicity’s sake)

There are many different possible scenarios for installing MunkiReport, but for simplicity’s sake, we’re going to make some assumptions. If you’re really advanced, you can obviously adapt these instructions for your particular case. If not, follow as is.

  • You are using a Mac computer as a server.
  • You installed munki_repo to a subdirectory of the server directory.
  • You are going to install MunkiReport to the root directory of your web server.
  • You are going to do all of these instructions from your web server (and not from a client computer).

Making sure the web server is PHP-ready

Apparently, Mac OS X by default does not interpret PHP correctly when you launch up the Apache service. So let’s make sure that’s good first.

In the Terminal.app, edit the appropriate file using nano (or your editor of choice)

sudo nano -B /etc/apache2/httpd.conf

If you see a line that looks like this:

#LoadModule php5_module libexec/apache2/libphp5.so

change it to look like this instead

LoadModule php5_module libexec/apache2/libphp5.so

Then save out (if you’re using nano, Control-X we save).

Then restart apache

sudo apachectl restart

A) Downloading MunkiReport with Git

If you have Git installed, you can do a git clone on MunkiReport.

cd ~/Downloads
git clone https://github.com/munkireport/munkireport-php.git munkireport-php-master

B) Downloading MunkiReport with a web browser

Using a web browser on the web server itself, go to the MunkiReport GitHub repository and click the Download ZIP button to download the latest version. When you get the .zip file, you may have to double-click it to unzip it. Once it’s unzipped, you should have a folder with all the necessary files in it.

Installing MunkiReport

Copy the contents of the folder (not the folder itself) to your web server’s root directory. Make sure the file ownership/permissions match that of the other files or folders in there (e.g., whatever index.html file says It works! when you first got your web server up and running.

If you no idea, then make it all 755 permissions with ownership of root:_www.

Here’s an example to paste into the Terminal.app:

sudo chown -R root:_www ~/Downloads/munkireport-php-master/*
sudo chmod -R 775 ~/Downloads/munkireport-php-master/*
sudo mkdir -p /Library/WebServer/Documents/munkireport
sudo mv ~/Downloads/munkireport-php-master/* /Library/WebServer/Documents/munkireport/
sudo cp /Library/WebServer/Documents/munkireport/config_default.php /Library/WebServer/Documents/munkireport/config.php

The last command just makes a copy of the default config to a new custom config file. You will need both (I thought, at first, that I could ditch the default config file, but then I got an error when I loaded up the page in a browser).

Note: If you’re using OS X Server, the path is typically /Library/Server/Web/Data/Sites/Default and not /Library/WebServer/Documents

If all went well, you should be able to go to http://localhost/munkireport and enter a first username and password. This doesn’t actually create a user. All it does is create a hash.


Once you have the password hash created, highlight the results and then paste them in at the end of the config.php file on the web server. If you ever need to generate another hash again, go to http://localhost/index.php?/auth/generate and enter in more credentials.

When you do log in, you should see… nothing. No clients.

To create a client, paste these commands into the Terminal.app

bash -c “$(curl http://nameofyourdomain/munkireport/index.php?/install)” bash -i ~/Desktop
/usr/local/munki/munkiimport ~/Desktop/munkireport-2.11.0.pkg

Replace nameofyourdomain with your actual domain name or the server’s IP address.

Note: if you’re using https with a self-signed certificate, you may want to run

bash -c “$(curl -k https://nameofyourdomain/munkireport/index.php?/install)” bash -i ~/Desktop

instead of the first command.

Note: the version number may change, so after you type ~/Desktop/munkireport-, just hit Tab to autocomplete, instead of typing in the number (it’s faster to autocomplete anyway).

Once you have that package imported, and have rebuilt your Munki catalogs when prompted, go ahead and them to the appropriate manifests so they can be pushed out to your existing clients.

If you are well-versed in MySQL and prefer that to MunkiReport’s default sqlite database, read Using MySQL with MunkiReport for some implementation tips.


Posted

in

by

Comments

3 responses to “Installing MunkiReport”

  1. Angel Avatar
    Angel

    Thank you for this write up!
    For the like of me I couldn’t figure out the wiki instructions.

  2. Angel Avatar
    Angel

    Hi Alan,
    I’m getting this error message when I try to setup the client installer.

    machine:~ admin$ sudo bash -c “$(curl http://machine/index.php?/install)” bash -i ~/Desktop/
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 93699 0 93699 0 0 10.8M 0 –:–:– –:–:– –:–:– 11.1M
    Password:
    bash: -c: line 0: syntax error near unexpected token `newline’
    bash: -c: line 0: `’
    machine:~ admin$

    Any clues?
    Thanks!
    Angel

  3. Angel Avatar
    Angel

    Update.
    Turns out my munkireport root was:
    http://machine/munkireport/public/
    not
    http://machine/localhost/
    Which I’m told is not good, public should not be in the url.
    I’m fixing that now.

    Some curl commands helped diagnose the problem.
    curl http://machine/index.php?/install (didn’t work)
    curl http://machine/munkireport/public/index.php?/install (worked)

    Thanks to the #munkireport team at Slack for their help.

Leave a Reply

Your email address will not be published. Required fields are marked *