Child pages
  • Display a widget at an external web site
Skip to end of metadata
Go to start of metadata

This article is written for OP5 Monitor versions 7.1.7 and above. Previous versions of OP5 Monitor use a different configuration syntax for external widgets. Using OP5 Monitor 7.1.7 or later is recommended.

Redirection Notice

This page will redirect to DOC:External Widget configuration in about 5 seconds.

This guide will take you through the process of setting up a NagVis and/or Listview widget as an external widget, to allow it to be displayed on an external website. External widgets are often used to set up various status displays on large computer monitors.

 

Local user account

  1. Create a new local user account via the OP5 Monitor web interface. In this example, the user is called externalview.
     
  2. Make sure the new user is allowed to view the widget, by adding proper group rights. Preferably, only add a minimum set of rights.

  3. Log on to the new user account, using the ordinary OP5 Monitor web interface.

 

Configuration

  1. Log on to the OP5 Monitor system via SSH, as root, and execute the following command:
    cp -pv /opt/monitor/op5/ninja/application/config/{,custom/}external_widget.php
     
  2. Edit the newly created file using your favorite text editor. For example, like this:
    nano /opt/monitor/op5/ninja/application/config/custom/external_widget.php
     
  3. The file will contain several comment blocks (the text within /* ... */), and a few lines starting with $config that will need to be set properly.

    1. Set the username parameter to the name of the user that was added in the instructions found in the beginning of this article.

      $config['username'] = 'externalview';
    2. Set the groups parameter to the group that the user is a member of. Since the user's password is not configured, groups cannot be looked up automatically, and must be manually specified. In this case, the group is set to guest like this:

      $config['groups'] = array('guest');

      Alternatively, in case of several group memberships:

      $config['groups'] = array('guest', 'external_users');
    3. Set the widgets parameter according to one of the examples below.

NagVis example

external_widget.php
$config['widgets']['company_network'] = array(
	'name' => 'nagvis',
	'friendly_name' => '',
	'setting' => array(
		'width' => 1280,
		'height' => 1024,
		'map' => 'automap'
	)
);

 

Listview example

external_widget.php
$config['widgets']['unhandled_problems'] = array(
	'name' => 'listview',
	'friendly_name' => '',
	'setting' => array(
		'query' => '[services] state != 0 and acknowledged = 0 and scheduled_downtime_depth = 0 and host.scheduled_downtime_depth = 0',
		'columns' => 'default',
		'limit' => 50,
		'order' => ''
	)
);

 

Explanation of configuration parameters

  • company_network and unhandled_problems in these examples are the external widget names, which is used in the external widget URL, such as:
    https://op5-monitor/monitor/index.php/external_widget/company_network
     
  • name should be set to the internal name of the widget. The internal widget names available in your system can be found by running this (oneliner) command via SSH:
    for d in /opt/monitor/op5/ninja/modules/*/widgets/* /opt/monitor/op5/ninja/application/widgets/*; do [ -d "$d" ] || continue; echo "${d##*/}"; done | sort
     
  • friendly_name can be empty or have any value, but it must be defined.

  • setting and its content depends on what widget is being used, and it is mainly populated for the NagVis and Listview widgets.
     
  • To configure multiple external widgets, just add additional items for the $config['widgets'] array. Just make sure to keep the keys unique (company_network and unhandled_problems in the examples above).

 

Displaying the widget

Add an iframe to the HTML document of the external website, such as below, to display the external widget.

<iframe src="https://<your monitor server>/monitor/index.php/external_widget/company_network" height="500px" frameborder=0 width="600px" scrolling='no'></iframe>

The company_network part of the URL is the name given in the configuration (see example and description above).

 

The result

When done your external widget can render on any site with access to the OP5 Monitor server, such as this:

Note that the NagVis map in the screenshot is a demo map, not an automap as described in the example above.


  • No labels