Skip to content
tuxudo edited this page Jun 20, 2023 · 3 revisions

Hacking instructions for munkireport-php (at the moment just a braindump)

Add more data

To add new data to MunkiReport you can set up a module. A module is a directory that contains

  • an install script for the client (which will gather the appropriate data and point munkireport to it)
  • a model (which describes how the data is represented in the database)
  • optionally a controller (which you can use to download additional files)

If you want to understand how modules work, take a look at some modules in the modules directory.

Graphs

MunkiReport comes with a bundled graphing library: NVD3 graphing library, based on D3.js.

Network pie graph

If you want to plot where your clients are in the network, you can use the network pie. Global network locations can be set in local/module_configs/ip_ranges.yml. If you want to use those, just add an empty parameter object (parms = {}).

		// Override network settings
		var parms = { 
			"Campus": ["145.108.", "130.37."]
		};

		drawGraph("<?php echo url('module/reportdata/ip'); ?>", '#ip-plot', pieOptions, parms);

Variables

Don't pollute the $GLOBALS array, at the moment there are a handful of variables passed around via $GLOBALS:

  • $GLOBALS['alerts'] - alerts and messages
  • $GLOBALS['auth'] - authorization variable (currently only in use for report)
  • $GLOBALS['conf'] - config items access with conf()
  • $GLOBALS['dbh'] - the database handle
  • $GLOBALS['version'] - the current version of MunkiReport

Javascript

A large portion of the UI is based on javascript.

Events

When the DOM is ready and the language files are loaded, the appReady event is triggered.

When there is an update in the filters or a refresh for a dashboard, appUpdate is triggered..

Clone this wiki locally