Branch: Tag:

2001-07-19

2001-07-19 20:23:02 by Honza Petrous <hop@unibase.cz>

Moved defvars, so now are per-server configuration variables persistent.

Rev: server/base_server/configuration.pike:1.451
Rev: server/base_server/snmpagent.pike:1.6

1:   /* -  * $Id: snmpagent.pike,v 1.5 2001/07/18 21:10:04 hop Exp $ +  * $Id: snmpagent.pike,v 1.6 2001/07/19 20:23:02 hop Exp $    *    * The Roxen SNMP agent    * Copyright © 2001, Roxen IS.
27:    used then. [threads leak] // FIXME: solved by switching to the async i/o    - the OID must be minimally 5 elements long, otherwise GETNEXT return    "no such name" error -  - the tree walking returns the 'end of MIB' instead of some object -  from next subtree +     Todos:    v1.0 todo:    - cold/warm start trap generation
124:    int enable() {       mib = SubMIBsystem(); // system.* table -  if(objectp(mib)) // snmp.* table -  //mib->register(MIBTREE_BASE+"."+"2.1.11", SubMIBsnmp(this_object())); - { object mib2 = SubMIBsnmp(this_object()); +  if(objectp(mib)) { +  // snmp.*    mib->register(MIBTREE_BASE+"."+"2.1.11", SubMIBsnmp(this_object())); -  +  // enterprises.roxenis.* +  mib->register(MIBTREE_BASE+"."+"4.1.8614", SubMIBroxenis(this_object()));   }    if (!status())    start();
325:    return;    foreach(vsarr, int vsid)    if(vsdb[vsid] && vsdb[vsid]->variables["snmp_traphosts"]) { -  SNMPAGENT_MSG(sprintf("virt.serv[%d/%s]'s traphosts:%O", vsid, vsdb[vsid]->name, vsdb[vsid]->variables["snmp_traphosts"])); +  SNMPAGENT_MSG(sprintf("virt.serv[%d/%s]'s traphosts:%O", vsid, +  vsdb[vsid]->name, vsdb[vsid]->variables["snmp_traphosts"]));    foreach(vsdb[vsid]->variables["snmp_traphosts"], string thost) {    uri = Standards.URI(thost);    SNMPAGENT_MSG(sprintf("Trap sent: %s.", thost));    fd->trap(RISMIB_BASE_WEBSERVER, -  Standards.URI(vsdb[vsid]->varibles["MyWorldLocation"])->host, 0, 0, +  Standards.URI(vsdb[vsid]->varibles["MyWorldLocation"])->host, +  0, 0,    get_uptime(), 0, uri->host, uri->port);    }    } else -  SNMPAGENT_MSG(sprintf("virt.serv[%d/%s] hasn't any traphosts.", vsid, vsdb[vsid]->name)); +  if(vsdb[vsid]) +  SNMPAGENT_MSG(sprintf("virt.serv[%d/%O] hasn't any traphosts.", +  vsid, vsdb[vsid] && vsdb[vsid]->name));       }   
545:      //! External function for MIB object 'system.sysDescr'   array get_description() { -  return OBJ_STR("Roxen Webserver SNMP agent v"+("$Revision: 1.5 $"/" ")[1]+" (devel. rel.)"); +  return OBJ_STR("Roxen Webserver SNMP agent v"+("$Revision: 1.6 $"/" ")[1]+" (devel. rel.)");   }      //! External function for MIB object 'system.sysOID'
691:    }   }    - /* -  // enterprises -  "4.1": ({ 0, get_null, "4.1.8614.1.1.999.1.0" }), -  // enterprises.roxenIS -  "4.1.8614": ({ 0, get_null, "4.1.8614.1.1.999.1.0" }), -  // enterprises.roxenIS.app -  "4.1.8614.1.1": ({ 0, get_null, "4.1.8614.1.1.999.1.0" }), -  // enterprises.roxenIS.app.webserver -  "4.1.8614.1.1": ({ 0, get_null, "4.1.8614.1.1.999.1.0" }), -  // HACK!! -  "4.1.8614.1.1.999.1.0": ({ 0, get_null, 0 }), + //! roxenis enterprise subtree manager + //! Manages the enterprise.roxenis.* submib tree. + class SubMIBroxenis {    -  // hack2 :) -  "4.1.8614.1.1.999.2.1.0": ({ "int", get_virtserv, "4.1.8614.1.1.999.2.2.0" }) +  inherit SubMIBManager;    - */ +  constant name = "roxenis"; +  constant tree = "4.1.8614";    -  +  void create(object agent) { +  +  submibtab = ([ +  // enterprises +  // hack2 :) +  "4.1.8614.1.1.999.2.1.0": agent->get_virtserv +  ]); +  } + } +    /*    switch (attrname) {    case RISMIB_BASE_WEBSERVER+".1.0":