[ntpsec commit] Delete ntpsnmpd. It's not conformant with RFC 5907...
Eric S. Raymond
esr at ntpsec.org
Wed Sep 30 00:07:39 UTC 2015
Module: ntpsec
Branch: master
Commit: 755cd525ad5011581c1a46d140d325bc3b1f6c76
Changeset: http://git.ntpsec.org/ntpsec/commit/?id=755cd525ad5011581c1a46d140d325bc3b1f6c76
Author: Eric S. Raymond <esr at thyrsus.com>
Date: Tue Sep 29 20:04:43 2015 -0400
Delete ntpsnmpd. It's not conformant with RFC 5907...
...it uses a private MIB identifier rather than the IANA-assigned one.
This is curious, given that it was written by the same Heiko Gerstung who
wrote the RFC.
---
README | 2 -
ntpsnmpd/README | 40 --
ntpsnmpd/netsnmp_daemonize.c | 159 -------
ntpsnmpd/ntpSnmpSubagentObject.c | 549 ------------------------
ntpsnmpd/ntpSnmpSubagentObject.h | 81 ----
ntpsnmpd/ntp_snmp.h | 37 --
ntpsnmpd/ntpsnmpd.c | 150 -------
ntpsnmpd/ntpsnmpd.txt | 97 -----
ntpsnmpd/ntpv4-mib.mib | 892 ---------------------------------------
pylib/configure.py | 2 +
wscript | 1 -
11 files changed, 2 insertions(+), 2008 deletions(-)
diff --git a/README b/README
index 4dae38b..9d3dc49 100644
--- a/README
+++ b/README
@@ -67,8 +67,6 @@ ntpq/:: Directory containing sources for a utility program to
related timekeeping information. This program conforms
to Appendix A of the NTP Version 3 Specification RFC 1305.
-ntpsnmpd/:: NTP SNMP subagent for Net-SNMP.
-
ports/:: Subdirectories of this contain code for non-Unix operating
systems. At present there is just one, for Windows.
diff --git a/ntpsnmpd/README b/ntpsnmpd/README
deleted file mode 100644
index 5227f40..0000000
--- a/ntpsnmpd/README
+++ /dev/null
@@ -1,40 +0,0 @@
-NTP SNMP subagent for Net-SNMP
-
-Installation Guides:
-
-- install net-snmp from source (configure, make;, make install)
-- edit the snmpd configuration file (/usr/local/share/snmp/snmpd.conf):
- add the lines
- master agentx
- agentXSocket tcp:localhost:705
- and check which read-only community is configured (should be "rocommunity public")
-- start snmpd (sudo /usr/local/sbin/snmpd) and check that it is running correctly by running the command
- snmpwalk -v2c -c public localhost
- (which should output a lot of data values for the supported built-in MIBs of net-snmp)
-- build the libntpq and the libntp library
-- build the ntpsnmpd application (make) and run it (./ntpsnmpd)
-- now you can run
- snmpwalk -v2c -c public localhost enterprises.5597.99
- which should give you a list of all currently supported NTP MIB objects and their current values
-
-Please note that currently I use a private MIB OID (enterprises.5597 is the Meinberg top level OEM OID and 99 is my temporary working space for this project).
-The final OID has to be registered with IANA and this is done by the RFC Editor when the NTPv4 MIB RFC is standardized.
-I will try to do this earlier in order to be able to have a working solution at the end of this project.
-
-In its current state the daemon supports these objects:
-
-ntpEntSoftwareName
-ntpEntSoftwareVersion
-ntpEntSoftwareVersionVal
-ntpEntSoftwareVendor
-ntpEntSystemType
-ntpEntTimeResolution
-ntpEntTimeResolutionVal
-ntpEntTimePrecision
-ntpEntTimePrecisionVal
-ntpEntTimeDistance
-
-They all use the libntpq library to access information from the ntpd instance with mode 6 packets.
-
-Next step is to implement the status section of the MIB (section 2).
-
diff --git a/ntpsnmpd/netsnmp_daemonize.c b/ntpsnmpd/netsnmp_daemonize.c
deleted file mode 100644
index 0109953..0000000
--- a/ntpsnmpd/netsnmp_daemonize.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * system.c
- */
-/* Portions of this file are subject to the following copyright(s). See
- * the Net-SNMP's COPYING file for more details and other copyrights
- * that may apply:
- */
-/***********************************************************
- Copyright 1992 by Carnegie Mellon University
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of CMU not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-******************************************************************/
-/*
- * Portions of this file are copyrighted by:
- * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms specified in the COPYING file
- * distributed with the Net-SNMP package.
- */
-/*
- * System dependent routines go here
- */
-#include <net-snmp/net-snmp-config.h>
-#undef PACKAGE_BUGREPORT
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_URL
-#undef PACKAGE_VERSION
-#include <config.h>
-
-#ifdef NEED_NETSNMP_DAEMONIZE
-
-#include <stdio.h>
-#include <errno.h>
-
-#include <unistd.h>
-#include <stdlib.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-/**
- * fork current process into the background.
- *
- * This function forks a process into the background, in order to
- * become a daemon process. It does a few things along the way:
- *
- * - becoming a process/session group leader, and forking a second time so
- * that process/session group leader can exit.
- *
- * - changing the working directory to /
- *
- * - closing stdin, stdout and stderr (unless stderr_log is set) and
- * redirecting them to /dev/null
- *
- * @param quit_immediately : indicates if the parent process should
- * exit after a successful fork.
- * @param stderr_log : indicates if stderr is being used for
- * logging and shouldn't be closed
- * @returns -1 : fork error
- * 0 : child process returning
- * >0 : parent process returning. returned value is the child PID.
- */
-int
-netsnmp_daemonize(int quit_immediately, int stderr_log)
-{
- int i = 0;
- int saved_errno;
-
- DEBUGMSGT(("daemonize","deamonizing...\n"));
-#ifdef HAVE_WORKING_FORK
- /*
- * Fork to return control to the invoking process and to
- * guarantee that we aren't a process group leader.
- */
- i = fork();
- if (i != 0) {
- /* Parent. */
- saved_errno = errno;
- DEBUGMSGT(("daemonize","first fork returned %d.\n", i));
- if(i == -1) {
- snmp_log(LOG_ERR,"first fork failed (errno %d) in "
- "netsnmp_daemonize()\n", saved_errno);
- return -1;
- }
- if (quit_immediately) {
- DEBUGMSGT(("daemonize","parent exiting\n"));
- exit(0);
- }
- } else {
- /* Child. */
- /* Become a process/session group leader. */
- setsid();
- /*
- * Fork to let the process/session group leader exit.
- */
- if ((i = fork()) != 0) {
- saved_errno = errno;
- DEBUGMSGT(("daemonize","second fork returned %d.\n", i));
- if(i == -1) {
- snmp_log(LOG_ERR,"second fork failed (errno %d) in "
- "netsnmp_daemonize()\n", saved_errno);
- }
- /* Parent. */
- exit(0);
- }
-#ifndef WIN32
- else {
- /* Child. */
-
- DEBUGMSGT(("daemonize","child continuing\n"));
-
- /* Avoid keeping any directory in use. */
- chdir("/");
-
- if (!stderr_log) {
- /*
- * Close inherited file descriptors to avoid
- * keeping unnecessary references.
- */
- close(0);
- close(1);
- close(2);
-
- /*
- * Redirect std{in,out,err} to /dev/null, just in
- * case.
- */
- open("/dev/null", O_RDWR);
- dup(0);
- dup(0);
- }
- }
-#endif /* !WIN32 */
- }
-#endif /* HAVE_WORKING_FORK */
- return i;
-}
-
-#else /* !NEED_NETSNMP_DAEMONIZE */
-int netsnp_daemonize_bs;
-#endif
diff --git a/ntpsnmpd/ntpSnmpSubagentObject.c b/ntpsnmpd/ntpSnmpSubagentObject.c
deleted file mode 100644
index c41dc56..0000000
--- a/ntpsnmpd/ntpSnmpSubagentObject.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/*****************************************************************************
- *
- * ntpSnmpSubAgentObject.c
- *
- * This file provides the callback functions for net-snmp and registers the
- * serviced MIB objects with the master agent.
- *
- * Each object has its own callback function that is called by the
- * master agent process whenever someone queries the corresponding MIB
- * object.
- *
- * At the moment this triggers a full send/receive procedure for each
- * queried MIB object, one of the things that are still on my todo list:
- * a caching mechanism that reduces the number of requests sent to the
- * ntpd process.
- *
- ****************************************************************************/
-#include <ntp_snmp.h>
-#include <ctype.h>
-#include <ntp.h>
-#include <libntpq.h>
-
-/* general purpose buffer length definition */
-#define NTPQ_BUFLEN 2048
-
-char ntpvalue[NTPQ_BUFLEN];
-
-
-/*****************************************************************************
- *
- * ntpsnmpd_parse_string
- *
- * This function will parse a given NULL terminated string and cut it
- * into a fieldname and a value part (using the '=' as the delimiter.
- * The fieldname will be converted to uppercase and all whitespace
- * characters are removed from it.
- * The value part is stripped, e.g. all whitespace characters are removed
- * from the beginning and end of the string.
- * If the value is started and ended with quotes ("), they will be removed
- * and everything between the quotes is left untouched (including
- * whitespace)
- * Example:
- * server host name = hello world!
- * will result in a field string "SERVERHOSTNAME" and a value
- * of "hello world!".
- * My first Parameter = " is this! "
- * results in a field string "MYFIRSTPARAMETER" and a value " is this! "
- ****************************************************************************
- * Parameters:
- * string const char * The source string to parse.
- * NOTE: must be NULL terminated!
- * field char * The buffer for the field name.
- * fieldsize size_t The size of the field buffer.
- * value char * The buffer for the value.
- * valuesize size_t The size of the value buffer.
- *
- * Returns:
- * size_t length of value string
- ****************************************************************************/
-
-size_t
-ntpsnmpd_parse_string(
- const char * string,
- char * field,
- size_t fieldsize,
- char * value,
- size_t valuesize
- )
-{
- int i;
- int j;
- bool loop;
- size_t str_cnt;
- size_t val_cnt;
-
- /* we need at least one byte to work with to simplify */
- if (fieldsize < 1 || valuesize < 1)
- return 0;
-
- str_cnt = strlen(string);
-
- /* Parsing the field name */
- j = 0;
- loop = true;
- for (i = 0; loop && i <= str_cnt; i++) {
- switch (string[i]) {
-
- case '\t': /* Tab */
- case '\n': /* LF */
- case '\r': /* CR */
- case ' ': /* Space */
- break;
-
- case '=':
- loop = false;
- break;
-
- default:
- if (j < fieldsize)
- field[j++] = toupper(string[i]);
- }
- }
-
- j = min(j, fieldsize - 1);
- field[j] = '\0';
-
- /* Now parsing the value */
- value[0] = '\0';
- j = 0;
- for (val_cnt = 0; i < str_cnt; i++) {
- if (string[i] > 0x0D && string[i] != ' ')
- val_cnt = min(j + 1, valuesize - 1);
-
- if (value[0] != '\0' ||
- (string[i] > 0x0D && string[i] != ' ')) {
- if (j < valuesize)
- value[j++] = string[i];
- }
- }
- value[val_cnt] = '\0';
-
- if (value[0] == '"') {
- val_cnt--;
- strlcpy(value, &value[1], valuesize);
- if (val_cnt > 0 && value[val_cnt - 1] == '"') {
- val_cnt--;
- value[val_cnt] = '\0';
- }
- }
-
- return val_cnt;
-}
-
-
-/*****************************************************************************
- *
- * ntpsnmpd_cut_string
- *
- * This function will parse a given NULL terminated string and cut it
- * into fields using the specified delimiter character.
- * It will then copy the requested field into a destination buffer
- * Example:
- * ntpsnmpd_cut_string(read:my:lips:fool, RESULT, ':', 2, sizeof(RESULT))
- * will copy "lips" to RESULT.
- ****************************************************************************
- * Parameters:
- * src const char * The name of the source string variable
- * NOTE: must be NULL terminated!
- * dest char * The name of the string which takes the
- * requested field content
- * delim char The delimiter character
- * fieldnumber int The number of the required field
- * (start counting with 0)
- * maxsize size_t The maximum size of dest
- *
- * Returns:
- * size_t length of resulting dest string
- ****************************************************************************/
-
-size_t
-ntpsnmpd_cut_string(
- const char * string,
- char * dest,
- char delim,
- int fieldnumber,
- size_t maxsize
- )
-{
- size_t i;
- size_t j;
- int l;
- size_t str_cnt;
-
- if (maxsize < 1)
- return 0;
-
- str_cnt = strlen(string);
- j = 0;
- memset(dest, 0, maxsize);
-
- /* Parsing the field name */
- for (i = 0, l = 0; i < str_cnt && l <= fieldnumber; i++) {
- if (string[i] == delim)
- l++; /* next field */
- else if (l == fieldnumber && j < maxsize)
- dest[j++] = string[i];
- }
- j = min(j, maxsize - 1);
- dest[j] = '\0';
-
- return j;
-}
-
-
-/*****************************************************************************
- *
- * read_ntp_value
- *
- * This function retrieves the value for a given variable, currently
- * this only supports sysvars. It starts a full mode 6 send/receive/parse
- * iteration and needs to be optimized, e.g. by using a caching mechanism
- *
- ****************************************************************************
- * Parameters:
- * variable char* The name of the required variable
- * rbuffer char* The buffer where the value goes
- * maxlength int Max. number of bytes for resultbuf
- *
- * Returns:
- * u_int number of chars that have been copied to
- * rbuffer
- ****************************************************************************/
-
-size_t
-read_ntp_value(
- const char * variable,
- char * value,
- size_t valuesize
- )
-{
- size_t sv_len;
- char sv_data[NTPQ_BUFLEN];
-
- memset(sv_data, 0, sizeof(sv_data));
- sv_len = ntpq_read_sysvars(sv_data, sizeof(sv_data));
-
- if (0 == sv_len)
- return 0;
- else
- return ntpq_getvar(sv_data, sv_len, variable, value,
- valuesize);
-}
-
-
-/*****************************************************************************
- *
- * The get_xxx functions
- *
- * The following function calls are callback functions that will be
- * used by the master agent process to retrieve a value for a requested
- * MIB object.
- *
- ****************************************************************************/
-
-
-int get_ntpEntSoftwareName (netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *reqinfo,
- netsnmp_request_info *requests)
-{
- char ntp_softwarename[NTPQ_BUFLEN];
-
- memset (ntp_softwarename, 0, NTPQ_BUFLEN);
-
- switch (reqinfo->mode) {
- case MODE_GET:
- {
- if ( read_ntp_value("product", ntpvalue, NTPQ_BUFLEN) )
- {
- snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
- (uint8_t *)ntpvalue,
- strlen(ntpvalue)
- );
- }
- else if ( read_ntp_value("version", ntpvalue, NTPQ_BUFLEN) )
- {
- ntpsnmpd_cut_string(ntpvalue, ntp_softwarename, ' ', 0, sizeof(ntp_softwarename)-1);
- snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
- (uint8_t *)ntp_softwarename,
- strlen(ntp_softwarename)
- );
- } else {
- snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
- (uint8_t *)"N/A",
- 3
- );
- }
- break;
-
- }
-
-
- default:
- /* If we cannot get the information we need, we will return a generic error to the SNMP client */
- return SNMP_ERR_GENERR;
- }
-
- return SNMP_ERR_NOERROR;
-}
-
-
-int get_ntpEntSoftwareVersion (netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *reqinfo,
- netsnmp_request_info *requests)
-{
-
- switch (reqinfo->mode) {
- case MODE_GET:
- {
-
- if ( read_ntp_value("version", ntpvalue, NTPQ_BUFLEN) )
- {
- snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
- (uint8_t *)ntpvalue,
- strlen(ntpvalue)
- );
- } else {
- snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
- (uint8_t *)"N/A",
- 3
- );
- }
- break;
-
- }
-
-
- default:
- /* If we cannot get the information we need, we will return a generic error to the SNMP client */
- return SNMP_ERR_GENERR;
- }
-
- return SNMP_ERR_NOERROR;
-}
-
-
-int get_ntpEntSoftwareVendor (netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *reqinfo,
- netsnmp_request_info *requests)
-{
-
- switch (reqinfo->mode) {
- case MODE_GET:
- {
-
- if ( read_ntp_value("vendor", ntpvalue, NTPQ_BUFLEN) )
- {
- snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
- (uint8_t *)ntpvalue,
- strlen(ntpvalue)
- );
- } else {
- snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
- (uint8_t *)"N/A",
- 3
- );
- }
- break;
-
- default:
- /* If we cannot get the information we need, we will return a generic error to the SNMP client */
- return SNMP_ERR_GENERR;
- }
- }
- return SNMP_ERR_NOERROR;
-}
-
-
-int get_ntpEntSystemType (netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *reqinfo,
- netsnmp_request_info *requests)
-{
-
- switch (reqinfo->mode) {
- case MODE_GET:
- {
-
- if ( read_ntp_value("systemtype", ntpvalue, NTPQ_BUFLEN) )
- {
- snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
- (uint8_t *)ntpvalue,
- strlen(ntpvalue)
- );
- }
-
- if ( read_ntp_value("system", ntpvalue, NTPQ_BUFLEN) )
- {
- snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
- (uint8_t *)ntpvalue,
- strlen(ntpvalue)
- );
- } else {
- snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
- (uint8_t *)"N/A",
- 3
- );
- }
- break;
-
- }
-
-
- default:
- /* If we cannot get the information we need, we will return a generic error to the SNMP client */
- return SNMP_ERR_GENERR;
- }
-
- return SNMP_ERR_NOERROR;
-}
-
-
-/*
- * ntpEntTimeResolution
- * "The time resolution in integer format, where the resolution
- * is represented as divisions of a second, e.g., a value of 1000
- * translates to 1.0 ms."
- *
- * ntpEntTimeResolution is a challenge for ntpd, as the resolution is
- * not known nor exposed by ntpd, only the measured precision (time to
- * read the clock).
- *
- * Logically the resolution must be at least the precision, so report
- * it as our best approximation of resolution until/unless ntpd provides
- * better.
- */
-int
-get_ntpEntTimeResolution(
- netsnmp_mib_handler * handler,
- netsnmp_handler_registration * reginfo,
- netsnmp_agent_request_info * reqinfo,
- netsnmp_request_info * requests
- )
-{
- int precision;
- uint32_t resolution;
-
- switch (reqinfo->mode) {
-
- case MODE_GET:
- if (!read_ntp_value("precision", ntpvalue,
- sizeof(ntpvalue)))
- return SNMP_ERR_GENERR;
- if (1 != sscanf(ntpvalue, "%d", &precision))
- return SNMP_ERR_GENERR;
- if (precision >= 0)
- return SNMP_ERR_GENERR;
- precision = max(precision, -31);
- resolution = 1 << -precision;
- snmp_set_var_typed_value(
- requests->requestvb,
- ASN_UNSIGNED,
- (void *)&resolution,
- sizeof(resolution));
- break;
-
- default:
- return SNMP_ERR_GENERR;
- }
-
- return SNMP_ERR_NOERROR;
-}
-
-
-/*
- * ntpEntTimePrecision
- * "The entity's precision in integer format, shows the precision.
- * A value of -5 would mean 2^-5 = 31.25 ms."
- */
-int
-get_ntpEntTimePrecision(
- netsnmp_mib_handler * handler,
- netsnmp_handler_registration * reginfo,
- netsnmp_agent_request_info * reqinfo,
- netsnmp_request_info * requests
- )
-{
- int precision;
- int32_t precision32;
-
- switch (reqinfo->mode) {
-
- case MODE_GET:
- if (!read_ntp_value("precision", ntpvalue,
- sizeof(ntpvalue)))
- return SNMP_ERR_GENERR;
- if (1 != sscanf(ntpvalue, "%d", &precision))
- return SNMP_ERR_GENERR;
- precision32 = (int32_t)precision;
- snmp_set_var_typed_value(
- requests->requestvb,
- ASN_INTEGER,
- (void *)&precision32,
- sizeof(precision32));
- break;
-
- default:
- return SNMP_ERR_GENERR;
- }
-
- return SNMP_ERR_NOERROR;
-}
-
-
-int get_ntpEntTimeDistance (netsnmp_mib_handler *handler,
- netsnmp_handler_registration *reginfo,
- netsnmp_agent_request_info *reqinfo,
- netsnmp_request_info *requests)
-{
- switch (reqinfo->mode) {
- case MODE_GET:
- {
-
- if ( read_ntp_value("rootdelay", ntpvalue, NTPQ_BUFLEN) )
- {
- snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
- (uint8_t *)ntpvalue,
- strlen(ntpvalue)
- );
- } else {
- snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
- (uint8_t *)"N/A",
- 3
- );
- }
- break;
-
- }
-
-
- default:
- /* If we cannot get the information we need, we will return a generic error to the SNMP client */
- return SNMP_ERR_GENERR;
- }
-
- return SNMP_ERR_NOERROR;
-}
-
-
-/*
- *
- * Initialize sub agent
- */
-
-void
-init_ntpSnmpSubagentObject(void)
-{
- /* Register all MIB objects with the agentx master */
- NTP_OID_RO( ntpEntSoftwareName, 1, 1, 1, 0);
- NTP_OID_RO( ntpEntSoftwareVersion, 1, 1, 2, 0);
- NTP_OID_RO( ntpEntSoftwareVendor, 1, 1, 3, 0);
- NTP_OID_RO( ntpEntSystemType, 1, 1, 4, 0);
- NTP_OID_RO( ntpEntTimeResolution, 1, 1, 5, 0);
- NTP_OID_RO( ntpEntTimePrecision, 1, 1, 6, 0);
- NTP_OID_RO( ntpEntTimeDistance, 1, 1, 7, 0);
-}
-
diff --git a/ntpsnmpd/ntpSnmpSubagentObject.h b/ntpsnmpd/ntpSnmpSubagentObject.h
deleted file mode 100644
index fbdcb2e..0000000
--- a/ntpsnmpd/ntpSnmpSubagentObject.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*****************************************************************************
- *
- * ntpSnmpSubAgentObject.h
- *
- * Definitions and macros for ntpSnmpSubAgentObject.c
- *
- ****************************************************************************/
-
-
-#ifndef GUARD_NTPSNMPSUBAGENTOBJECT_H
-#define GUARD_NTPSNMPSUBAGENTOBJECT_H
-
-/* Function Prototypes */
-size_t ntpsnmpd_parse_string(const char *string, char *field, size_t
- fieldsize, char *value, size_t valuesize);
-size_t ntpsnmpd_cut_string(const char *string, char *dest, char delim,
- int fieldnumber, size_t maxsize);
-size_t read_ntp_value(const char *variable, char *value,
- size_t valuesize);
-
-/* Initialization */
-void init_ntpSnmpSubagentObject(void);
-
-/* MIB Section 1 Callback Functions*/
-Netsnmp_Node_Handler get_ntpEntSoftwareName;
-Netsnmp_Node_Handler get_ntpEntSoftwareVersion;
-Netsnmp_Node_Handler get_ntpEntSoftwareVendor;
-Netsnmp_Node_Handler get_ntpEntSystemType;
-Netsnmp_Node_Handler get_ntpEntTimeResolution;
-Netsnmp_Node_Handler get_ntpEntTimePrecision;
-Netsnmp_Node_Handler get_ntpEntTimeDistance;
-
-/* MIB Section 2 Callback Functions (TODO) */
-Netsnmp_Node_Handler get_ntpEntStatusCurrentMode;
-Netsnmp_Node_Handler get_ntpEntStatusCurrentModeVal;
-Netsnmp_Node_Handler get_ntpEntStatusStratum;
-Netsnmp_Node_Handler get_ntpEntStatusActiveRefSourceId;
-Netsnmp_Node_Handler get_ntpEntStatusActiveRefSourceName;
-Netsnmp_Node_Handler get_ntpEntStatusActiveOffset;
-
-#define NTPV4_OID 1,3,6,1,2,1,197 /* mib-2 197 */
-
-
-/*
- * The following macros simplify the registration of the callback
- * functions and register the name and OID of either read-only (RO) or
- * read-write (RW) functions.
- */
-
-#define SETUP_OID_RO(oidname, ...) \
-static oid oidname##_oid [] = { __VA_ARGS__ }; \
-{ \
- netsnmp_register_read_only_instance( \
- netsnmp_create_handler_registration( \
- "#oidname", \
- get_##oidname, \
- oidname##_oid, \
- OID_LENGTH \
- ( oidname##_oid ), \
- HANDLER_CAN_RONLY)); \
-}
-
-#define SETUP_OID_RW(oidname, ...) \
-static oid oidname##_oid [] = { __VA_ARGS__ }; \
-{ \
- netsnmp_register_instance( \
- netsnmp_create_handler_registration( \
- "#oidname", \
- do_##oidname, \
- oidname##_oid, \
- OID_LENGTH \
- ( oidname##_oid ), \
- HANDLER_CAN_RWRITE)); \
-}
-
-#define NTP_OID_RO(oidname, w, x, y, z) \
- SETUP_OID_RO(oidname, NTPV4_OID, w, x, y, z)
-#define NTP_OID_RW(oidname, w, x, y, z) \
- SETUP_OID_RW(oidname, NTPV4_OID, w, x, y, z)
-
-#endif
diff --git a/ntpsnmpd/ntp_snmp.h b/ntpsnmpd/ntp_snmp.h
deleted file mode 100644
index b605758..0000000
--- a/ntpsnmpd/ntp_snmp.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * ntp_snmp.h -- common net-snmp header includes and workaround
- * for Autoconf-related PACKAGE_* redefinitions between
- * net-snmp and NTP.
- *
- * Currently ntpsnmpd *.c files are exceptions to the rule that every .c
- * file should include <config.h> before any other headers. It would be
- * ideal to rearrange its includes so that our config.h is first, but
- * that is complicated by the redefinitions between our config.h and
- * net-snmp/net-snmp-config.h.
- */
-
-#include <net-snmp/net-snmp-config.h>
-#include <net-snmp/net-snmp-includes.h>
-#include <net-snmp/agent/net-snmp-agent-includes.h>
-
-#ifdef PACKAGE_BUGREPORT
-# undef PACKAGE_BUGREPORT
-#endif
-#ifdef PACKAGE_NAME
-# undef PACKAGE_NAME
-#endif
-#ifdef PACKAGE_STRING
-# undef PACKAGE_STRING
-#endif
-#ifdef PACKAGE_TARNAME
-# undef PACKAGE_TARNAME
-#endif
-#ifdef PACKAGE_URL
-# undef PACKAGE_URL
-#endif
-#ifdef PACKAGE_VERSION
-# undef PACKAGE_VERSION
-#endif
-
-#include <ntpSnmpSubagentObject.h>
-#include <config.h>
diff --git a/ntpsnmpd/ntpsnmpd.c b/ntpsnmpd/ntpsnmpd.c
deleted file mode 100644
index 5f17f3a..0000000
--- a/ntpsnmpd/ntpsnmpd.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*****************************************************************************
- *
- * ntpsnmpd.c
- *
- * The NTP SNMP daemon is an Agent X subagent application that
- * registers itself with a running SNMP Agent X master process running
- * on the same machine on port TCP 705. It utilizes the libntqp library
- * which accesses status and general data of a running ntpd process on
- * the same machine and enables the user to monitor the status of a
- * ntp daemon process via SNMP.
- *
- * This started as a Google Summer of Code 2008 project,
- * including the ntpsnmpd sub agent and the libntpq library.
- *
- * For more information please visit
- * http://support.ntp.org/bin/view/Dev/GSoC2008snmp
- * Or contact:
- * Harlan Stenn (Mentor) at stenn at ntp.org
- * Heiko Gerstung (Student) at gerstung at ntp.org
- *
- ****************************************************************************/
-
-#include <ntp_snmp.h>
-
-#include <signal.h>
-#include <sys/time.h>
-
-#ifdef SOLARIS /* needed with at least Solaris 8 */
-#include <siginfo.h>
-#endif
-
-#include <libntpq.h>
-
-#include "ntp_stdlib.h" /* for getopt_long() */
-
-static bool keep_running;
-void stop_server(int);
-
-void
-stop_server(int a) {
- keep_running = false;
-}
-
-/* The main function just sets up a few things and then enters a loop
- * in which it will wait for SNMP requests coming from the master
- * agent
- */
-
-static bool opt_nofork;
-static bool opt_syslog;
-static char opt_agentxsocket = "unix:/var/agentx/master";
-
-#define ALL_OPTIONS "npx:"
-static const struct option longoptions[] = {
- { "nofork", 0, 0, 'n' },
- { "syslog", 0, 0, 'p' },
- { "agentXSocket", 0, 0, 'x' },
- { NULL, 0, 0, '\0'},
-};
-
-
-int
-main (int argc, char **argv) {
- bool background = false; /* start as background process */
- bool use_syslog = true; /* use syslog for logging */
-
- {
- int optcnt;
-
- while ((op = ntp_getopt_long(argc, argv,
- ALL_OPTIONS, longoptions, NULL)) != -1) {
-
- switch (op) {
- case 'n':
- opt_nofork = true;
- break;
- case 'p':
- opt_syslog = true;
- break;
- case 'x':
- opt_argentxsocket = ntp_optarg;
- break;
- }
-
- argc -= ntp_optind;
- argv += ntp_optinf;
- }
-
- if (!opt_nofork)
- background = true;
-
- if (!opt_syslog)
- use_syslog = false;
-
- /* using the net-snmp syslog facility */
- if (use_syslog)
- snmp_enable_calllog();
- else
- snmp_enable_stderrlog();
-
- /* Become Subagent */
- netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1);
-
- /* go into background mode, if requested */
- if (background && netsnmp_daemonize(1, !use_syslog))
- exit(1);
-
- /* Now register with the master Agent X process */
-
- /* call Netsnmp socket startup macro, which will initialize the network stuff if required */
- SOCK_STARTUP;
-
- /* Set AgentX socket interface */
- netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
- NETSNMP_DS_AGENT_X_SOCKET, opt_agentxsocket);
-
- init_agent("ntpsnmpd");
-
- /* Try to connect to ntpd */
- if ( ntpq_openhost("localhost", 0) == 0 )
- {
- fprintf(stderr, "Error: Could not connect to ntpd. Aborting.\n");
- exit(1);
- }
-
-
- /* Register callback functions ... */
- init_ntpSnmpSubagentObject();
- init_snmp("ntpsnmpd");
-
- /* Signal handler */
- keep_running = true;
- signal(SIGTERM, stop_server);
- signal(SIGINT, stop_server);
-
- snmp_log(LOG_INFO,"ntpsnmpd started.\n");
-
- /* main loop here... */
- while(keep_running) {
- agent_check_and_process(1); /* 0 == don't block */
- }
-
- /* at shutdown time */
- ntpq_closehost();
- snmp_shutdown("ntpsnmpd");
- SOCK_CLEANUP;
-
- return 0;
-}
-
diff --git a/ntpsnmpd/ntpsnmpd.txt b/ntpsnmpd/ntpsnmpd.txt
deleted file mode 100644
index e89c3eb..0000000
--- a/ntpsnmpd/ntpsnmpd.txt
+++ /dev/null
@@ -1,97 +0,0 @@
-= ntpsnmpd(8) =
-:doctype: manpage
-
-== SYNOPSIS ==
-
-ntpsnmpd [-n] [-p] [-x transport:socket]
-
-== DESCRIPTION ==
-
-`ntpsnmpd` is an SNMP MIB agent designed to interface with ntpd.
-
-== OPTIONS ==
-
-`-n`, `--nofork`::
- Do not fork.
-`-p`, `--syslog`::
- Log to syslog().
-`--agentxsocket`=string::
- The socket address ntpsnmpd uses to connect to net-snmpd. The default
- string for this option is:
-+
-_______________________
-unix:/var/agentx/master
-_______________________
-+
-[<transport-specifier>:]<transport-address> The default "agent X
-socket" is the Unix Domain socket _unix:/var/agentx/master_. Another
-common alternative is _tcp:localhost:705_.
-
-== USAGE ==
-
-`ntpsnmpd` currently uses a private MIB OID, 'enterprises.5597',
-which is the Meinberg top level OEM OID, and '99' is the temporary
-working space for this project. The final OID has to be registered with
-IANA and this is done by the RFC Editor when the NTPv4 MIB RFC is
-standardized.
-
-If you have snmpwalk1 installed you can run
-
--------------------------------------------------------
-% snmpwalk -v2c -c public localhost enterprises.5597.99
--------------------------------------------------------
-
-to see a list of all currently supported NTP MIB objects and their
-current values.
-
-== EXIT STATUS ==
-
-One of the following exit values will be returned:
-
-0 (EXIT_SUCCESS)::
- Successful program execution.
-1 (EXIT_FAILURE)::
- The operation failed or the command syntax was not valid.
-
-== AUTHORS ==
-
-Heiko Gerstung
-
-== COPYRIGHT ==
-
-//FIXME: NTF reference
-Copyright (C) 1992-2015 The University of Delaware and Network Time
-Foundation all rights reserved. This program is released under the terms
-of the NTP license, <http://ntp.org/license>.
-
-== BUGS ==
-
-//FIXME: ntp.org reference
-Please send bug reports to: http://bugs.ntp.org, bugs at ntp.org
-
-== NOTES ==
-
-The following objects are currently supported:
-
-`ntpEntSoftwareName`::
- please fill me in...
-`ntpEntSoftwareVersion`::
- please fill me in...
-`ntpEntSoftwareVersionVal`::
- please fill me in...
-`ntpEntSoftwareVendor`::
- please fill me in...
-`ntpEntSystemType`::
- please fill me in...
-`ntpEntTimeResolution`::
- please fill me in...
-`ntpEntTimeResolutionVal`::
- please fill me in...
-`ntpEntTimePrecision`::
- please fill me in...
-`ntpEntTimePrecisionVal`::
- please fill me in...
-`ntpEntTimeDistance`::
- please fill me in...
-
-
diff --git a/ntpsnmpd/ntpv4-mib.mib b/ntpsnmpd/ntpv4-mib.mib
deleted file mode 100644
index e8cb016..0000000
--- a/ntpsnmpd/ntpv4-mib.mib
+++ /dev/null
@@ -1,892 +0,0 @@
--- *********************************************************************
---
--- The Network Time Protocol Version 4
--- Management Information Base (MIB)
---
--- Authors: Heiko Gerstung (heiko.gerstung at meinberg.de)
--- Chris Elliott (chelliot at pobox.com)
---
--- for the Internet Engineering Task Force (IETF)
--- NTP Working Group (ntpwg)
---
---
--- *********************************************************************
--- Rev 1.00
--- Published as RFC 5907
---
--- *********************************************************************
-
-NTPv4-MIB DEFINITIONS ::= BEGIN
-
-IMPORTS
- MODULE-IDENTITY, OBJECT-TYPE , mib-2, Integer32, NOTIFICATION-TYPE,
- Unsigned32, Counter32, TimeTicks
- FROM SNMPv2-SMI -- RFC 2578
- MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP
- FROM SNMPv2-CONF -- RFC 2580
- DisplayString, TEXTUAL-CONVENTION
- FROM SNMPv2-TC -- RFC 2579
- InetAddressType, InetAddress
- FROM INET-ADDRESS-MIB -- RFC 4001
- Utf8String
- FROM SYSAPPL-MIB; -- RFC 2287
-
-ntpSnmpMIB MODULE-IDENTITY
- LAST-UPDATED "201005170000Z" -- May 17, 2010
- ORGANIZATION "The IETF NTP Working Group (ntpwg)"
- CONTACT-INFO
- " WG Email: ntpwg at lists.ntp.isc.org
- Subscribe:
- https://lists.ntp.isc.org/mailman/listinfo/ntpwg
-
- Heiko Gerstung
- Meinberg Funkuhren Gmbh & Co. KG
- Lange Wand 9
- Bad Pyrmont 31812
- Germany
-
- Phone: +49 5281 9309 25
- Email: heiko.gerstung at meinberg.de
-
- Chris Elliott
- 1516 Kent St.
- Durham, NC 27707
- USA
-
- Phone: +1-919-308-1216
- Email: chelliot at pobox.com
-
- Brian Haberman
- 11100 Johns Hopkins Road
- Laurel, MD 20723
- USA
-
- Phone: +1-443-778-1319
- Email: brian at innovationslab.net"
- DESCRIPTION
- "The Management Information Base for NTP time entities.
-
- Copyright (c) 2010 IETF Trust and the persons identified as
- authors of the code. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, is permitted pursuant to, and subject
- to the license terms contained in, the Simplified BSD License
- set forth in Section 4.c of the IETF Trust's Legal Provisions
- Relating to IETF Documents
- (http://trustee.ietf.org/license-info)."
-
- REVISION "201005170000Z"
- DESCRIPTION
- "This revision of the MIB module is published as RFC 5907."
-
- ::= { mib-2 197 }
-
-ntpSnmpMIBObjects OBJECT IDENTIFIER ::= { ntpSnmpMIB 1 }
-
--- MIB contains 6 groups
-
-ntpEntInfo OBJECT IDENTIFIER ::= { ntpSnmpMIBObjects 1 }
-ntpEntStatus OBJECT IDENTIFIER ::= { ntpSnmpMIBObjects 2 }
-ntpAssociation OBJECT IDENTIFIER ::= { ntpSnmpMIBObjects 3 }
-ntpEntControl OBJECT IDENTIFIER ::= { ntpSnmpMIBObjects 4 }
-ntpEntNotifObjects OBJECT IDENTIFIER ::= { ntpSnmpMIBObjects 5 }
-
---
--- Textual Conventions
---
-
-NtpStratum ::= TEXTUAL-CONVENTION
- DISPLAY-HINT "d"
- STATUS current
- DESCRIPTION
- "The NTP stratum, with 16 representing no stratum."
- SYNTAX Unsigned32 (1..16)
-
-NtpDateTime ::= TEXTUAL-CONVENTION
- DISPLAY-HINT "4d:4d:4d.4d"
- STATUS current
- DESCRIPTION
- "NTP date/time on the device, in 128-bit
- NTP date format. If time is not syncronized, this
- field shall be a zero-length string.
-
- This trusted certificate (TC) is not to be used for objects
- that are used to set the time of the node querying this
- object. NTP should be used for this -- or at least SNTP."
- REFERENCE "RFC 5905, section 6"
- SYNTAX OCTET STRING (SIZE (0 | 16))
-
---
--- Section 1: General NTP Entity information objects
--- (relatively static information)
---
-
-ntpEntSoftwareName OBJECT-TYPE
- SYNTAX Utf8String
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The product name of the running NTP version, e.g., 'ntpd'."
- ::= { ntpEntInfo 1 }
-
-ntpEntSoftwareVersion OBJECT-TYPE
- SYNTAX Utf8String
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The software version of the installed NTP implementation
- as a full version string, e.g., 'ntpd-4.2.0b at 1.1433 ...'"
- ::= { ntpEntInfo 2 }
-
-ntpEntSoftwareVendor OBJECT-TYPE
- SYNTAX Utf8String
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The vendor/author of the installed NTP version."
- ::= { ntpEntInfo 3 }
-
-ntpEntSystemType OBJECT-TYPE
- SYNTAX Utf8String
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "General hardware/os platform information,
- e.g., 'Linux 2.6.12 / x86'."
- -- freely configurable, default is OS Version / Hardware platform
- ::= { ntpEntInfo 4 }
-
-ntpEntTimeResolution OBJECT-TYPE
- SYNTAX Unsigned32
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The time resolution in integer format, where the resolution
- is represented as divisions of a second, e.g., a value of 1000
- translates to 1.0 ms."
- ::= { ntpEntInfo 5 }
-
-ntpEntTimePrecision OBJECT-TYPE
- SYNTAX Integer32
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The entity's precision in integer format, shows the precision.
- A value of -5 would mean 2^-5 = 31.25 ms."
- ::= { ntpEntInfo 6 }
-
-ntpEntTimeDistance OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The distance from this NTP entity to the root time reference
- (stratum 0) source including the unit, e.g., '13.243 ms'."
- ::= { ntpEntInfo 7 }
-
---
--- Section 2: Current NTP status (dynamic information)
---
-
-ntpEntStatusCurrentMode OBJECT-TYPE
- SYNTAX INTEGER {
- notRunning(1),
- notSynchronized(2),
- noneConfigured(3),
- syncToLocal(4),
- syncToRefclock(5),
- syncToRemoteServer(6),
- unknown(99)
- }
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The current mode of the NTP. The definition of each possible
- value is:
- notRunning(1) - NTP is not running.
- notSynchronized(2) - NTP is not synchronized to any time
- source (stratum = 16).
- noneConfigured(3) - NTP is not synchronized and does not
- have a reference configured
- (stratum = 16).
- syncToLocal(4) - NTP is distributing time based on its
- local clock (degraded accuracy and/or
- reliability).
- syncToRefclock(5) - NTP is synchronized to a local
- hardware refclock (e.g., GPS).
- syncToRemoteServer(6) - NTP is synchronized to a remote
- NTP server ('upstream' server).
- unknown(99) - The state of NTP is unknown."
- ::= { ntpEntStatus 1 }
-
-ntpEntStatusStratum OBJECT-TYPE
- SYNTAX NtpStratum
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The NTP entity's own stratum value. Should be a stratum of
- syspeer + 1 (or 16 if no syspeer)."
- ::= { ntpEntStatus 2 }
-
-ntpEntStatusActiveRefSourceId OBJECT-TYPE
- SYNTAX Unsigned32 ( 0..99999 )
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The association ID of the current syspeer."
- ::= { ntpEntStatus 3 }
-
-ntpEntStatusActiveRefSourceName OBJECT-TYPE
- SYNTAX Utf8String
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The hostname/descriptive name of the current reference source
- selected as syspeer, e.g., 'ntp1.ptb.de' or 'GPS' or
- 'DCFi', ..."
- ::= { ntpEntStatus 4 }
-
-ntpEntStatusActiveOffset OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The time offset to the current selected reference time source
- as a string including unit, e.g., '0.032 ms' or '1.232 s'."
- ::= { ntpEntStatus 5 }
-
-ntpEntStatusNumberOfRefSources OBJECT-TYPE
- SYNTAX Unsigned32 (0..99)
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The number of reference sources configured for NTP."
- ::= { ntpEntStatus 6 }
-
-ntpEntStatusDispersion OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The root dispersion of the running NTP entity, e.g., '6.927'."
- ::= { ntpEntStatus 7 }
-
-ntpEntStatusEntityUptime OBJECT-TYPE
- SYNTAX TimeTicks
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The uptime of the NTP entity, (i.e., the time since ntpd was
- (re-)initialized not sysUptime!). The time is represented in
- hundreds of seconds since Jan 1, 1970 (00:00:00.000) UTC."
- ::= { ntpEntStatus 8 }
-
-ntpEntStatusDateTime OBJECT-TYPE
- SYNTAX NtpDateTime
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The current NTP date/time on the device, in 128-bit
- NTP date format. If time is not syncronized, this
- field shall be a zero-length string.
-
- This object can be used to timestamp events on this
- node and allow a management station to correlate
- different time objects. For example, a management
- station could query this object and sysUpTime in
- the same operation to be able to relate sysUpTime
- to NTP time.
-
- This object is not to be used to set the time of
- the node querying this object. NTP should be used
- for this -- or at least SNTP."
- REFERENCE "RFC 5905, section 6"
- ::= { ntpEntStatus 9 }
-
-ntpEntStatusLeapSecond OBJECT-TYPE
- SYNTAX NtpDateTime
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "Date the next known leap second will occur. If there is
- no leap second announced, then this object should be 0."
- ::= { ntpEntStatus 10 }
-
-ntpEntStatusLeapSecDirection OBJECT-TYPE
- SYNTAX Integer32 (-1..1)
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "Direction of next known leap second. If there is no
- leap second announced, then this object should be 0."
- ::= { ntpEntStatus 11 }
-
-ntpEntStatusInPkts OBJECT-TYPE
- SYNTAX Counter32
- UNITS "packets"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of NTP messages delivered to the
- NTP entity from the transport service.
- Discountinuities in the value of this counter can occur
- upon cold start or reinitialization of the NTP entity, the
- management system and at other times as indicated by
- discontinuities in the value of sysUpTime."
- ::= { ntpEntStatus 12 }
-
-ntpEntStatusOutPkts OBJECT-TYPE
- SYNTAX Counter32
- UNITS "packets"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of NTP messages delivered to the
- transport service by this NTP entity.
- Discountinuities in the value of this counter can occur
- upon cold start or reinitialization of the NTP entity, the
- management system and at other times as indicated by
- discontinuities in the value of sysUpTime."
- ::= { ntpEntStatus 13 }
-
-ntpEntStatusBadVersion OBJECT-TYPE
- SYNTAX Counter32
- UNITS "packets"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of NTP messages that were delivered
- to this NTP entity and were for an unsupported NTP
- version.
- Discountinuities in the value of this counter can occur
- upon cold start or reinitialization of the NTP entity, the
- management system and at other times as indicated by
- discontinuities in the value of sysUpTime."
- ::= { ntpEntStatus 14 }
-
-ntpEntStatusProtocolError OBJECT-TYPE
- SYNTAX Counter32
- UNITS "packets"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of NTP messages that were delivered
- to this NTP entity and this entity was not able to
- process due to an NTP protocol error.
- Discountinuities in the value of this counter can occur
- upon cold start or reinitialization of the NTP entity, the
- management system and at other times as indicated by
- discontinuities in the value of sysUpTime."
- ::= { ntpEntStatus 15 }
-
-ntpEntStatusNotifications OBJECT-TYPE
- SYNTAX Counter32
- UNITS "notifications"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of SNMP notifications that this NTP
- entity has generated.
- Discountinuities in the value of this counter can occur
- upon cold start or reinitialization of the NTP entity, the
- management system and at other times as indicated by
- discontinuities in the value of sysUpTime."
- ::= { ntpEntStatus 16 }
-
-ntpEntStatPktModeTable OBJECT-TYPE
- SYNTAX SEQUENCE OF NtpEntStatPktModeEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The number of packets sent and received by packet mode.
- One entry per packet mode."
- ::= { ntpEntStatus 17 }
-
-ntpEntStatPktModeEntry OBJECT-TYPE
- SYNTAX NtpEntStatPktModeEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "A statistical record of the number of packets sent and
- received for each packet mode."
- INDEX { ntpEntStatPktMode }
- ::= { ntpEntStatPktModeTable 1 }
-
-NtpEntStatPktModeEntry ::= SEQUENCE {
- ntpEntStatPktMode INTEGER,
- ntpEntStatPktSent Counter32,
- ntpEntStatPktReceived Counter32
-}
-
-ntpEntStatPktMode OBJECT-TYPE
- SYNTAX INTEGER {
- symetricactive(1),
- symetricpassive(2),
- client(3),
- server(4),
- broadcastserver(5),
- broadcastclient(6)
- }
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The NTP packet mode."
- ::= { ntpEntStatPktModeEntry 1 }
-
-ntpEntStatPktSent OBJECT-TYPE
- SYNTAX Counter32
- UNITS "packets"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The number of NTP packets sent with this packet mode.
- Discountinuities in the value of this counter can occur
- upon cold start or reinitialization of the NTP entity, the
- management system and at other times as indicated by
- discontinuities in the value of sysUpTime."
- ::= { ntpEntStatPktModeEntry 2 }
-
-ntpEntStatPktReceived OBJECT-TYPE
- SYNTAX Counter32
- UNITS "packets"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The number of NTP packets received with this packet mode.
-
- Discountinuities in the value of this counter can occur
- upon cold start or reinitialization of the NTP entity, the
- management system and at other times as indicated by
- discontinuities in the value of sysUpTime."
- ::= { ntpEntStatPktModeEntry 3 }
-
---
--- Section 3: The status of all currently mobilized associations
---
-
-ntpAssociationTable OBJECT-TYPE
- SYNTAX SEQUENCE OF NtpAssociationEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The table of currently mobilized associations."
- ::= { ntpAssociation 1 }
-
-ntpAssociationEntry OBJECT-TYPE
- SYNTAX NtpAssociationEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The table entry of currently mobilized associations."
- INDEX { ntpAssocId }
- ::= { ntpAssociationTable 1 }
-
-NtpAssociationEntry ::= SEQUENCE {
- ntpAssocId Unsigned32,
- ntpAssocName Utf8String,
- ntpAssocRefId DisplayString,
- ntpAssocAddressType InetAddressType,
- ntpAssocAddress InetAddress,
- ntpAssocOffset DisplayString,
- ntpAssocStratum NtpStratum,
- ntpAssocStatusJitter DisplayString,
- ntpAssocStatusDelay DisplayString,
- ntpAssocStatusDispersion DisplayString
-}
-
-ntpAssocId OBJECT-TYPE
- SYNTAX Unsigned32 ( 1..99999 )
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The association ID. This is an internal, unique ID."
- ::= { ntpAssociationEntry 1 }
-
-ntpAssocName OBJECT-TYPE
- SYNTAX Utf8String
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The hostname or other descriptive name for the association."
- ::= { ntpAssociationEntry 2 }
-
-ntpAssocRefId OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The refclock driver ID, if available."
- -- a refclock driver ID like "127.127.1.0" for non
- -- uni/multi/broadcast associations
- ::= { ntpAssociationEntry 3 }
-
-ntpAssocAddressType OBJECT-TYPE
- SYNTAX InetAddressType { ipv4(1), ipv6(2), ipv4z(3), ipv6z(4) }
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The type of address of the association. Can be either IPv4 or
- IPv6 (both with or without zone index) and contains the type of
- address for unicast, multicast, and broadcast associations."
- ::= { ntpAssociationEntry 4 }
-
-ntpAssocAddress OBJECT-TYPE
- SYNTAX InetAddress (SIZE (4|8|16|20))
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The IP address (IPv4 or IPv6, with or without zone index) of
- the association. The type and size depends on the
- ntpAssocAddressType object. Represents the IP address of a
- uni/multi/broadcast association."
- ::= { ntpAssociationEntry 5 }
-
-ntpAssocOffset OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The time offset to the association as a string."
- -- including unit, e.g., "0.032 ms" or "1.232 s"
- ::= { ntpAssociationEntry 6 }
-
-ntpAssocStratum OBJECT-TYPE
- SYNTAX NtpStratum
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The association stratum value."
- ::= { ntpAssociationEntry 7 }
-
-ntpAssocStatusJitter OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The jitter in milliseconds as a string."
- ::= { ntpAssociationEntry 8 }
-
-ntpAssocStatusDelay OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The network delay in milliseconds as a string."
- ::= { ntpAssociationEntry 9 }
-
-ntpAssocStatusDispersion OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The root dispersion of the association."
- -- e.g., "6.927"
- ::= { ntpAssociationEntry 10 }
-
-ntpAssociationStatisticsTable OBJECT-TYPE
- SYNTAX SEQUENCE OF NtpAssociationStatisticsEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The table of statistics for current associations."
- ::= { ntpAssociation 2 }
-
-ntpAssociationStatisticsEntry OBJECT-TYPE
- SYNTAX NtpAssociationStatisticsEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The table entry of statistics for current associations."
- INDEX { ntpAssocId }
- ::= { ntpAssociationStatisticsTable 1 }
-
-NtpAssociationStatisticsEntry ::= SEQUENCE {
- ntpAssocStatInPkts Counter32,
- ntpAssocStatOutPkts Counter32,
- ntpAssocStatProtocolError Counter32
-}
-
-ntpAssocStatInPkts OBJECT-TYPE
- SYNTAX Counter32
- UNITS "packets"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of NTP messages delivered to the
- NTP entity from this association.
- Discountinuities in the value of this counter can occur
- upon cold start or reinitialization of the NTP entity, the
- management system and at other times as indicated by
- discontinuities in the value of sysUpTime."
- ::= { ntpAssociationStatisticsEntry 1 }
-
-ntpAssocStatOutPkts OBJECT-TYPE
- SYNTAX Counter32
- UNITS "packets"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of NTP messages delivered to the
- transport service by this NTP entity for this
- association.
- Discountinuities in the value of this counter can occur
- upon cold start or reinitialization of the NTP entity, the
- management system and at other times as indicated by
- discontinuities in the value of sysUpTime."
- ::= { ntpAssociationStatisticsEntry 2 }
-
-ntpAssocStatProtocolError OBJECT-TYPE
- SYNTAX Counter32
- UNITS "packets"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of NTP messages that were delivered
- to this NTP entity from this association and this entity
- was not able to process due to an NTP protocol error.
- Discountinuities in the value of this counter can occur
- upon cold start or reinitialization of the NTP entity, the
- management system and at other times as indicated by
- discontinuities in the value of sysUpTime."
- ::= { ntpAssociationStatisticsEntry 3 }
-
---
--- Section 4: Control objects
---
-
-ntpEntHeartbeatInterval OBJECT-TYPE
- SYNTAX Unsigned32
- UNITS "seconds"
- MAX-ACCESS read-write
- STATUS current
- DESCRIPTION
- "The interval at which the ntpEntNotifHeartbeat notification
- should be sent, in seconds. If set to 0 and the
- entNotifHeartbeat bit in ntpEntNotifBits is 1, then
- ntpEntNotifHeartbeat is sent once.
- This value is stored persistently and will be restored to its
- last set value upon cold start or restart."
- DEFVAL { 60 }
- ::= { ntpEntControl 1 }
-
-ntpEntNotifBits OBJECT-TYPE
- SYNTAX BITS {
- notUsed(0), -- Used to sync up bit and notification
- -- indices
- entNotifModeChange(1),
- entNotifStratumChange(2),
- entNotifSyspeerChanged(3),
- entNotifAddAssociation(4),
- entNotifRemoveAssociation(5),
- entNotifConfigChanged(6),
- entNotifLeapSecondAnnounced(7),
- entNotifHeartbeat(8)
- }
- MAX-ACCESS read-write
- STATUS current
- DESCRIPTION
- "A bit for each notification. A 1 for a particular bit enables
- that particular notification, a 0 disables it.
- This value is stored persistently and will be restored to its
- last set value upon cold start or restart."
- ::= { ntpEntControl 2 }
-
---
--- Section 5: Notification objects
---
-
-ntpEntNotifMessage OBJECT-TYPE
- SYNTAX Utf8String
- MAX-ACCESS accessible-for-notify
- STATUS current
- DESCRIPTION
- "Used as a payload object for all notifications. Holds a
- cleartext event message."
- DEFVAL { "no event" }
- ::= { ntpEntNotifObjects 1 }
-
---
--- SNMP notification definitions
---
-
-ntpEntNotifications OBJECT IDENTIFIER ::= { ntpSnmpMIB 0 }
-
-ntpEntNotifModeChange NOTIFICATION-TYPE
- OBJECTS { ntpEntStatusCurrentMode }
- STATUS current
- DESCRIPTION
- "The notification to be sent when the NTP entity changes mode,
- including starting and stopping (if possible)."
- ::= { ntpEntNotifications 1 }
-
-ntpEntNotifStratumChange NOTIFICATION-TYPE
- OBJECTS { ntpEntStatusDateTime, ntpEntStatusStratum,
- ntpEntNotifMessage }
- STATUS current
- DESCRIPTION
- "The notification to be sent when stratum level of NTP changes."
- ::= { ntpEntNotifications 2 }
-
-ntpEntNotifSyspeerChanged NOTIFICATION-TYPE
- OBJECTS { ntpEntStatusDateTime, ntpEntStatusActiveRefSourceId,
- ntpEntNotifMessage }
- STATUS current
- DESCRIPTION
- "The notification to be sent when a (new) syspeer has been
- selected."
- ::= { ntpEntNotifications 3 }
-
-ntpEntNotifAddAssociation NOTIFICATION-TYPE
- OBJECTS { ntpEntStatusDateTime, ntpAssocName, ntpEntNotifMessage }
- STATUS current
- DESCRIPTION
- "The notification to be sent when a new association is
- mobilized."
- ::= { ntpEntNotifications 4 }
-
-ntpEntNotifRemoveAssociation NOTIFICATION-TYPE
- OBJECTS { ntpEntStatusDateTime, ntpAssocName, ntpEntNotifMessage }
- STATUS current
- DESCRIPTION
- "The notification to be sent when an association is
- demobilized."
- ::= { ntpEntNotifications 5 }
-
-ntpEntNotifConfigChanged NOTIFICATION-TYPE
- OBJECTS { ntpEntStatusDateTime, ntpEntNotifMessage }
- STATUS current
- DESCRIPTION
- "The notification to be sent when the NTP configuration has
- changed, e.g., when the system connected to the Internet and
- was assigned a new IP address by the ISPs DHCP server."
- ::= { ntpEntNotifications 6 }
-
-ntpEntNotifLeapSecondAnnounced NOTIFICATION-TYPE
- OBJECTS { ntpEntStatusDateTime, ntpEntNotifMessage }
- STATUS current
- DESCRIPTION
- "The notification to be sent when a leap second has been
- announced."
- ::= { ntpEntNotifications 7 }
-
-ntpEntNotifHeartbeat NOTIFICATION-TYPE
- OBJECTS { ntpEntStatusDateTime, ntpEntStatusCurrentMode,
- ntpEntHeartbeatInterval, ntpEntNotifMessage }
- STATUS current
- DESCRIPTION
- "The notification to be sent periodically (as defined by
- ntpEntHeartbeatInterval) to indicate that the NTP entity is
- still alive."
- ::= { ntpEntNotifications 8 }
-
---
--- Conformance/Compliance statements
---
-
-ntpEntConformance OBJECT IDENTIFIER ::= { ntpSnmpMIB 2 }
-
-ntpEntCompliances OBJECT IDENTIFIER ::= { ntpEntConformance 1 }
-ntpEntGroups OBJECT IDENTIFIER ::= { ntpEntConformance 2 }
-
-ntpEntNTPCompliance MODULE-COMPLIANCE
- STATUS current
- DESCRIPTION
- "The compliance statement for SNMP entities that use NTP and
- implement the NTP MIB."
- MODULE -- this module
- MANDATORY-GROUPS {
- ntpEntObjectsGroup1
- }
- ::= { ntpEntCompliances 1 }
-
-ntpEntSNTPCompliance MODULE-COMPLIANCE
- STATUS current
- DESCRIPTION
- "The compliance statement for SNMP entities that use SNTP and
- implement the NTP MIB."
- MODULE -- this module
- MANDATORY-GROUPS {
- ntpEntObjectsGroup1
- }
- GROUP ntpEntObjectsGroup2
- DESCRIPTION
- "Optional object group."
- GROUP ntpEntNotifGroup
- DESCRIPTION
- "Optional notifications for this MIB."
- ::= { ntpEntCompliances 2 }
-
-ntpEntObjectsGroup1 OBJECT-GROUP
- OBJECTS {
- ntpEntSoftwareName,
- ntpEntSoftwareVersion,
- ntpEntSoftwareVendor,
- ntpEntSystemType,
- ntpEntStatusEntityUptime,
- ntpEntStatusDateTime,
- ntpAssocName,
- ntpAssocRefId,
- ntpAssocAddressType,
- ntpAssocAddress
- }
- STATUS current
- DESCRIPTION
- "A collection of objects for the NTP MIB."
- ::= { ntpEntGroups 1 }
-
-ntpEntObjectsGroup2 OBJECT-GROUP
- OBJECTS {
- ntpEntTimeResolution,
- ntpEntTimePrecision,
- ntpEntTimeDistance,
- ntpEntStatusCurrentMode,
- ntpEntStatusStratum,
- ntpEntStatusActiveRefSourceId,
- ntpEntStatusActiveRefSourceName,
- ntpEntStatusActiveOffset,
- ntpEntStatusNumberOfRefSources,
- ntpEntStatusDispersion,
- ntpEntStatusLeapSecond,
- ntpEntStatusLeapSecDirection,
- ntpEntStatusInPkts,
- ntpEntStatusOutPkts,
- ntpEntStatusBadVersion,
- ntpEntStatusProtocolError,
- ntpEntStatusNotifications,
- ntpEntStatPktSent,
- ntpEntStatPktReceived,
- ntpAssocOffset,
- ntpAssocStratum,
- ntpAssocStatusJitter,
- ntpAssocStatusDelay,
- ntpAssocStatusDispersion,
- ntpAssocStatInPkts,
- ntpAssocStatOutPkts,
- ntpAssocStatProtocolError,
- ntpEntHeartbeatInterval,
- ntpEntNotifBits,
- ntpEntNotifMessage
- }
- STATUS current
- DESCRIPTION
- "A collection of objects for the NTP MIB."
- ::= { ntpEntGroups 2 }
-
-ntpEntNotifGroup NOTIFICATION-GROUP
- NOTIFICATIONS {
- ntpEntNotifModeChange,
- ntpEntNotifStratumChange,
- ntpEntNotifSyspeerChanged,
- ntpEntNotifAddAssociation,
- ntpEntNotifRemoveAssociation,
- ntpEntNotifConfigChanged,
- ntpEntNotifLeapSecondAnnounced,
- ntpEntNotifHeartbeat
- }
- STATUS current
- DESCRIPTION
- "A collection of notifications for the NTP MIB"
- ::= { ntpEntGroups 3 }
-
-END
diff --git a/pylib/configure.py b/pylib/configure.py
index 704c4d0..b43cd07 100644
--- a/pylib/configure.py
+++ b/pylib/configure.py
@@ -178,6 +178,8 @@ def cmd_configure(ctx):
('getdtablesize', "unistd.h"), # SVr4, 4.2BSD
('getpassphrase', "stdlib.h"), # Sun systems
('plock', "sys/lock.h"), # OSF/1, SVID[23], XPG2
+ ('pthread_attr_getstacksize', "pthread.h", "PTHREAD"),
+ ('pthread_attr_setstacksize', "pthread.h", "PTHREAD"),
('res_init', "resolv.h"),
("rtprio", "sys/rtprio.h"), # Sun/BSD
('settimeofday', "sys/time.h", "RT"), # BSD - remove?
diff --git a/wscript b/wscript
index 277e2b9..122efe4 100644
--- a/wscript
+++ b/wscript
@@ -101,7 +101,6 @@ def build(ctx):
ctx.recurse("sntp")
ctx.recurse("ntpd")
ctx.recurse("ntpq")
-# ctx.recurse("ntpsnmpd")
# ctx.recurse("clockstuff") -
# ctx.recurse("kernel")
ctx.recurse("ntp-keygen")
More information about the vc
mailing list