Hello,

I'm sorry to write again. But I haven't had any answer, I don't know why. Don't take this the wrong way.
I attach the mail I sent. The midaemon.conf file is created and there is no other daemon running on port 161.


Thanks for the attention.


Hello,

I've been trying to run the example-daemon found int the tutorial as a master agent. But I'm receiving this error (I'm using windows):

Error opening specified endpoint "udp:161"
midaemon is up and running.
select: No such file or directory
select: No such file or directory
... and so on infinately

Instead of the nstAgentSubagentObject, I'm using one of my own. It only has one integer. I have no windows snmp installed. The snmpd demon is not running. When I run snmp, no error comes up, but with the example-daemon there is.

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include <signal.h>

#include <test.h>

static int keep_running;

RETSIGTYPE
stop_server(int a) {
  keep_running = 0;
}

int
main (int argc, char **argv) {
int agentx_subagent=0; /* change this if you want to be a SNMP master agent */
int background = 0; /* change this if you want to run in the background */
int syslog = 0; /* change this if you want to use syslog */


/* print log errors to syslog or stderr */
if (syslog)
  snmp_enable_calllog();
else
  snmp_enable_stderrlog();

/* we're an agentx subagent? */
if (agentx_subagent) {
/* make us a agentx client. */
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1);
}


/* run in background, if requested */
if (background && netsnmp_daemonize(1, !syslog))
    exit(1);

/* initialize the agent library */
init_agent("midaemon");

/* initialize mib code here */

/* mib code: init_nstAgentSubagentObject from nstAgentSubagentObject.C */
//init_nstAgentSubagentObject();
init_test();

/* initialize vacm/usm access control  */
if (!agentx_subagent) {
    init_vacm_vars();
    init_usmUser();
}

/* example-demon will be used to read example-demon.conf files. */
init_snmp("midaemon");

/* If we're going to be a snmp master agent, initial the ports */

if (!agentx_subagent)
init_master_agent(); /* open the port to listen on (defaults to udp:161) */


/* In case we recevie a request to stop (kill -TERM or kill -INT) */
keep_running = 1;
signal(SIGTERM, stop_server);
signal(SIGINT, stop_server);

snmp_log(LOG_INFO,"midaemon is up and running.\n");

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

/* at shutdown time */
snmp_shutdown("midaemon");

return 0;
}

The file midaemon.conf is created and only has a rwcommunity  public.

I don't know why can't it open port 161 nor find some file I don't know.

Thanks for the attention.

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.com/




-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to