Branch: Tag:

2001-06-26

2001-06-26 23:18:14 by Honza Petrous <hop@unibase.cz>

Core of a SNMP agent.
It's working only with -DSNMP_AGENT.

The same MIB 'core' as before:

- system group
- snmp group (only snmp.snmpInPkts and snmp.snmpOutPkts)
- roxenis.app.webserver group [enterprises.8614.1.1]
(only demonstartion of reboot/restart by SNMP_SET in the enterprises.8614.1.1.1.0 with value 1/2)

Rev: server/base_server/global_variables.pike:1.72
Rev: server/base_server/roxen.pike:1.678
Rev: server/base_server/snmpagent.pike:1.2

1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2001, Roxen IS. - // $Id: global_variables.pike,v 1.71 2001/06/17 20:07:09 nilsson Exp $ + // $Id: global_variables.pike,v 1.72 2001/06/26 23:18:13 hop Exp $      // #pragma strict_types   #define DEFVAR mixed...:object
28:   private int(0..1) syslog_disabled() { return query("LogA")!="syslog"; }   private int(0..1) ident_disabled_p() { return [int(0..1)]query("default_ident"); }    + #ifdef SNMP_AGENT + private int(0..1) snmp_disabled() { return !query("snmp_agent"); } + #endif      // And why put these functions here, you might righfully ask.   
603:       defvar("global_position",    Variable.Variable(0, VAR_INVISIBLE)); +  +  +  + #ifdef SNMP_AGENT +  // SNMP stuffs +  defvar("snmp_agent", 0, LOCALE(999, "SNMP: Enable SNMP agent"), +  TYPE_FLAG|VAR_MORE, +  "If set, the Roxen SNMP agent will be anabled. " +  ); +  defvar("snmp_community", ({"public:ro"}), "SNMP: Community string", +  TYPE_STRING_LIST, +  "One community name per line. Default permissions are 'read-only'. " +  "'Read-write' permissions can be specified by append :rw to the community " +  "name (for example mypub:rw).", +  0, snmp_disabled); + /* +  defvar("snmp_mode", "smart", "SNMP: Agent mode", +  TYPE_STRING_LIST, +  "Standard SNMP server mode, muxed SNMP mode, " +  "proxy, agentx or automatic (smart) mode.", +  ({"smart", "agent", "agentx", "smux", "proxy" })); + */ +  defvar("snmp_hostport", "", "SNMP: IP address and port", +  TYPE_STRING, +  "Agent listenning IP adress and port. Format: [[host]:port] " +  "If host isn't set then will be use IP address of config interface", +  0, snmp_disabled); + /* +  defvar("snmp_traphost","","SNMP traps destinations", +  TYPE_STRING, +  "...", +  0, snmp_disabled); + */ +  defvar("snmp_syscontact","","SNMP: System MIB - Contact", +  TYPE_STRING, +  "The textual identification of the contact person for this managed " +  "node, together with information on how to contact this person.", +  0, snmp_disabled); +  defvar("snmp_sysname","","SNMP: System MIB - Name", +  TYPE_STRING, +  "An administratively-assigned name for this managed node. By " +  "convention, this is the node's fully-qualified domain name.", +  0, snmp_disabled); +  defvar("snmp_syslocation","","SNMP: System MIB - Location", +  TYPE_STRING, +  "The physical location of this node (e.g., `telephone closet, 3rd " +  "floor').", +  0, snmp_disabled); +  defvar("snmp_sysservices",72,"SNMP: System MIB - Services", +  TYPE_INT, +  "A value which indicates the set of services that this entity " +  "primarily offers.", +  0, snmp_disabled); + #endif // SNMP_AGENT +    }