Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   pmda    ( 3 )

введение в библиотеку поддержки агента домена Performance Metrics (introduction to the Performance Metrics Domain Agent support library)

DAEMON PMDA

A PMDA that is run as a daemon is forked and executed by pmcd(1). Therefore, unlike a DSO PMDA, the starting point for a daemon PMDA is main(). The agent should parse the command line arguments, create a log file and initialize some data structures that pmcd(1) would initialize for a DSO agent.

The pmdaInterface structure must be completely defined by the daemon PMDA. The function pmdaDaemon(3) can be called at the start of main() to set most of these fields. Command line parsing can be simplified by using pmdaGetOpt(3), which is similar to getopt(2), but extracts a common set of options into the pmdaInterface structure. stderr can be mapped to a log file using pmdaOpenLog(3) to simplify debugging and error messages. The connection to pmcd(1) can be made with pmdaConnect(3) and the loop which handles the incoming PDUs, pmdaMain(3), should be the last function called. This can be seen in $PCP_PMDAS_DIR/simple/simple.c.

The simple_init() routine is common to an agent that can be run as both a Daemon and DSO PMDA.