The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
JSON discovery class.

JSONDiscovery class - supporting the discovery of various things through scripts that produce JSON output to stdout. More...

Collaboration diagram for JSON discovery class.:

Functions

FSTATIC guint _jsondiscovery_discoverintervalsecs (const Discovery *dself)
 Return how often we are scheduled to perform this particular discovery action. More...
 
FSTATIC void _jsondiscovery_finalize (AssimObj *dself)
 Finalizing function for Discovery objects. More...
 
FSTATIC gboolean _jsondiscovery_discover (Discovery *dself)
 Perform the requested discovery action. More...
 
FSTATIC void _jsondiscovery_childwatch (ChildProcess *child, enum HowDied status, int rc, int signal, gboolean core_dumped)
 Watch our child - we get called when our child process exits. More...
 
FSTATIC void _jsondiscovery_fullpath (JsonDiscovery *self)
 
JsonDiscoveryjsondiscovery_new (const char *discoverytype, const char *instancename, gint intervalsecs, ConfigContext *jsoninst, NetGSource *iosource, ConfigContext *context, gsize objsize)
 JsonDiscovery constructor. More...
 

Variables

 DEBUGDECLARATIONS
 

Detailed Description

JSONDiscovery class - supporting the discovery of various things through scripts that produce JSON output to stdout.

Parameters are passed to these scripts through the environment.

Function Documentation

FSTATIC void _jsondiscovery_childwatch ( ChildProcess child,
enum HowDied  status,
int  rc,
int  signal,
gboolean  core_dumped 
)

Watch our child - we get called when our child process exits.

Parameters
childThe ChildProcess class. object for our process
statusHow did our child exit/die?
rcexit code (for normal exit)
signalsignal - if it was killed by a signal
core_dumpedTRUE if our child dropped a core file

Definition at line 129 of file jsondiscovery.c.

References CASTTOCLASS, configcontext_new_JSON_string(), DEBUG, DEBUGMSG3, EXITED_ZERO, FREE, _ChildProcess::stdout_src, _GMainFd::textread, UNREF, UNREF2, and _ChildProcess::user_data.

Referenced by _jsondiscovery_discover().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC gboolean _jsondiscovery_discover ( Discovery dself)

Perform the requested discovery action.

Definition at line 80 of file jsondiscovery.c.

References __FUNCTION__, _jsondiscovery_childwatch(), _ConfigContext::baseclass, CASTTOCLASS, CHILD_LOGERRS, childprocess_new(), CONFIGNAME_CMADISCOVER, DEBUGMSG1, DEBUGMSG2, _ConfigContext::getaddr, and REF2.

Referenced by jsondiscovery_new().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC guint _jsondiscovery_discoverintervalsecs ( const Discovery dself)

Return how often we are scheduled to perform this particular discovery action.

Parameters
[in]dselfObject whose interval to return

Definition at line 53 of file jsondiscovery.c.

References CASTTOCONSTCLASS.

Referenced by jsondiscovery_new().

Here is the caller graph for this function:

FSTATIC void _jsondiscovery_finalize ( AssimObj dself)

Finalizing function for Discovery objects.

Parameters
[in,out]dselfObject to finalize (free)

Definition at line 61 of file jsondiscovery.c.

References _discovery_finalize(), CASTTOCLASS, and UNREF.

Referenced by jsondiscovery_new().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC void _jsondiscovery_fullpath ( JsonDiscovery self)
JsonDiscovery* jsondiscovery_new ( const char *  discoverytype,
const char *  instancename,
gint  intervalsecs,
ConfigContext jsoninst,
NetGSource iosource,
ConfigContext context,
gsize  objsize 
)

JsonDiscovery constructor.

Parameters
[in]discoverytypetype of this JSON discovery object
[in]instancenameinstance name of this particular discovery object
[in]intervalsecsHow often to run this discovery
[in]jsoninstJSON data describing this discovery instance
[in,out]iosourceI/O object
[in,out]contextConfiguration context
[in]objsizenumber of bytes to malloc for the object (or zero)

Definition at line 178 of file jsondiscovery.c.

References __FUNCTION__, _AssimObj::_finalize, _JsonDiscovery::_fullpath, _JsonDiscovery::_intervalsecs, _jsondiscovery_discover(), _jsondiscovery_discoverintervalsecs(), _jsondiscovery_finalize(), _JsonDiscovery::baseclass, _Discovery::baseclass, BINDDEBUG, DEBUGMSG2, _Discovery::discover, _Discovery::discoverintervalsecs, discovery_new(), discovery_register(), _ConfigContext::getconfig, _ConfigContext::getstring, JSONAGENTROOT, _JsonDiscovery::jsonparams, _JsonDiscovery::logprefix, NEWSUBCLASS, and REF.

Referenced by nano_schedule_discovery(), and nano_startupidle().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

DEBUGDECLARATIONS

Definition at line 49 of file jsondiscovery.c.