Client setup

Jon Crain edited this page Dec 5, 2018 · 16 revisions

Client Setup

MunkiReport is versatile in how you are able to add client machines to the reporting server. The manual option is used mostly for testing; the next method is the recommended way to distribute the setup to client machines.

The installation script is generated on the server and takes the following options:

Usage: munkireport_client_installer [OPTIONS]

  -b URL    Base url to munki report server
            Current value: https://YOUR.MUNKIREPORT.SERVER/
  -m PATH   Path to installation directory
            Current value: /usr/local/munki/
  -p PATH   Path to preferences file (without the .plist extension)
            Current value: /Library/Preferences/MunkiReport
  -n        Do not run preflight script after the installation
  -i PATH   Create a full installer at PATH
  -c ID     Change pkg id to ID
  -h        Display this help message
  -r PATH   Path to installer result plist
  -v VERS   Override version number

Command Line (Manual) Install

The simplest form to install the client scripts is to run the following lines on the client:

munkireport_url="https://example.com/index.php?"

sudo /bin/bash -c "$(curl -s $munkireport_url/install)"

This will download the installscript with curl and run it with root privileges. The install script will download all additional reporting scripts and configure the client to report back to your munkireport server.

Note: Use only for testing purposes.

Generate an Installer Package (pkg)

When the manual test above goes well, you can create an installer package by running the following package:

munkireport_url="https://example.com/index.php?"
installer_output_dir=~/Desktop

bash -c "$(curl $munkireport_url/install)" bash -i $installer_output_dir

You will end up with a munkireport installer package on your desktop (~/Desktop/munkireport-x.x.x.pkg) You can then distribute this package with your favorite distribution mechanism.

Generate an Installer Package with Version Override

If you need to push out a new version to your clients (maybe you changed some client side options in the configuration), but the version of munkireport has not changed, you can override the version using the -v flag:

munkireport_url="https://example.com/index.php?"
installer_output_dir=~/Desktop
version="3.3.1.20181201"

bash -c "$(curl $munkireport_url/install)" bash -v $version -i $installer_output_dir

This will result in ~/Desktop/munkireport-3.3.1.20181201.pkg

You can import this package into munki which will pick up the new version number.

AutoPkg

There is also an AutoPkg recipe for creating munkireport packages, you can read more on how to setup those on AutoPkg for MunkiReport.

Advanced Client Setup

When MunkiReport is installed on the client, 3 directories are generated:

  1. preflight.d - this directory is used by MunkiReport to run scripts on preflight, it contains at least submit.preflight. Scripts that exit with a non-zero status will not abort the run.
  2. 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.
  3. 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.

Uninstall MunkiReport

To uninstall MunkiReport just remove the installed files:

sudo rm /usr/local/munki/munkilib/reportcommon.*
sudo rm /usr/local/munki/munkilib/purl.*
sudo rm /usr/local/munki/munkilib/phpserialize.* 
sudo rm -r /usr/local/munki/preflight*
sudo rm -r /usr/local/munki/postflight*
sudo rm /usr/local/munki/report_broken_client
sudo rm -f /usr/local/munki/smckit
sudo rm -rf /usr/local/munki/munkireport*
sudo rm /Library/Preferences/MunkiReport.plist
sudo pkgutil --forget com.github.munkireport
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.