SNMP frontend: conflict typos, snmp pidfile
This commit is contained in:
parent
5172cf15fa
commit
42f21a309a
5 changed files with 35 additions and 7 deletions
|
|
@ -1004,7 +1004,7 @@ main(int argc,
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* Write pid-file */
|
/* Write pid-file */
|
||||||
if ((pid = pidfile_write(pidfile)) < 0)
|
if (pidfile_write(pidfile) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (set_signal(SIGTERM, backend_sig_term, NULL) < 0){
|
if (set_signal(SIGTERM, backend_sig_term, NULL) < 0){
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,14 @@
|
||||||
/* Command line options to be passed to getopt(3) */
|
/* Command line options to be passed to getopt(3) */
|
||||||
#define SNMP_OPTS "hD:f:l:o:"
|
#define SNMP_OPTS "hD:f:l:o:"
|
||||||
|
|
||||||
|
/*! Return (hardcoded) pid file
|
||||||
|
*/
|
||||||
|
static char*
|
||||||
|
clicon_snmp_pidfile(clicon_handle h)
|
||||||
|
{
|
||||||
|
return "/var/tmp/clixon_snmp.pid";
|
||||||
|
}
|
||||||
|
|
||||||
/*! Signal terminates process
|
/*! Signal terminates process
|
||||||
* Just set exit flag for proper exit in event loop
|
* Just set exit flag for proper exit in event loop
|
||||||
*/
|
*/
|
||||||
|
|
@ -197,6 +205,7 @@ snmp_terminate(clicon_handle h)
|
||||||
yang_stmt *yspec;
|
yang_stmt *yspec;
|
||||||
cvec *nsctx;
|
cvec *nsctx;
|
||||||
cxobj *x;
|
cxobj *x;
|
||||||
|
char *pidfile = clicon_snmp_pidfile(h);
|
||||||
|
|
||||||
shutdown_agent();
|
shutdown_agent();
|
||||||
clicon_rpc_close_session(h);
|
clicon_rpc_close_session(h);
|
||||||
|
|
@ -213,6 +222,8 @@ snmp_terminate(clicon_handle h)
|
||||||
clicon_handle_exit(h);
|
clicon_handle_exit(h);
|
||||||
clixon_err_exit();
|
clixon_err_exit();
|
||||||
clicon_log_exit();
|
clicon_log_exit();
|
||||||
|
if (pidfile)
|
||||||
|
unlink(pidfile);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -254,6 +265,7 @@ main(int argc,
|
||||||
size_t cligen_bufthreshold;
|
size_t cligen_bufthreshold;
|
||||||
int dbg = 0;
|
int dbg = 0;
|
||||||
size_t sz;
|
size_t sz;
|
||||||
|
char *pidfile = NULL;
|
||||||
|
|
||||||
/* Create handle */
|
/* Create handle */
|
||||||
if ((h = clicon_handle_init()) == NULL)
|
if ((h = clicon_handle_init()) == NULL)
|
||||||
|
|
@ -415,6 +427,14 @@ main(int argc,
|
||||||
|
|
||||||
if (dbg)
|
if (dbg)
|
||||||
clicon_option_dump(h, dbg);
|
clicon_option_dump(h, dbg);
|
||||||
|
/* Check pid-file, if zap kil the old daemon, else return here */
|
||||||
|
if ((pidfile = clicon_snmp_pidfile(h)) == NULL){
|
||||||
|
clicon_err(OE_FATAL, 0, "pidfile not set");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
/* Write pid-file */
|
||||||
|
if (pidfile_write(pidfile) < 0)
|
||||||
|
goto done;
|
||||||
/* main event loop */
|
/* main event loop */
|
||||||
if (clixon_event_loop(h) < 0)
|
if (clixon_event_loop(h) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ snmp_table_handler(netsnmp_mib_handler *handler,
|
||||||
}
|
}
|
||||||
ok:
|
ok:
|
||||||
retval = SNMP_ERR_NOERROR;
|
retval = SNMP_ERR_NOERROR;
|
||||||
done:
|
//done:
|
||||||
if (xt)
|
if (xt)
|
||||||
xml_free(xt);
|
xml_free(xt);
|
||||||
if (cb)
|
if (cb)
|
||||||
|
|
@ -254,10 +254,7 @@ snmp_scalar_handler(netsnmp_mib_handler *handler,
|
||||||
u_char *snmpval = NULL;
|
u_char *snmpval = NULL;
|
||||||
size_t snmplen;
|
size_t snmplen;
|
||||||
int ret;
|
int ret;
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
netsnmp_variable_list *requestvb; /* sub of requests */
|
netsnmp_variable_list *requestvb; /* sub of requests */
|
||||||
>>>>>>> SNMP frontend: getnext, oid sanity checks and scalar debug
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* can be used to pass information on a per-pdu basis from a
|
* can be used to pass information on a per-pdu basis from a
|
||||||
|
|
|
||||||
14
test/lib.sh
14
test/lib.sh
|
|
@ -187,6 +187,8 @@ BUSER=clicon
|
||||||
|
|
||||||
: ${clixon_snmp:=$(type -p clixon_snmp)}
|
: ${clixon_snmp:=$(type -p clixon_snmp)}
|
||||||
|
|
||||||
|
: ${clixon_snmp_pidfile:="/var/tmp/clixon_snmp.pid"}
|
||||||
|
|
||||||
# Source the site-specific definitions for test script variables, if site.sh
|
# Source the site-specific definitions for test script variables, if site.sh
|
||||||
# exists. The variables defined in site.sh override any variables of the same
|
# exists. The variables defined in site.sh override any variables of the same
|
||||||
# names in the environment in the current execution.
|
# names in the environment in the current execution.
|
||||||
|
|
@ -447,6 +449,8 @@ function chunked_framing()
|
||||||
function start_snmp(){
|
function start_snmp(){
|
||||||
cfg=$1
|
cfg=$1
|
||||||
|
|
||||||
|
rm -f ${clixon_snmp_pidfile}
|
||||||
|
|
||||||
$clixon_snmp -f $cfg -D $DBG &
|
$clixon_snmp -f $cfg -D $DBG &
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|
@ -465,6 +469,7 @@ function stop_snmp(){
|
||||||
else
|
else
|
||||||
killall -q clixon_snmp
|
killall -q clixon_snmp
|
||||||
fi
|
fi
|
||||||
|
rm -f ${clixon_snmp_pidfile}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start backend with all varargs.
|
# Start backend with all varargs.
|
||||||
|
|
@ -601,7 +606,14 @@ function wait_restconf_stopped(){
|
||||||
# need a better way to detect liveness of clixon_snmp
|
# need a better way to detect liveness of clixon_snmp
|
||||||
function wait_snmp()
|
function wait_snmp()
|
||||||
{
|
{
|
||||||
sleep 3
|
let i=0;
|
||||||
|
while [ ! -f ${clixon_snmp_pidfile} ]; do
|
||||||
|
if [ $i -ge $DEMLOOP ]; then
|
||||||
|
err1 "snmp timeout $DEMWAIT seconds"
|
||||||
|
fi
|
||||||
|
sleep $DEMSLEEP
|
||||||
|
let i++;
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# End of test, final tests before normal exit of test
|
# End of test, final tests before normal exit of test
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,6 @@ MIB=".1.3.6.1.4.1.8072.2"
|
||||||
OID1="${MIB}.1.1" # netSnmpExampleInteger
|
OID1="${MIB}.1.1" # netSnmpExampleInteger
|
||||||
OID2="${MIB}.1.2" # netSnmpExampleSleeper
|
OID2="${MIB}.1.2" # netSnmpExampleSleeper
|
||||||
OID3="${MIB}.1.3" # netSnmpExampleString
|
OID3="${MIB}.1.3" # netSnmpExampleString
|
||||||
OID4="${MIB}.3.2.1" # netSnmpExampleHeartbeatRate
|
|
||||||
|
|
||||||
new "$snmpget"
|
new "$snmpget"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue