Writing own components

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Writing own components

Post by mguthrie »

Box293 is correct.

In the include file that has all of the component registration information, you'll also need to have the following constant defined:

( Example from BPI component):

Code: Select all

COMPONENT_CONFIGFUNCTION => "bpi_component_config_func",

Then in that function you'll need it to be something like this:

Code: Select all

function bpi_component_config_func($mode="",$inargs,&$outargs,&$result)
{
     	$result=0;
	$output="";
	switch($mode)
	{
		case COMPONENT_CONFIGMODE_GETSETTINGSHTML:
                      //the web form to handle config options
                 break;

                 case COMPONENT_CONFIGMODE_SAVESETTINGS:
                     //config validation and save to xi_options 
                break; 
      }
    return $output;
}

Use XI's built-in "get_option()" and "set_option()" functions to store arbitrary config options in the postgresql database.
SDohmen
Posts: 240
Joined: Thu Jun 30, 2011 4:14 am

Re: Writing own components

Post by SDohmen »

We got so far that we have the link added when it gets installed. However it does not use the builtin security of the core config manager due too the sourceguardian security. My co-worker managed to use "Can (re)configure hosts and services:" which can be set in the user options.

Is there a way to use the core config manager security? or is this prohibited?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Writing own components

Post by scottwilkerson »

Do you have this at the top of your component?

Code: Select all

//include the helper file
require_once(dirname(__FILE__).'/../componenthelper.inc.php');
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked