This commit is contained in:
parent
6b939b06a5
commit
81983e70d3
62
README.SuSE
62
README.SuSE
@ -7,39 +7,41 @@ SNMP access (161/udp,162/udp) be blocked at your firewall.
|
||||
|
||||
There are also some important changes that have been made in this release
|
||||
of our package:
|
||||
o the daemon now sets a PID file in /var/run/
|
||||
|
||||
o logging is now done directly to /var/log/net-snmp.log instead
|
||||
of sending stderr/stdout through syslog. If you don't want logging,
|
||||
remove the '-l /var/log/net-snmp.log' from /etc/init.d/snmpd.
|
||||
o the daemon now sets a PID file in /var/run/
|
||||
|
||||
o the daemon is now started with the '-r'. This option prevents
|
||||
snmpd from exiting if it doesn't have permission to read something.
|
||||
This only occurs if you start snmpd on a high port as a non-root
|
||||
root user.
|
||||
o logging is now done directly to /var/log/net-snmp.log instead
|
||||
of sending stderr/stdout through syslog. If you don't want logging,
|
||||
remove the '-l /var/log/net-snmp.log' from /etc/init.d/snmpd.
|
||||
|
||||
o If you need to run snmptrapd, we've provided an example init
|
||||
script in /usr/share/doc/packages/net-snmp/rc.snmptrapd. SNMP
|
||||
traps should be avoided whenever possible because they are
|
||||
unreliable (you should poll with snmpget instead) and snmptrapd
|
||||
has been the source of many of the security problems with snmp
|
||||
so please don't run this unless you are sure of what you are doing.
|
||||
To install the script,
|
||||
cp rc.snmptrapd /etc/init.d/snmptrapd
|
||||
innserv /etc/init.d/snmptrapd
|
||||
cd /usr/sbin && ln -s ../../etc/init.d/snmptrapd .
|
||||
and create a configuration file named /etc/snmptrapd.conf. Then,
|
||||
start the daemon with
|
||||
rcsnmptrapd start
|
||||
Logging is done to /var/log/net-snmptrapd.log.
|
||||
o the daemon is now started with the '-r'. This option prevents
|
||||
snmpd from exiting if it doesn't have permission to read something.
|
||||
This only occurs if you start snmpd on a high port as a non-root
|
||||
root user.
|
||||
|
||||
o Master agentx support is enabled if you have modules in
|
||||
/usr/lib/net-snmp/--the domain socket is created as
|
||||
/var/run/agentx/master. You can change this to a network
|
||||
interface if needed (see snmpd(1)). The snmpd init script
|
||||
automatically detects and starts any sub-agents in placed into
|
||||
/var/lib/net-snmp.
|
||||
o If you need to run snmptrapd, we've provided an example init
|
||||
script in /usr/share/doc/packages/net-snmp/rc.snmptrapd. SNMP
|
||||
traps should be avoided whenever possible because they are
|
||||
unreliable (you should poll with snmpget instead) and snmptrapd
|
||||
has been the source of many of the security problems with snmp
|
||||
so please don't run this unless you are sure of what you are doing.
|
||||
To install the script,
|
||||
install rc.snmptrapd /etc/init.d/snmptrapd
|
||||
chkconfig snmptrapd on
|
||||
ln -s ../../etc/init.d/snmptrapd /usr/sbin/rcsnmptrapd.
|
||||
and create a configuration file named /etc/snmp/snmptrapd.conf. Then,
|
||||
start the daemon with
|
||||
rcsnmptrapd start
|
||||
Logging is done to /var/log/net-snmptrapd.log.
|
||||
|
||||
For more informations see the manpages for snmptrapd and snmptrapd.conf.
|
||||
|
||||
o Master agentx support is enabled if you have modules in
|
||||
/usr/lib/net-snmp/--the domain socket is created as
|
||||
/var/run/agentx/master. You can change this to a network
|
||||
interface if needed (see snmpd(1)). The snmpd init script
|
||||
automatically detects and starts any sub-agents in placed into
|
||||
/var/lib/net-snmp.
|
||||
|
||||
More documentation on the net-snmp package can be found in this directory
|
||||
as well as the project's homepage: http://net-snmp.sourceforge.net/
|
||||
|
||||
as well as the project's homepage: http://www.net-snmp.org/
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,340 @@
|
||||
Index: agent/mibgroup/rmon-mib/etherStatsTable.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/etherStatsTable.c 2008-09-16 16:36:41.339791677 +0200
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/data_access/etherstats.h net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/data_access/etherstats.h
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/data_access/etherstats.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/data_access/etherstats.h 2008-12-21 05:47:47.000000000 -0500
|
||||
@@ -0,0 +1,7 @@
|
||||
+/*
|
||||
+ * module to include the modules
|
||||
+ */
|
||||
+
|
||||
+#if defined(linux)
|
||||
+config_require(rmon-mib/data_access/etherstats_linux)
|
||||
+#endif
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/data_access/etherstats_linux.c net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/data_access/etherstats_linux.c
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/data_access/etherstats_linux.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/data_access/etherstats_linux.c 2009-01-12 07:38:52.000000000 -0500
|
||||
@@ -0,0 +1,319 @@
|
||||
+/*
|
||||
+ * standard Net-SNMP includes
|
||||
+ */
|
||||
+#include <net-snmp/net-snmp-config.h>
|
||||
+#include <net-snmp/net-snmp-includes.h>
|
||||
+#include <net-snmp/agent/net-snmp-agent-includes.h>
|
||||
+
|
||||
+/*
|
||||
+ * include our parent header
|
||||
+ */
|
||||
+#include "rmon-mib/etherStatsTable/etherStatsTable.h"
|
||||
+#include "rmon-mib/etherStatsTable/etherStatsTable_data_access.h"
|
||||
+#include "rmon-mib/etherStatsTable/ioctl_imp_common.h"
|
||||
+
|
||||
+/*
|
||||
+ * @retval 0 success
|
||||
+ * @retval -1 getifaddrs failed
|
||||
+ * @retval -2 memory allocation failed
|
||||
+ */
|
||||
+
|
||||
+struct ifname *
|
||||
+etherstats_interface_name_list_get (struct ifname *list_head, int *retval)
|
||||
+{
|
||||
+ struct ifaddrs *addrs = NULL, *p = NULL;
|
||||
+ struct ifname *nameptr1=NULL, *nameptr2 = NULL;
|
||||
+
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_get",
|
||||
+ "called\n"));
|
||||
+
|
||||
+ if ((getifaddrs(&addrs)) < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_get",
|
||||
+ "getifaddrs failed\n"));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_name_list_get, getifaddrs failed\n");
|
||||
+ *retval = -1;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ for (p = addrs; p; p = p->ifa_next) {
|
||||
+
|
||||
+ if (!list_head) {
|
||||
+ if ( (list_head = (struct ifname *) malloc (sizeof(struct ifname))) < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_get",
|
||||
+ "memory allocation failed\n"));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_name_list_get, memory allocation failed\n");
|
||||
+ freeifaddrs(addrs);
|
||||
+ *retval = -2;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ memset (list_head, 0, sizeof (struct ifname));
|
||||
+ strncpy (list_head->name, p->ifa_name, IF_NAMESIZE);
|
||||
+ continue;
|
||||
+ }
|
||||
+ for (nameptr1 = list_head; nameptr1; nameptr2 = nameptr1, nameptr1 = nameptr1->ifn_next)
|
||||
+ if (!strncmp(p->ifa_name, nameptr1->name, IF_NAMESIZE))
|
||||
+ break;
|
||||
+
|
||||
+ if (nameptr1)
|
||||
+ continue;
|
||||
+
|
||||
+ if ( (nameptr2->ifn_next = (struct ifname *) malloc (sizeof(struct ifname))) < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_get",
|
||||
+ "memory allocation failed\n"));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_name_list_get, memory allocation failed\n");
|
||||
+ interface_name_list_free (list_head);
|
||||
+ freeifaddrs(addrs);
|
||||
+ *retval = -2;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ nameptr2 = nameptr2->ifn_next;
|
||||
+ memset (nameptr2, 0, sizeof (struct ifname));
|
||||
+ strncpy (nameptr2->name, p->ifa_name, IF_NAMESIZE);
|
||||
+ continue;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ freeifaddrs(addrs);
|
||||
+ *retval = 0;
|
||||
+ return list_head;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * @retval 0 success
|
||||
+ * @retval -1 invalid pointer
|
||||
+ */
|
||||
+
|
||||
+int
|
||||
+etherstats_interface_name_list_free (struct ifname *list_head)
|
||||
+{
|
||||
+ struct ifname *nameptr1 = NULL, *nameptr2 = NULL;
|
||||
+
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_free",
|
||||
+ "called\n"));
|
||||
+
|
||||
+ if (!list_head) {
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable:interface_name_list_free: invalid pointer list_head");
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_free",
|
||||
+ "invalid pointer list_head\n"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ for (nameptr1 = list_head; nameptr1; nameptr1 = nameptr2) {
|
||||
+ nameptr2 = nameptr1->ifn_next;
|
||||
+ free (nameptr1);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * @retval 0 : not found
|
||||
+ * @retval !0 : ifIndex
|
||||
+ */
|
||||
+
|
||||
+int
|
||||
+etherstats_interface_ioctl_ifindex_get (int fd, const char *name) {
|
||||
+#ifndef SIOCGIFINDEX
|
||||
+ return 0;
|
||||
+#else
|
||||
+ struct ifreq ifrq;
|
||||
+ int rc = 0;
|
||||
+
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:ioctl", "ifindex_get\n"));
|
||||
+
|
||||
+ rc = _etherStats_ioctl_get(fd, SIOCGIFINDEX, &ifrq, name);
|
||||
+ if (rc < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStats:ioctl",
|
||||
+ "ifindex_get error on inerface '%s'\n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable:ioctl, ifindex_get error on inerface '%s'\n", name);
|
||||
+ return 0;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ return ifrq.ifr_ifindex;
|
||||
+#endif /* SIOCGIFINDEX */
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * @retval 0 success
|
||||
+ * @retval -1 cannot get ETHTOOL_DRVINFO failed
|
||||
+ * @retval -2 n_stats zero - no statistcs available
|
||||
+ * @retval -3 memory allocation for holding the statistics failed
|
||||
+ * @retval -4 cannot get ETHTOOL_GSTRINGS information
|
||||
+ * @retval -5 cannot get ETHTOOL_GSTATS information
|
||||
+ * @retval -6 function not supported if HAVE_LINUX_ETHTOOL_H not defined
|
||||
+ */
|
||||
+
|
||||
+int
|
||||
+interface_ioctl_etherstats_get (etherStatsTable_rowreq_ctx *rowreq_ctx , int fd, const char *name) {
|
||||
+
|
||||
+#ifdef HAVE_LINUX_ETHTOOL_H
|
||||
+
|
||||
+ etherStatsTable_data *data = &rowreq_ctx->data;
|
||||
+ struct ethtool_drvinfo driver_info;
|
||||
+ struct ethtool_gstrings *eth_strings;
|
||||
+ struct ethtool_stats *eth_stats;
|
||||
+ struct ifreq ifr;
|
||||
+ unsigned int nstats, size_str, size_stats, i;
|
||||
+ int err;
|
||||
+
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "called\n"));
|
||||
+
|
||||
+ memset(&ifr, 0, sizeof(ifr));
|
||||
+ strcpy(ifr.ifr_name, name);
|
||||
+
|
||||
+ memset(&driver_info, 0, sizeof(driver_info));
|
||||
+ driver_info.cmd = ETHTOOL_GDRVINFO;
|
||||
+ ifr.ifr_data = (char *)&driver_info;
|
||||
+
|
||||
+ err = _etherStats_ioctl_get(fd, SIOCETHTOOL, &ifr, name);
|
||||
+ if (err < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "ETHTOOL_GETDRVINFO failed on interface |%s| \n", name));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ nstats = driver_info.n_stats;
|
||||
+ if (nstats < 1) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "no stats available for interface |%s| \n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, no stats availablei for interface |%s| \n", name);
|
||||
+ return -2;
|
||||
+ }
|
||||
+
|
||||
+ size_str = nstats * ETH_GSTRING_LEN;
|
||||
+ size_stats = nstats * sizeof(u64);
|
||||
+
|
||||
+ eth_strings = malloc(size_str + sizeof (struct ethtool_gstrings));
|
||||
+ if (!eth_strings) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "no memory available\n"));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, no memory available\n");
|
||||
+
|
||||
+ return -3;
|
||||
+ }
|
||||
+ memset (eth_strings, 0, (size_str + sizeof (struct ethtool_gstrings)));
|
||||
+
|
||||
+ eth_stats = malloc (size_str + sizeof (struct ethtool_stats));
|
||||
+ if (!eth_stats) {
|
||||
+ free (eth_strings);
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "no memory available\n"));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, no memory available\n");
|
||||
+
|
||||
+ return -3;
|
||||
+ }
|
||||
+ memset (eth_stats, 0, (size_str + sizeof (struct ethtool_stats)));
|
||||
+
|
||||
+ eth_strings->cmd = ETHTOOL_GSTRINGS;
|
||||
+ eth_strings->string_set = ETH_SS_STATS;
|
||||
+ eth_strings->len = nstats;
|
||||
+ ifr.ifr_data = (char *) eth_strings;
|
||||
+
|
||||
+ err = _etherStats_ioctl_get(fd, SIOCETHTOOL, &ifr, name);
|
||||
+ if (err < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "cannot get stats strings information for interface |%s| \n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, cannot get stats strings information for interface |%s| \n", name);
|
||||
+
|
||||
+ free(eth_strings);
|
||||
+ free(eth_stats);
|
||||
+ return -4;
|
||||
+ }
|
||||
+
|
||||
+ eth_stats->cmd = ETHTOOL_GSTATS;
|
||||
+ eth_stats->n_stats = nstats;
|
||||
+ ifr.ifr_data = (char *) eth_stats;
|
||||
+ err = _etherStats_ioctl_get(fd, SIOCETHTOOL, &ifr, name);
|
||||
+ if (err < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "cannot get stats strings information for interface |%s| \n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, cannot get stats information for interface |%s| \n", name);
|
||||
+
|
||||
+ free(eth_strings);
|
||||
+ free(eth_stats);
|
||||
+ return -5;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < nstats; i++) {
|
||||
+ char s[ETH_GSTRING_LEN];
|
||||
+
|
||||
+ strncpy(s, (const char *) ð_strings->data[i * ETH_GSTRING_LEN],
|
||||
+ ETH_GSTRING_LEN);
|
||||
+
|
||||
+ if (ETHERSTATSJABBERS(s)) {
|
||||
+ data->etherStatsJabbers = (u_long)eth_stats->data[i];
|
||||
+ rowreq_ctx->column_exists_flags |= COLUMN_ETHERSTATSJABBERS_FLAG;
|
||||
+ }
|
||||
+ }
|
||||
+ free(eth_strings);
|
||||
+ free(eth_stats);
|
||||
+
|
||||
+ return 0;
|
||||
+#else
|
||||
+ return -6;
|
||||
+#endif
|
||||
+
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* ioctl wrapper
|
||||
+ *
|
||||
+ * @param fd : socket fd to use w/ioctl, or -1 to open/close one
|
||||
+ * @param which
|
||||
+ * @param ifrq
|
||||
+ * param ifentry : ifentry to update
|
||||
+ * @param name
|
||||
+ *
|
||||
+ * @retval 0 : success
|
||||
+ * @retval -1 : invalid parameters
|
||||
+ * @retval -2 : couldn't create socket
|
||||
+ * @retval -3 : ioctl call failed
|
||||
+ */
|
||||
+int
|
||||
+_etherStats_ioctl_get(int fd, int which, struct ifreq *ifrq, const char* name)
|
||||
+{
|
||||
+ int ourfd = -1, rc = 0;
|
||||
+
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:ioctl", "_etherStats_ioctl_get\n"));
|
||||
+ /*
|
||||
+ * sanity checks
|
||||
+ */
|
||||
+ if(NULL == name) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:ioctl",
|
||||
+ "_etherStats_ioctl_get invalid ifname '%s'\n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable:ioctl, _etherStats_ioctl_get error on inerface '%s'\n", name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * create socket for ioctls
|
||||
+ */
|
||||
+ if(fd < 0) {
|
||||
+ fd = ourfd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
+ if(ourfd < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:ioctl",
|
||||
+ "_etherStats_ioctl_get couldn't create a socket\n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable:ioctl, _etherStats_ioctl_get error on inerface '%s'\n", name);
|
||||
+
|
||||
+ return -2;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ strncpy(ifrq->ifr_name, name, sizeof(ifrq->ifr_name));
|
||||
+ ifrq->ifr_name[ sizeof(ifrq->ifr_name)-1 ] = 0;
|
||||
+ rc = ioctl(fd, which, ifrq);
|
||||
+ if (rc < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:ioctl",
|
||||
+ "_etherStats_ioctl_get ioctl %d returned %d\n", which, rc));
|
||||
+ rc = -3;
|
||||
+ }
|
||||
+
|
||||
+ if(ourfd >= 0)
|
||||
+ close(ourfd);
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable.c net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable.c
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable.c 2008-08-25 02:37:27.000000000 -0400
|
||||
@@ -0,0 +1,229 @@
|
||||
+/*
|
||||
+ * Note: this file originally auto-generated by mib2c using
|
||||
@ -232,11 +565,10 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable.c
|
||||
+
|
||||
+
|
||||
+/** @{ */
|
||||
Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/etherStatsTable_data_access.c 2008-09-16 16:36:41.375791976 +0200
|
||||
@@ -0,0 +1,825 @@
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_access.c net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_access.c
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_access.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_access.c 2009-01-12 03:39:26.000000000 -0500
|
||||
@@ -0,0 +1,522 @@
|
||||
+/*
|
||||
+ * Note: this file originally auto-generated by mib2c using
|
||||
+ * version : 14170 $ of $
|
||||
@ -254,10 +586,11 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.c
|
||||
+ * include our parent header
|
||||
+ */
|
||||
+#include "etherStatsTable.h"
|
||||
+
|
||||
+
|
||||
+#include "etherStatsTable_data_access.h"
|
||||
+
|
||||
+#if defined(linux)
|
||||
+#include "ioctl_imp_common.h"
|
||||
+#endif
|
||||
+
|
||||
+/** @ingroup interface
|
||||
+ * @addtogroup data_access data_access: Routines to access data
|
||||
@ -458,12 +791,14 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.c
|
||||
+ * etherStatsIndex(1)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+ long etherStatsIndex;
|
||||
+ int fd;
|
||||
+ int rc = 0, retval = 0;
|
||||
+ struct ifname *list_head = NULL, *p = NULL;
|
||||
+
|
||||
+#if defined(linux)
|
||||
+ struct ifname *list_head = NULL, *p = NULL;
|
||||
+#endif
|
||||
+
|
||||
+ /*
|
||||
+ * create socket for ioctls
|
||||
+ */
|
||||
@ -479,7 +814,8 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.c
|
||||
+ * and list_head contains null
|
||||
+ */
|
||||
+
|
||||
+ list_head = interface_name_list_get (list_head, &retval);
|
||||
+#if defined(linux)
|
||||
+ list_head = etherstats_interface_name_list_get (list_head, &retval);
|
||||
+
|
||||
+ if (!list_head) {
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable, error getting the interface names present in the system\n");
|
||||
@ -502,7 +838,7 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.c
|
||||
+ * get index via ioctl.
|
||||
+ */
|
||||
+
|
||||
+ etherStatsIndex = (long) interface_ioctl_ifindex_get(-1, p->name);
|
||||
+ etherStatsIndex = (long) etherstats_interface_ioctl_ifindex_get(-1, p->name);
|
||||
+
|
||||
+ /*
|
||||
+ * get the etherstats contents populated, if the device is not an ethernet device
|
||||
@ -556,12 +892,12 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.c
|
||||
+ * free the interface names list
|
||||
+ */
|
||||
+
|
||||
+ if ( (interface_name_list_free(list_head)) < 0) {
|
||||
+ if ( (etherstats_interface_name_list_free(list_head)) < 0) {
|
||||
+ snmp_log(LOG_ERR, "access:etherStatsTable, error freeing the interface name list \n");
|
||||
+ DEBUGMSGTL(("access:etherStatsTable", "error freeing the interface name list\n"));
|
||||
+ return MFD_ERROR;
|
||||
+ }
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+ DEBUGMSGT(("verbose:etherStatsTable:etherStatsTable_container_load",
|
||||
+ "inserted %d records\n", count));
|
||||
@ -570,313 +906,6 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.c
|
||||
+}
|
||||
+ /* etherStatsTable_container_load */
|
||||
+
|
||||
+/*
|
||||
+ * @retval 0 success
|
||||
+ * @retval -1 getifaddrs failed
|
||||
+ * @retval -2 memory allocation failed
|
||||
+ */
|
||||
+
|
||||
+static struct ifname *
|
||||
+interface_name_list_get (struct ifname *list_head, int *retval)
|
||||
+{
|
||||
+ struct ifaddrs *addrs = NULL, *p = NULL;
|
||||
+ struct ifname *nameptr1=NULL, *nameptr2 = NULL;
|
||||
+
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_get",
|
||||
+ "called\n"));
|
||||
+
|
||||
+ if ((getifaddrs(&addrs)) < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_get",
|
||||
+ "getifaddrs failed\n"));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_name_list_get, getifaddrs failed\n");
|
||||
+ *retval = -1;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ for (p = addrs; p; p = p->ifa_next) {
|
||||
+
|
||||
+ if (!list_head) {
|
||||
+ if ( (list_head = (struct ifname *) malloc (sizeof(struct ifname))) < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_get",
|
||||
+ "memory allocation failed\n"));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_name_list_get, memory allocation failed\n");
|
||||
+ freeifaddrs(addrs);
|
||||
+ *retval = -2;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ memset (list_head, 0, sizeof (struct ifname));
|
||||
+ strncpy (list_head->name, p->ifa_name, IF_NAMESIZE);
|
||||
+ continue;
|
||||
+ }
|
||||
+ for (nameptr1 = list_head; nameptr1; nameptr2 = nameptr1, nameptr1 = nameptr1->ifn_next)
|
||||
+ if (!strncmp(p->ifa_name, nameptr1->name, IF_NAMESIZE))
|
||||
+ break;
|
||||
+
|
||||
+ if (nameptr1)
|
||||
+ continue;
|
||||
+
|
||||
+ if ( (nameptr2->ifn_next = (struct ifname *) malloc (sizeof(struct ifname))) < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_get",
|
||||
+ "memory allocation failed\n"));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_name_list_get, memory allocation failed\n");
|
||||
+ interface_name_list_free (list_head);
|
||||
+ freeifaddrs(addrs);
|
||||
+ *retval = -2;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ nameptr2 = nameptr2->ifn_next;
|
||||
+ memset (nameptr2, 0, sizeof (struct ifname));
|
||||
+ strncpy (nameptr2->name, p->ifa_name, IF_NAMESIZE);
|
||||
+ continue;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ freeifaddrs(addrs);
|
||||
+ *retval = 0;
|
||||
+ return list_head;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * @retval 0 success
|
||||
+ * @retval -1 invalid pointer
|
||||
+ */
|
||||
+
|
||||
+static int
|
||||
+interface_name_list_free (struct ifname *list_head)
|
||||
+{
|
||||
+ struct ifname *nameptr1 = NULL, *nameptr2 = NULL;
|
||||
+
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_free",
|
||||
+ "called\n"));
|
||||
+
|
||||
+ if (!list_head) {
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable:interface_name_list_free: invalid pointer list_head");
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_name_list_free",
|
||||
+ "invalid pointer list_head\n"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ for (nameptr1 = list_head; nameptr1; nameptr1 = nameptr2) {
|
||||
+ nameptr2 = nameptr1->ifn_next;
|
||||
+ free (nameptr1);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * @retval 0 : not found
|
||||
+ * @retval !0 : ifIndex
|
||||
+ */
|
||||
+
|
||||
+static int
|
||||
+interface_ioctl_ifindex_get (int fd, const char *name) {
|
||||
+#ifndef SIOCGIFINDEX
|
||||
+ return 0;
|
||||
+#else
|
||||
+ struct ifreq ifrq;
|
||||
+ int rc = 0;
|
||||
+
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:ioctl", "ifindex_get\n"));
|
||||
+
|
||||
+ rc = _etherStats_ioctl_get(fd, SIOCGIFINDEX, &ifrq, name);
|
||||
+ if (rc < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStats:ioctl",
|
||||
+ "ifindex_get error on inerface '%s'\n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable:ioctl, ifindex_get error on inerface '%s'\n", name);
|
||||
+ return 0;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ return ifrq.ifr_ifindex;
|
||||
+#endif /* SIOCGIFINDEX */
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * @retval 0 success
|
||||
+ * @retval -1 cannot get ETHTOOL_DRVINFO failed
|
||||
+ * @retval -2 n_stats zero - no statistcs available
|
||||
+ * @retval -3 memory allocation for holding the statistics failed
|
||||
+ * @retval -4 cannot get ETHTOOL_GSTRINGS information
|
||||
+ * @retval -5 cannot get ETHTOOL_GSTATS information
|
||||
+ * @retval -6 function not supported if HAVE_LINUX_ETHTOOL_H not defined
|
||||
+ */
|
||||
+
|
||||
+int
|
||||
+interface_ioctl_etherstats_get (etherStatsTable_rowreq_ctx *rowreq_ctx , int fd, const char *name) {
|
||||
+
|
||||
+#ifdef HAVE_LINUX_ETHTOOL_H
|
||||
+
|
||||
+ etherStatsTable_data *data = &rowreq_ctx->data;
|
||||
+ struct ethtool_drvinfo driver_info;
|
||||
+ struct ethtool_gstrings *eth_strings;
|
||||
+ struct ethtool_stats *eth_stats;
|
||||
+ struct ifreq ifr;
|
||||
+ unsigned int nstats, size_str, size_stats, i;
|
||||
+ int err;
|
||||
+
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "called\n"));
|
||||
+
|
||||
+ memset(&ifr, 0, sizeof(ifr));
|
||||
+ strcpy(ifr.ifr_name, name);
|
||||
+
|
||||
+ memset(&driver_info, 0, sizeof(driver_info));
|
||||
+ driver_info.cmd = ETHTOOL_GDRVINFO;
|
||||
+ ifr.ifr_data = (char *)&driver_info;
|
||||
+
|
||||
+ err = _etherStats_ioctl_get(fd, SIOCETHTOOL, &ifr, name);
|
||||
+ if (err < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "ETHTOOL_GETDRVINFO failed on interface |%s| \n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, ETHTOOL_GETDRVINFO failed on interface |%s| \n", name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ nstats = driver_info.n_stats;
|
||||
+ if (nstats < 1) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "no stats available for interface |%s| \n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, no stats availablei for interface |%s| \n", name);
|
||||
+ return -2;
|
||||
+ }
|
||||
+
|
||||
+ size_str = nstats * ETH_GSTRING_LEN;
|
||||
+ size_stats = nstats * sizeof(u64);
|
||||
+
|
||||
+ eth_strings = malloc(size_str + sizeof (struct ethtool_gstrings));
|
||||
+ if (!eth_strings) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "no memory available\n"));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, no memory available\n");
|
||||
+
|
||||
+ return -3;
|
||||
+ }
|
||||
+ memset (eth_strings, 0, (size_str + sizeof (struct ethtool_gstrings)));
|
||||
+
|
||||
+ eth_stats = malloc (size_str + sizeof (struct ethtool_stats));
|
||||
+ if (!eth_stats) {
|
||||
+ free (eth_strings);
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "no memory available\n"));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, no memory available\n");
|
||||
+
|
||||
+ return -3;
|
||||
+ }
|
||||
+ memset (eth_stats, 0, (size_str + sizeof (struct ethtool_stats)));
|
||||
+
|
||||
+ eth_strings->cmd = ETHTOOL_GSTRINGS;
|
||||
+ eth_strings->string_set = ETH_SS_STATS;
|
||||
+ eth_strings->len = nstats;
|
||||
+ ifr.ifr_data = (char *) eth_strings;
|
||||
+
|
||||
+ err = _etherStats_ioctl_get(fd, SIOCETHTOOL, &ifr, name);
|
||||
+ if (err < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "cannot get stats strings information for interface |%s| \n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, cannot get stats strings information for interface |%s| \n", name);
|
||||
+
|
||||
+ free(eth_strings);
|
||||
+ free(eth_stats);
|
||||
+ return -4;
|
||||
+ }
|
||||
+
|
||||
+ eth_stats->cmd = ETHTOOL_GSTATS;
|
||||
+ eth_stats->n_stats = nstats;
|
||||
+ ifr.ifr_data = (char *) eth_stats;
|
||||
+ err = _etherStats_ioctl_get(fd, SIOCETHTOOL, &ifr, name);
|
||||
+ if (err < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:interface_ioctl_etherstats_get",
|
||||
+ "cannot get stats strings information for interface |%s| \n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable,interface_ioctl_etherstats_get, cannot get stats information for interface |%s| \n", name);
|
||||
+
|
||||
+ free(eth_strings);
|
||||
+ free(eth_stats);
|
||||
+ return -5;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < nstats; i++) {
|
||||
+ char s[ETH_GSTRING_LEN];
|
||||
+
|
||||
+ strncpy(s, (const char *) ð_strings->data[i * ETH_GSTRING_LEN],
|
||||
+ ETH_GSTRING_LEN);
|
||||
+
|
||||
+ if (ETHERSTATSJABBERS(s)) {
|
||||
+ data->etherStatsJabbers = (u_long)eth_stats->data[i];
|
||||
+ rowreq_ctx->column_exists_flags |= COLUMN_ETHERSTATSJABBERS_FLAG;
|
||||
+ }
|
||||
+ }
|
||||
+ free(eth_strings);
|
||||
+ free(eth_stats);
|
||||
+
|
||||
+ return 0;
|
||||
+#else
|
||||
+ return -6;
|
||||
+#endif
|
||||
+
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* ioctl wrapper
|
||||
+ *
|
||||
+ * @param fd : socket fd to use w/ioctl, or -1 to open/close one
|
||||
+ * @param which
|
||||
+ * @param ifrq
|
||||
+ * param ifentry : ifentry to update
|
||||
+ * @param name
|
||||
+ *
|
||||
+ * @retval 0 : success
|
||||
+ * @retval -1 : invalid parameters
|
||||
+ * @retval -2 : couldn't create socket
|
||||
+ * @retval -3 : ioctl call failed
|
||||
+ */
|
||||
+static int
|
||||
+_etherStats_ioctl_get(int fd, int which, struct ifreq *ifrq, const char* name)
|
||||
+{
|
||||
+ int ourfd = -1, rc = 0;
|
||||
+
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:ioctl", "_etherStats_ioctl_get\n"));
|
||||
+ /*
|
||||
+ * sanity checks
|
||||
+ */
|
||||
+ if(NULL == name) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:ioctl",
|
||||
+ "_etherStats_ioctl_get invalid ifname '%s'\n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable:ioctl, _etherStats_ioctl_get error on inerface '%s'\n", name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * create socket for ioctls
|
||||
+ */
|
||||
+ if(fd < 0) {
|
||||
+ fd = ourfd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
+ if(ourfd < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:ioctl",
|
||||
+ "_etherStats_ioctl_get couldn't create a socket\n", name));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable:ioctl, _etherStats_ioctl_get error on inerface '%s'\n", name);
|
||||
+
|
||||
+ return -2;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ strncpy(ifrq->ifr_name, name, sizeof(ifrq->ifr_name));
|
||||
+ ifrq->ifr_name[ sizeof(ifrq->ifr_name)-1 ] = 0;
|
||||
+ rc = ioctl(fd, which, ifrq);
|
||||
+ if (rc < 0) {
|
||||
+ DEBUGMSGTL(("access:etherStatsTable:ioctl",
|
||||
+ "_etherStats_ioctl_get ioctl %d returned %d\n", which, rc));
|
||||
+ snmp_log (LOG_ERR, "access:etherStatsTable:ioctl, _etherStats_ioctl_get error on inerface '%s'\n", name);
|
||||
+
|
||||
+ rc = -3;
|
||||
+ }
|
||||
+
|
||||
+ if(ourfd >= 0)
|
||||
+ close(ourfd);
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * container clean up
|
||||
@ -1062,10 +1091,9 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.c
|
||||
+} /* etherStatsTable_validate_index */
|
||||
+
|
||||
+/** @} */
|
||||
Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/etherStatsTable_data_access.h 2008-09-16 16:36:41.440291464 +0200
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_access.h net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_access.h
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_access.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_access.h 2008-08-31 11:04:55.000000000 -0400
|
||||
@@ -0,0 +1,80 @@
|
||||
+/*
|
||||
+ * Note: this file originally auto-generated by mib2c using
|
||||
@ -1147,10 +1175,9 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_data_access.h
|
||||
+}
|
||||
+#endif
|
||||
+#endif /* ETHERSTATSTABLE_DATA_ACCESS_H */
|
||||
Index: agent/mibgroup/rmon-mib/etherStatsTable_data_get.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/etherStatsTable_data_get.c 2008-09-16 16:36:41.479792276 +0200
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_get.c net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_get.c
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_get.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_get.c 2008-08-25 09:31:32.000000000 -0400
|
||||
@@ -0,0 +1,1411 @@
|
||||
+/*
|
||||
+ * Note: this file originally auto-generated by mib2c using
|
||||
@ -2563,10 +2590,9 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_data_get.c
|
||||
+
|
||||
+
|
||||
+/** @} */
|
||||
Index: agent/mibgroup/rmon-mib/etherStatsTable_data_get.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/etherStatsTable_data_get.h 2008-09-16 16:36:41.507791686 +0200
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_get.h net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_get.h
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_get.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_get.h 2008-08-25 02:37:27.000000000 -0400
|
||||
@@ -0,0 +1,151 @@
|
||||
+/*
|
||||
+ * Note: this file originally auto-generated by mib2c using
|
||||
@ -2719,10 +2745,9 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_data_get.h
|
||||
+#endif
|
||||
+#endif /* ETHERSTATSTABLE_DATA_GET_H */
|
||||
+/** @} */
|
||||
Index: agent/mibgroup/rmon-mib/etherStatsTable_data_set.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/etherStatsTable_data_set.c 2008-09-16 16:36:41.547792106 +0200
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_set.c net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_set.c
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_set.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_set.c 2008-08-25 02:37:27.000000000 -0400
|
||||
@@ -0,0 +1,977 @@
|
||||
+/*
|
||||
+ * Note: this file originally auto-generated by mib2c using
|
||||
@ -3701,10 +3726,9 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_data_set.c
|
||||
+} /* etherStatsStatus_undo */
|
||||
+
|
||||
+/** @} */
|
||||
Index: agent/mibgroup/rmon-mib/etherStatsTable_data_set.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/etherStatsTable_data_set.h 2008-09-16 16:36:41.571792191 +0200
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_set.h net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_set.h
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_set.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_set.h 2008-08-25 02:37:27.000000000 -0400
|
||||
@@ -0,0 +1,356 @@
|
||||
+/*
|
||||
+ * Note: this file originally auto-generated by mib2c using
|
||||
@ -4062,10 +4086,9 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_data_set.h
|
||||
+}
|
||||
+#endif
|
||||
+#endif /* ETHERSTATSTABLE_DATA_SET_H */
|
||||
Index: agent/mibgroup/rmon-mib/etherStatsTable_enums.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/etherStatsTable_enums.h 2008-09-16 16:36:41.595792061 +0200
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_enums.h net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_enums.h
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_enums.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_enums.h 2008-08-25 02:37:27.000000000 -0400
|
||||
@@ -0,0 +1,57 @@
|
||||
+/*
|
||||
+ * Note: this file originally auto-generated by mib2c using
|
||||
@ -4124,10 +4147,9 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_enums.h
|
||||
+}
|
||||
+#endif
|
||||
+#endif /* ETHERSTATSTABLE_ENUMS_H */
|
||||
Index: agent/mibgroup/rmon-mib/etherStatsTable.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/etherStatsTable.h 2008-09-16 16:36:41.639791658 +0200
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable.h net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable.h
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable.h 2008-09-09 12:03:42.000000000 -0400
|
||||
@@ -0,0 +1,303 @@
|
||||
+/*
|
||||
+ * Note: this file originally auto-generated by mib2c using
|
||||
@ -4432,10 +4454,9 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable.h
|
||||
+#endif
|
||||
+#endif /* ETHERSTATSTABLE_H */
|
||||
+/** @} */
|
||||
Index: agent/mibgroup/rmon-mib/etherStatsTable_interface.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/etherStatsTable_interface.c 2008-09-16 16:36:41.663791903 +0200
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_interface.c net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_interface.c
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_interface.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_interface.c 2008-09-12 14:15:42.000000000 -0400
|
||||
@@ -0,0 +1,2225 @@
|
||||
+/*
|
||||
+ * Note: this file originally auto-generated by mib2c using
|
||||
@ -6662,10 +6683,9 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_interface.c
|
||||
+
|
||||
+ return rowreq_ctx;
|
||||
+}
|
||||
Index: agent/mibgroup/rmon-mib/etherStatsTable_interface.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/etherStatsTable_interface.h 2008-09-16 16:36:41.687791226 +0200
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_interface.h net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_interface.h
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_interface.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_interface.h 2008-08-25 02:37:27.000000000 -0400
|
||||
@@ -0,0 +1,98 @@
|
||||
+/*
|
||||
+ * Note: this file originally auto-generated by mib2c using
|
||||
@ -6765,10 +6785,9 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_interface.h
|
||||
+#endif
|
||||
+#endif /* ETHERSTATSTABLE_INTERFACE_H */
|
||||
+/** @} */
|
||||
Index: agent/mibgroup/rmon-mib/etherStatsTable_oids.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/etherStatsTable_oids.h 2008-09-16 16:36:41.715791881 +0200
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_oids.h net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_oids.h
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_oids.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_oids.h 2008-08-25 02:37:27.000000000 -0400
|
||||
@@ -0,0 +1,107 @@
|
||||
+/*
|
||||
+ * Note: this file originally auto-generated by mib2c using
|
||||
@ -6877,10 +6896,9 @@ Index: agent/mibgroup/rmon-mib/etherStatsTable_oids.h
|
||||
+}
|
||||
+#endif
|
||||
+#endif /* ETHERSTATSTABLE_OIDS_H */
|
||||
Index: agent/mibgroup/rmon-mib/ioctl_imp_common.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib/ioctl_imp_common.h 2008-09-16 16:36:41.755791948 +0200
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/ioctl_imp_common.h net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/ioctl_imp_common.h
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable/ioctl_imp_common.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable/ioctl_imp_common.h 2008-12-21 05:55:16.000000000 -0500
|
||||
@@ -0,0 +1,35 @@
|
||||
+#include <sys/socket.h>
|
||||
+#include <sys/types.h>
|
||||
@ -6905,10 +6923,10 @@ Index: agent/mibgroup/rmon-mib/ioctl_imp_common.h
|
||||
+ char name [IF_NAMESIZE];
|
||||
+};
|
||||
+
|
||||
+static struct ifname *interface_name_list_get (struct ifname *, int *);
|
||||
+static int interface_name_list_free (struct ifname *list_head);
|
||||
+static int interface_ioctl_ifindex_get (int fd, const char *name);
|
||||
+static int _etherStats_ioctl_get(int fd, int which, struct ifreq *ifrq, const char* name);
|
||||
+struct ifname *etherstats_interface_name_list_get (struct ifname *, int *);
|
||||
+int etherstats_interface_name_list_free (struct ifname *list_head);
|
||||
+int etherstats_interface_ioctl_ifindex_get (int fd, const char *name);
|
||||
+int _etherStats_ioctl_get(int fd, int which, struct ifreq *ifrq, const char* name);
|
||||
+int interface_ioctl_etherstats_get(etherStatsTable_rowreq_ctx *rowreq_ctx, int fd, const char* name);
|
||||
+
|
||||
+/* for maintainability */
|
||||
@ -6917,20 +6935,32 @@ Index: agent/mibgroup/rmon-mib/ioctl_imp_common.h
|
||||
+
|
||||
+#define ETHERSTATSJABBERS(x) strstr(x, BROADCOM_RECEIVE_JABBERS)
|
||||
+
|
||||
Index: agent/mibgroup/rmon-mib.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ agent/mibgroup/rmon-mib.h 2008-09-16 16:36:41.779791875 +0200
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable.h net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable.h
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib/etherStatsTable.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib/etherStatsTable.h 2008-12-21 05:47:48.000000000 -0500
|
||||
@@ -0,0 +1,11 @@
|
||||
+/*
|
||||
+ * module to include the modules
|
||||
+ */
|
||||
+
|
||||
+config_require(rmon-mib/data_access/etherstats)
|
||||
+config_require(rmon-mib/etherStatsTable/etherStatsTable)
|
||||
+config_require(rmon-mib/etherStatsTable/etherStatsTable_data_get)
|
||||
+config_require(rmon-mib/etherStatsTable/etherStatsTable_data_set)
|
||||
+config_require(rmon-mib/etherStatsTable/etherStatsTable_data_access)
|
||||
+config_require(rmon-mib/etherStatsTable/etherStatsTable_interface)
|
||||
+
|
||||
diff -uNr net-snmp-5.4.1.2/agent/mibgroup/rmon-mib.h net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib.h
|
||||
--- net-snmp-5.4.1.2/agent/mibgroup/rmon-mib.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ net-snmp-5.4.1.2-new/agent/mibgroup/rmon-mib.h 2008-12-21 05:41:57.000000000 -0500
|
||||
@@ -0,0 +1,8 @@
|
||||
+/*
|
||||
+ * module to include the modules
|
||||
+ */
|
||||
+
|
||||
+config_require(rmon-mib/etherStatsTable)
|
||||
+config_require(rmon-mib/etherStatsTable_interface)
|
||||
+config_require(rmon-mib/etherStatsTable_data_get)
|
||||
+config_require(rmon-mib/etherStatsTable_data_set)
|
||||
+config_require(rmon-mib/etherStatsTable_data_access)
|
||||
+config_add_mib(RMON-MIB)
|
||||
+
|
||||
+
|
||||
|
||||
|
@ -1,8 +1,30 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 22 16:36:00 CET 2009 - mrueckert@suse.de
|
||||
|
||||
- updated patches from Dell:
|
||||
Those patches incorporate the latest fixes for remarks from the
|
||||
upstream review
|
||||
old: net-snmp-5.4.1.2-rmon-mib-revised.patch
|
||||
new: net-snmp-5.4.1.2-rmon-mib-revised_3.patch
|
||||
old: net-snmp-5.4.1.2-etherlike-mib-revised_2.patch
|
||||
new: net-snmp-5.4.1.2-etherlike-mib-revised_4.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 10 12:34:56 CET 2008 - olh@suse.de
|
||||
|
||||
- use Obsoletes: -XXbit only for ppc64 to help solver during distupgrade
|
||||
(bnc#437293)
|
||||
- use Obsoletes: -XXbit only for ppc64 to help solver during
|
||||
distupgrade (bnc#437293)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 5 22:07:47 CET 2008 - mrueckert@suse.de
|
||||
|
||||
- fix the snmptrapd init script:
|
||||
1. make sure the config isnt loaded twice.
|
||||
2. do not truncate the net-snmp.log
|
||||
3. use SNMPD_LOGLEVEL aswell.
|
||||
4. write a pid
|
||||
- update snmptrapd section in README.SuSE
|
||||
- whitespace cleanup in both init scripts
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 21 14:53:28 CET 2008 - mrueckert@suse.de
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package net-snmp (Version 5.4.2.1)
|
||||
#
|
||||
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
Name: net-snmp
|
||||
Version: 5.4.2.1
|
||||
Release: 5
|
||||
Release: 6
|
||||
#
|
||||
License: BSD 3-Clause; X11/MIT
|
||||
Group: Productivity/Networking/Other
|
||||
@ -77,8 +77,8 @@ Patch8: net-snmp-5.4.2_net-snmp-config_headercheck.patch
|
||||
Patch9: net-snmp-5.4.2_perl_tk_warning.patch
|
||||
Patch10: net-snmp-5.4.2_snmpconf-selinux.patch
|
||||
Patch11: net-snmp-5.3.0.1_trap-agent-addr_v2.patch
|
||||
Patch12: net-snmp-5.4.1.2-etherlike-mib-revised_2.patch
|
||||
Patch13: net-snmp-5.4.1.2-rmon-mib-revised.patch
|
||||
Patch12: net-snmp-5.4.1.2-etherlike-mib-revised_4.patch
|
||||
Patch13: net-snmp-5.4.1.2-rmon-mib-revised_3.patch
|
||||
Patch14: net-snmp-5.4.2_velocity-mib.patch
|
||||
Patch15: Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch
|
||||
Patch16: Fix-for-IPv6-Interface-Table.patch
|
||||
@ -215,8 +215,8 @@ Authors:
|
||||
%patch9
|
||||
%patch10
|
||||
%patch11
|
||||
%patch12
|
||||
%patch13
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
@ -431,9 +431,25 @@ fi
|
||||
%{_bindir}/tkmib
|
||||
|
||||
%changelog
|
||||
* Thu Jan 22 2009 mrueckert@suse.de
|
||||
- updated patches from Dell:
|
||||
Those patches incorporate the latest fixes for remarks from the
|
||||
upstream review
|
||||
old: net-snmp-5.4.1.2-rmon-mib-revised.patch
|
||||
new: net-snmp-5.4.1.2-rmon-mib-revised_3.patch
|
||||
old: net-snmp-5.4.1.2-etherlike-mib-revised_2.patch
|
||||
new: net-snmp-5.4.1.2-etherlike-mib-revised_4.patch
|
||||
* Wed Dec 10 2008 olh@suse.de
|
||||
- use Obsoletes: -XXbit only for ppc64 to help solver during distupgrade
|
||||
(bnc#437293)
|
||||
- use Obsoletes: -XXbit only for ppc64 to help solver during
|
||||
distupgrade (bnc#437293)
|
||||
* Fri Dec 05 2008 mrueckert@suse.de
|
||||
- fix the snmptrapd init script:
|
||||
1. make sure the config isnt loaded twice.
|
||||
2. do not truncate the net-snmp.log
|
||||
3. use SNMPD_LOGLEVEL aswell.
|
||||
4. write a pid
|
||||
- update snmptrapd section in README.SuSE
|
||||
- whitespace cleanup in both init scripts
|
||||
* Fri Nov 21 2008 mrueckert@suse.de
|
||||
- update patches from Dell:
|
||||
Upstream asked to reduce the logging in the mib module.
|
||||
|
140
rc.net-snmp
140
rc.net-snmp
@ -26,10 +26,10 @@ test -x $SNMPD || exit 5
|
||||
# Check for existence of needed config file and read it
|
||||
SNMPD_CONFIG=/etc/sysconfig/net-snmp
|
||||
test -r $SNMPD_CONFIG || { echo "$SNMPD_CONFIG not existing";
|
||||
if [ "$1" = "stop" ]; then exit 0;
|
||||
else exit 6; fi; }
|
||||
if [ "$1" = "stop" ]; then exit 0;
|
||||
else exit 6; fi; }
|
||||
|
||||
# Read config
|
||||
# Read config
|
||||
. $SNMPD_CONFIG
|
||||
|
||||
# Shell functions sourced from /etc/rc.status:
|
||||
@ -55,7 +55,7 @@ rc_reset
|
||||
# 5 - program is not installed
|
||||
# 6 - program is not configured
|
||||
# 7 - program is not running
|
||||
#
|
||||
#
|
||||
# Note that starting an already running service, stopping
|
||||
# or restarting a not-running service as well as the restart
|
||||
# with force-reload (in case signalling is not supported) are
|
||||
@ -72,11 +72,11 @@ get_agents()
|
||||
agents="$agents $agent"
|
||||
agentargs="-x /var/run/agentx/master"
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting snmpd"
|
||||
echo -n "Starting snmpd"
|
||||
#
|
||||
# do not even try to start if the log file is (2GB-1MB) big.
|
||||
# the snmpd doesnt handle LFS properly
|
||||
@ -90,89 +90,89 @@ case "$1" in
|
||||
/usr/sbin/logrotate /etc/logrotate.d/net-snmp
|
||||
fi # if [ $SNMPD_SIZE_LOGFILE -gt $SNMPD_SIZE_MAX ] ; then
|
||||
fi # if [ -e "$SNMPD_LOGFILE" ] ; then
|
||||
get_agents
|
||||
# Do not add -c /etc/snmpd.conf, since it is already loaded by default.
|
||||
if [ $SNMPDCONF = "/etc/snmp/snmpd.conf" ]; then
|
||||
SNMPDCONF=""
|
||||
else
|
||||
SNMPDCONF="-c $SNMPDCONF"
|
||||
fi
|
||||
case "${SNMPD_USE_SMUX:-yes}" in
|
||||
[Nn][Oo])
|
||||
SNMPDNOSMUX="-I -smux"
|
||||
;;
|
||||
esac
|
||||
case "${SNMPD_LOG_SUCCESSFUL_CONNECTIONS:-yes}" in
|
||||
[Nn][Oo])
|
||||
SNMPDNOTCPWRAPPERLOG="--dontLogTCPWrappersConnects"
|
||||
;;
|
||||
esac
|
||||
startproc $SNMPD $SNMPDCONF -r -A -LF ${SNMPD_LOGLEVEL:-d} $SNMPD_LOGFILE -p /var/run/snmpd.pid $agentargs $SNMPDNOSMUX $SNMPDNOTCPWRAPPERLOG
|
||||
rc_status -v
|
||||
rc_reset
|
||||
get_agents
|
||||
# Do not add -c /etc/snmpd.conf, since it is already loaded by default.
|
||||
if [ $SNMPDCONF = "/etc/snmp/snmpd.conf" ]; then
|
||||
SNMPDCONF=""
|
||||
else
|
||||
SNMPDCONF="-c $SNMPDCONF"
|
||||
fi
|
||||
case "${SNMPD_USE_SMUX:-yes}" in
|
||||
[Nn][Oo])
|
||||
SNMPDNOSMUX="-I -smux"
|
||||
;;
|
||||
esac
|
||||
case "${SNMPD_LOG_SUCCESSFUL_CONNECTIONS:-yes}" in
|
||||
[Nn][Oo])
|
||||
SNMPDNOTCPWRAPPERLOG="--dontLogTCPWrappersConnects"
|
||||
;;
|
||||
esac
|
||||
startproc $SNMPD $SNMPDCONF -r -A -LF ${SNMPD_LOGLEVEL:-d} $SNMPD_LOGFILE -p /var/run/snmpd.pid $agentargs $SNMPDNOSMUX $SNMPDNOTCPWRAPPERLOG
|
||||
rc_status -v
|
||||
rc_reset
|
||||
|
||||
# start all agents
|
||||
if test -n "$agents"; then
|
||||
usleep 300000
|
||||
for agent in $agents; do
|
||||
# start all agents
|
||||
if test -n "$agents"; then
|
||||
usleep 300000
|
||||
for agent in $agents; do
|
||||
echo -en "\tStarting `basename $agent`"
|
||||
startproc -t1 $agent
|
||||
rc_status -v ; rc_reset
|
||||
startproc -t1 $agent
|
||||
rc_status -v ; rc_reset
|
||||
done
|
||||
fi
|
||||
;;
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down snmpd:"
|
||||
killproc -TERM $SNMPD
|
||||
rc_status -v ; rc_reset
|
||||
# we also need to make sure all agents die
|
||||
if test -n "$agents"; then
|
||||
echo -n "Shutting down snmpd:"
|
||||
killproc -TERM $SNMPD
|
||||
rc_status -v ; rc_reset
|
||||
# we also need to make sure all agents die
|
||||
if test -n "$agents"; then
|
||||
for agent in $AGENTDIR/*; do
|
||||
test -x $agent || continue
|
||||
echo -ne "\tShutting down `basename $agent`:"
|
||||
echo -ne "\tShutting down `basename $agent`:"
|
||||
killproc $agent
|
||||
rc_status -v ; rc_reset
|
||||
rc_status -v ; rc_reset
|
||||
done
|
||||
fi
|
||||
;;
|
||||
fi
|
||||
;;
|
||||
try-restart)
|
||||
$0 status >/dev/null && $0 restart
|
||||
rc_status
|
||||
;;
|
||||
$0 status >/dev/null && $0 restart
|
||||
rc_status
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
rc_status
|
||||
;;
|
||||
$0 stop
|
||||
$0 start
|
||||
rc_status
|
||||
;;
|
||||
force-reload)
|
||||
echo -n "Reload service snmpd:"
|
||||
killproc -HUP $SNMPD
|
||||
rc_status -v
|
||||
;;
|
||||
echo -n "Reload service snmpd:"
|
||||
killproc -HUP $SNMPD
|
||||
rc_status -v
|
||||
;;
|
||||
reload)
|
||||
echo -n "Reload service snmpd:"
|
||||
killproc -HUP $SNMPD
|
||||
rc_status -v
|
||||
;;
|
||||
echo -n "Reload service snmpd:"
|
||||
killproc -HUP $SNMPD
|
||||
rc_status -v
|
||||
;;
|
||||
status)
|
||||
echo -n "Checking for service snmpd:"
|
||||
checkproc $SNMPD
|
||||
rc_status -v
|
||||
get_agents
|
||||
if test -n "$agents"; then
|
||||
echo -e "Checking for agents:"
|
||||
echo -n "Checking for service snmpd:"
|
||||
checkproc $SNMPD
|
||||
rc_status -v
|
||||
get_agents
|
||||
if test -n "$agents"; then
|
||||
echo -e "Checking for agents:"
|
||||
|
||||
for agent in $agents; do
|
||||
for agent in $agents; do
|
||||
echo -en "\t`basename $agent`"
|
||||
checkproc $agent
|
||||
rc_status -v
|
||||
done
|
||||
fi
|
||||
;;
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
rc_exit
|
||||
|
||||
|
78
rc.snmptrapd
78
rc.snmptrapd
@ -15,9 +15,20 @@
|
||||
### END INIT INFO
|
||||
|
||||
SNMPTRAPD=/usr/sbin/snmptrapd
|
||||
SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf"
|
||||
SNMPTRAPD_LOGFILE="/var/log/net-snmp.log"
|
||||
|
||||
test -x $SNMPTRAPD || exit 5
|
||||
|
||||
# Check for existence of needed config file and read it
|
||||
SNMPD_CONFIG=/etc/sysconfig/net-snmp
|
||||
test -r $SNMPD_CONFIG || { echo "$SNMPD_CONFIG not existing";
|
||||
if [ "$1" = "stop" ]; then exit 0;
|
||||
else exit 6; fi; }
|
||||
|
||||
# Read config
|
||||
. $SNMPD_CONFIG
|
||||
|
||||
# Shell functions sourced from /etc/rc.status:
|
||||
# rc_check check and set local and overall rc status
|
||||
# rc_status check and set local and overall rc status
|
||||
@ -46,46 +57,51 @@ rc_reset
|
||||
# or restarting a not-running service as well as the restart
|
||||
# with force-reload (in case signalling is not supported) are
|
||||
# considered a success.
|
||||
|
||||
if [ $SNMPTRAPD_CONF = "/etc/snmp/snmptrapd.conf" ]; then
|
||||
SNMPTRAPD_CONF=""
|
||||
else
|
||||
SNMPTRAPD_CONF="-c $SNMPTRAPD_CONF"
|
||||
fi
|
||||
SNMPTRAPD_LOGFILE="${SNMPTRAPD_LOGFILE:-/var/log/net-snmp.log}"
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting snmptrapd:"
|
||||
startproc $SNMPTRAPD -c /etc/snmptrapd.conf -Lf /var/log/net-snmpd.log
|
||||
rc_status -v
|
||||
;;
|
||||
echo -n "Starting snmptrapd:"
|
||||
startproc $SNMPTRAPD $SNMPTRAPD_CONF -A -Lf ${SNMPD_LOGLEVEL:-d} $SNMPTRAPD_LOGFILE -p /var/run/snmptrapd.pid
|
||||
rc_status -v
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down snmptrapd:"
|
||||
killproc -TERM $SNMPTRAPD
|
||||
rc_status -v
|
||||
;;
|
||||
echo -n "Shutting down snmptrapd:"
|
||||
killproc -TERM $SNMPTRAPD
|
||||
rc_status -v
|
||||
;;
|
||||
try-restart)
|
||||
$0 status >/dev/null && $0 restart
|
||||
rc_status
|
||||
;;
|
||||
$0 status >/dev/null && $0 restart
|
||||
rc_status
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
rc_status
|
||||
;;
|
||||
$0 stop
|
||||
$0 start
|
||||
rc_status
|
||||
;;
|
||||
force-reload)
|
||||
echo -n "Reload service snmptrapd:"
|
||||
killproc -HUP $SNMPTRAPD
|
||||
rc_status -v
|
||||
;;
|
||||
echo -n "Reload service snmptrapd:"
|
||||
killproc -HUP $SNMPTRAPD
|
||||
rc_status -v
|
||||
;;
|
||||
reload)
|
||||
echo -n "Reload service snmptrapd:"
|
||||
killproc -HUP $SNMPTRAPD
|
||||
rc_status -v
|
||||
;;
|
||||
echo -n "Reload service snmptrapd:"
|
||||
killproc -HUP $SNMPTRAPD
|
||||
rc_status -v
|
||||
;;
|
||||
status)
|
||||
echo -n "Checking for service snmptrapd:"
|
||||
checkproc $SNMPTRAPD
|
||||
rc_status -v
|
||||
;;
|
||||
echo -n "Checking for service snmptrapd:"
|
||||
checkproc $SNMPTRAPD
|
||||
rc_status -v
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
rc_exit
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user