snmp_agent_api man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



SNMP_AGENT_API(3)				SNMP_AGENT_API(3)

NAME
       snmp_agent_api - embedding an agent into a external appli
       cation

SYNOPSIS
       #include <ucd-snmp/ucd-snmp-config.h>
       #include <ucd-snmp/ucd-snmp-includes.h>
       #include <ucd-snmp/ucd-snmp-agent-includes.h>

       main () {
	 int agentx_subagent=1; /* change this if you're a master agent */

	 snmp_enable_stderrlog();

	 /* if we're an agentx subagent */
	 if (agentx_subagent) {
	     /* make us a agentx client. */
	     ds_set_boolean(DS_APPLICATION_ID, DS_AGENT_ROLE, 1);
	 }

	 init_agent("yourappname");

	 /* initialize your mib code here */
	 init_my_mib_code();

	 /* yourappname will be used to read yourappname.conf files. */
	 init_snmp("yourappname");

	 /* If we're going to be a snmp master agent */
	 if (!agentx_subagent)
	     init_master_agent(161, NULL, NULL);  /* open port 161 (UDP:snmp) */

	 /* you're main loop here... */
	 while(whatever) {
	     /* if you use select(), see snmp_api(3) */
	     /*	    --- OR ---	*/
	     agent_check_and_process(0); /* 0 == don't block */
	 }

	 /* at shutdown time */
	 snmp_shutdown("yourappname");
       }

       Then:
       cc ... -lucdagent -lucdmibs -lsnmp # other libraries may be needed here

DESCRIPTION
       Our goal is to create a easy to use interface to the  ucd-
       snmp  package  such  that  you can take code that you have
       written that has been designed to be a ucd-snmp mib module
       and  embed  it  into an external application where you can
       either chose to be a SNMP master agent or an  AgentX  sub-
       agent  using  the same mib module code.	Our suggestion is

			   02 Apr 2001				1

SNMP_AGENT_API(3)				SNMP_AGENT_API(3)

       that you use our (or another) SNMP  agent  as  the  AgentX
       master  agent and chose to become an AgentX subagent which
       then attaches to the master.

       Starting with version 4.1, the ucd-snmp package provides a
       pair  of	 libraries that enables easy embedding of an SNMP
       or AgentX agent into an external software package.  AgentX
       is  an extensible protocol designed to allow multiple SNMP
       sub-agents all run on one machine under a single SNMP mas
       ter agent.  It is defined in RFC 2741.

       You  will  need	to perform a few tasks in order to accom
       plish this. First off, you will need  to	 initialize  both
       the  SNMP library and the SNMP agent library. As indicated
       above, this is  done  slightly  differently  depending  on
       whether	or not you are going to perform as a master agent
       or an AgentX sub-agent.

CONFIGURATION
       If you intend to operate as an AgentX sub-agent, you  will
       have to configured the ucd-snmp package as follows:
		./configure --with-mib-modules="agentx/subagent"
       Additionally, you will need to link against the libucdmibs
       library and call subagent_pre_init() as indicated above.

COMPILING
       In order to make use of any of the  above  API,	you  will
       need  to	 clinch	 against  at  least  two  libraries:  the
       libucdagent library and the libsnmp library. Additionally,
       if  you plan to make use of any of the code in the agent's
       mib modules (like the AgentX subagent support),	you  will
       need to link against the libucdmibs library as well.

FUNCTIONS
       snmp_enable_stderrlog()
	      Logs  error output from the SNMP agent to the stan
	      dard error stream.

       ds_set_boolean()
	      Please see the  default_store(3)	manual	page  for
	      more information about this API.

       init_agent(char *name)
	      Initializes  the	embedded  agent.   This should be
	      called before the init_snmp() call.  name	 is  used
	      to dictate what .conf file to read when init_snmp()
	      is called later.

       init_snmp(char *name)
	      Initializes the SNMP library.  Note that one of the
	      things  this  will do will be to read configuration
	      files in an effort to configure  your  application.
	      It  will	attempt	 to  read the configuration files
	      named by the name string that you	 passed	 in.   It

			   02 Apr 2001				2

SNMP_AGENT_API(3)				SNMP_AGENT_API(3)

	      can  be  used  to	 configure  access  control,  for
	      instance.	    Please   see   the	  read_config(3),
	      snmp_config(5),  and snmpd.conf(5) manual pages for
	      further details on this subject.

       init_master_agent(port, NULL, NULL)
	      Initializes the master agent and opens all its nec
	      essary  ports.  port is the port you want to listen
	      for SNMP requests on.

       agent_check_and_process(int block)
	      This checks for packets arriving on the  SNMP  port
	      and  processes them if some are found.  If block is
	      non-zero, the function  call  will  block	 until	a
	      packet  arrives  or  an  alarm  must  be	run  (see
	      snmp_alarm(3)). The return value from this function
	      is  a  positive  integer if packets were processed,
	      zero if an  alarm	 occurred  and	-1  if	an  error
	      occured.

       snmp_shutdown(char *name);
	      This  shuts  down the agent, saving any needed per
	      sistent storage, etc.

SEE ALSO
       select(2), snmp_api(3),	default_store(3),  snmp_alarm(3),
       read_config(3), snmp_config(5), snmpd.conf(5)

			   02 Apr 2001				3

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net