RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN with the following as its source: https://src.fedoraproject.org/rpms/net-snmp#be26e76db31e227dcc75fe872ad69f39629713ad
This commit is contained in:
parent
791d5b61a7
commit
a1810f2a01
9
.gitignore
vendored
9
.gitignore
vendored
@ -0,0 +1,9 @@
|
|||||||
|
net-snmp-5.5.tar.gz
|
||||||
|
/net-snmp-5.6.tar.gz
|
||||||
|
/net-snmp-5.6.1.tar.gz
|
||||||
|
/net-snmp-5.7.tar.gz
|
||||||
|
/net-snmp-5.7.1.tar.gz
|
||||||
|
/net-snmp-5.7.2.tar.gz
|
||||||
|
/net-snmp-5.7.3.tar.gz
|
||||||
|
/net-snmp-5.8.tar.gz
|
||||||
|
/net-snmp-5.9.tar.gz
|
28
0001-Link-libnetsnmptrapd-against-MYSQL_LIBS.patch
Normal file
28
0001-Link-libnetsnmptrapd-against-MYSQL_LIBS.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From 9432f629e66e4f9500f6335eab3ad427f84523b2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Adam Williamson <awilliam@redhat.com>
|
||||||
|
Date: Thu, 20 Jul 2017 10:31:47 -0700
|
||||||
|
Subject: [PATCH] Link libnetsnmptrapd against MYSQL_LIBS
|
||||||
|
|
||||||
|
When building with MySQL (MariaDB) support, this library must
|
||||||
|
be linked against the MySQL client library, or else it will
|
||||||
|
have unresolved symbols.
|
||||||
|
---
|
||||||
|
apps/Makefile.in | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/apps/Makefile.in b/apps/Makefile.in
|
||||||
|
index 77404dd89..7da434522 100644
|
||||||
|
--- a/apps/Makefile.in
|
||||||
|
+++ b/apps/Makefile.in
|
||||||
|
@@ -204,7 +204,7 @@ snmpdf$(EXEEXT): snmpdf.$(OSUFFIX) $(USELIBS)
|
||||||
|
$(LINK) ${CFLAGS} -o $@ snmpdf.$(OSUFFIX) ${LDFLAGS} ${LIBS}
|
||||||
|
|
||||||
|
libnetsnmptrapd.$(LIB_EXTENSION)$(LIB_VERSION): $(LLIBTRAPD_OBJS)
|
||||||
|
- $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS)
|
||||||
|
+ $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(MYSQL_LIBS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
snmpinforminstall:
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
41
IETF-MIB-LICENSE.txt
Normal file
41
IETF-MIB-LICENSE.txt
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
MIBs included in this software taken from IETF Documents are considered
|
||||||
|
Code Components in accordance with the IETF Trust License Policy, as found
|
||||||
|
here:
|
||||||
|
|
||||||
|
http://trustee.ietf.org/license-info/
|
||||||
|
|
||||||
|
They are available under the terms of the Simplified BSD license, a copy of
|
||||||
|
which is included below.
|
||||||
|
|
||||||
|
*****
|
||||||
|
|
||||||
|
Copyright (c) 2013 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, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
· Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
· Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
· Neither the name of Internet Society, IETF or IETF Trust, nor the
|
||||||
|
names of specific contributors, may be used to endorse or promote
|
||||||
|
products derived from this software without specific prior written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS
|
||||||
|
IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
net-snmp-5.7.2-cert-path.patch
Normal file
30
net-snmp-5.7.2-cert-path.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
1134475 - dependency in perl package
|
||||||
|
|
||||||
|
Use hardcoded path to configuration directories instead of net-snmp-config.
|
||||||
|
net-snmp-config is in net-snmp-devel package and we do not want net-snmp-perl
|
||||||
|
depending on -devel.
|
||||||
|
|
||||||
|
diff -up net-snmp-5.7.2/local/net-snmp-cert.cert-path net-snmp-5.7.2/local/net-snmp-cert
|
||||||
|
--- net-snmp-5.7.2/local/net-snmp-cert.cert-path 2012-10-10 00:28:58.000000000 +0200
|
||||||
|
+++ net-snmp-5.7.2/local/net-snmp-cert 2014-09-01 12:05:10.582427036 +0200
|
||||||
|
@@ -819,8 +819,7 @@ sub set_default {
|
||||||
|
sub cfg_path {
|
||||||
|
my $path;
|
||||||
|
|
||||||
|
- $path = `$NetSNMP::Cert::CFGTOOL --snmpconfpath`;
|
||||||
|
- chomp $path;
|
||||||
|
+ $path = "/etc/snmp:/usr/share/snmp:/usr/lib64/snmp:/home/jsafrane/.snmp:/var/lib/net-snmp";
|
||||||
|
return (wantarray ? split(':', $path) : $path);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1414,8 +1413,8 @@ sub checkReqs {
|
||||||
|
die("$NetSNMP::Cert::OPENSSL (v$ossl_ver): must be $ossl_min_ver or later")
|
||||||
|
if ($ossl_ver cmp $ossl_min_ver) < 0;
|
||||||
|
|
||||||
|
- die("$NetSNMP::Cert::CFGTOOL not found: please install")
|
||||||
|
- if system("$NetSNMP::Cert::CFGTOOL > /dev/null 2>&1");
|
||||||
|
+# die("$NetSNMP::Cert::CFGTOOL not found: please install")
|
||||||
|
+# if system("$NetSNMP::Cert::CFGTOOL > /dev/null 2>&1");
|
||||||
|
}
|
||||||
|
|
||||||
|
sub initOpts {
|
14
net-snmp-5.7.3-iterator-fix.patch
Normal file
14
net-snmp-5.7.3-iterator-fix.patch
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
diff -urNp old/agent/mibgroup/host/data_access/swrun.c new/agent/mibgroup/host/data_access/swrun.c
|
||||||
|
--- old/agent/mibgroup/host/data_access/swrun.c 2017-07-18 09:44:00.626109526 +0200
|
||||||
|
+++ new/agent/mibgroup/host/data_access/swrun.c 2017-07-19 15:27:50.452255836 +0200
|
||||||
|
@@ -102,6 +102,10 @@ swrun_count_processes_by_name( char *nam
|
||||||
|
return 0; /* or -1 */
|
||||||
|
|
||||||
|
it = CONTAINER_ITERATOR( swrun_container );
|
||||||
|
+ if((entry = (netsnmp_swrun_entry*)ITERATOR_FIRST( it )) != NULL) {
|
||||||
|
+ if (0 == strcmp( entry->hrSWRunName, name ))
|
||||||
|
+ i++;
|
||||||
|
+ }
|
||||||
|
while ((entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) != NULL) {
|
||||||
|
if (0 == strcmp( entry->hrSWRunName, name ))
|
||||||
|
i++;
|
12
net-snmp-5.8-Remove-U64-typedef.patch
Normal file
12
net-snmp-5.8-Remove-U64-typedef.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -urNp a/include/net-snmp/library/int64.h b/include/net-snmp/library/int64.h
|
||||||
|
--- a/include/net-snmp/library/int64.h 2018-07-18 14:37:16.543348832 +0200
|
||||||
|
+++ b/include/net-snmp/library/int64.h 2018-07-18 15:31:31.516999288 +0200
|
||||||
|
@@ -10,7 +10,7 @@ extern "C" {
|
||||||
|
* Note: using the U64 typedef is deprecated because this typedef conflicts
|
||||||
|
* with a typedef with the same name defined in the Perl header files.
|
||||||
|
*/
|
||||||
|
- typedef struct counter64 U64;
|
||||||
|
+// typedef struct counter64 U64;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define I64CHARSZ 21
|
11
net-snmp-5.8-duplicate-ipAddress.patch
Normal file
11
net-snmp-5.8-duplicate-ipAddress.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
diff -urNp a/agent/mibgroup/ip-mib/data_access/ipaddress_common.c b/agent/mibgroup/ip-mib/data_access/ipaddress_common.c
|
||||||
|
--- a/agent/mibgroup/ip-mib/data_access/ipaddress_common.c 2020-06-10 13:27:03.213904398 +0200
|
||||||
|
+++ b/agent/mibgroup/ip-mib/data_access/ipaddress_common.c 2020-06-10 13:28:41.025863050 +0200
|
||||||
|
@@ -121,6 +121,7 @@ _remove_duplicates(netsnmp_container *co
|
||||||
|
for (entry = ITERATOR_FIRST(it); entry; entry = ITERATOR_NEXT(it)) {
|
||||||
|
if (prev_entry && _access_ipaddress_entry_compare_addr(prev_entry, entry) == 0) {
|
||||||
|
/* 'entry' is duplicate of the previous one -> delete it */
|
||||||
|
+ NETSNMP_LOGONCE((LOG_ERR, "Duplicate IPv4 address detected, some interfaces may not be visible in IP-MIB\n"));
|
||||||
|
netsnmp_access_ipaddress_entry_free(entry);
|
||||||
|
} else {
|
||||||
|
CONTAINER_INSERT(ret, entry);
|
12
net-snmp-5.8-expand-SNMPCONFPATH.patch
Normal file
12
net-snmp-5.8-expand-SNMPCONFPATH.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -ruNp a/snmplib/read_config.c b/snmplib/read_config.c
|
||||||
|
--- a/snmplib/read_config.c 2020-06-10 09:51:57.184786510 +0200
|
||||||
|
+++ b/snmplib/read_config.c 2020-06-10 09:53:13.257507112 +0200
|
||||||
|
@@ -1642,7 +1642,7 @@ snmp_save_persistent(const char *type)
|
||||||
|
* save a warning header to the top of the new file
|
||||||
|
*/
|
||||||
|
snprintf(fileold, sizeof(fileold),
|
||||||
|
- "%s%s# Please save normal configuration tokens for %s in SNMPCONFPATH/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n%s",
|
||||||
|
+ "%s%s# Please save normal configuration tokens for %s in /etc/snmp/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n%s",
|
||||||
|
"#\n# net-snmp (or ucd-snmp) persistent data file.\n#\n############################################################################\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n",
|
||||||
|
"#\n# **** DO NOT EDIT THIS FILE ****\n#\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n############################################################################\n#\n# DO NOT STORE CONFIGURATION ENTRIES HERE.\n",
|
||||||
|
type, type, type,
|
82
net-snmp-5.8-ipAddress-faster-load.patch
Normal file
82
net-snmp-5.8-ipAddress-faster-load.patch
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
diff -urNp a/agent/mibgroup/mibII/ipAddr.c b/agent/mibgroup/mibII/ipAddr.c
|
||||||
|
--- a/agent/mibgroup/mibII/ipAddr.c 2020-06-10 14:14:30.113696471 +0200
|
||||||
|
+++ b/agent/mibgroup/mibII/ipAddr.c 2020-06-10 14:27:15.345354018 +0200
|
||||||
|
@@ -495,14 +495,16 @@ Address_Scan_Next(Index, Retin_ifaddr)
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(linux)
|
||||||
|
+#include <errno.h>
|
||||||
|
static struct ifreq *ifr;
|
||||||
|
static int ifr_counter;
|
||||||
|
|
||||||
|
static void
|
||||||
|
Address_Scan_Init(void)
|
||||||
|
{
|
||||||
|
- int num_interfaces = 0;
|
||||||
|
+ int i;
|
||||||
|
int fd;
|
||||||
|
+ int lastlen = 0;
|
||||||
|
|
||||||
|
/* get info about all interfaces */
|
||||||
|
|
||||||
|
@@ -510,28 +512,45 @@ Address_Scan_Init(void)
|
||||||
|
SNMP_FREE(ifc.ifc_buf);
|
||||||
|
ifr_counter = 0;
|
||||||
|
|
||||||
|
- do
|
||||||
|
- {
|
||||||
|
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
|
||||||
|
{
|
||||||
|
DEBUGMSGTL(("snmpd", "socket open failure in Address_Scan_Init\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
- num_interfaces += 16;
|
||||||
|
|
||||||
|
- ifc.ifc_len = sizeof(struct ifreq) * num_interfaces;
|
||||||
|
- ifc.ifc_buf = (char*) realloc(ifc.ifc_buf, ifc.ifc_len);
|
||||||
|
-
|
||||||
|
- if (ioctl(fd, SIOCGIFCONF, &ifc) < 0)
|
||||||
|
- {
|
||||||
|
- ifr=NULL;
|
||||||
|
- close(fd);
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
- close(fd);
|
||||||
|
+ /*
|
||||||
|
+ * Cope with lots of interfaces and brokenness of ioctl SIOCGIFCONF
|
||||||
|
+ * on some platforms; see W. R. Stevens, ``Unix Network Programming
|
||||||
|
+ * Volume I'', p.435...
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+ for (i = 8;; i *= 2) {
|
||||||
|
+ ifc.ifc_len = sizeof(struct ifreq) * i;
|
||||||
|
+ ifc.ifc_req = calloc(i, sizeof(struct ifreq));
|
||||||
|
+
|
||||||
|
+ if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) {
|
||||||
|
+ if (errno != EINVAL || lastlen != 0) {
|
||||||
|
+ /*
|
||||||
|
+ * Something has gone genuinely wrong...
|
||||||
|
+ */
|
||||||
|
+ snmp_log(LOG_ERR, "bad rc from ioctl, errno %d", errno);
|
||||||
|
+ SNMP_FREE(ifc.ifc_buf);
|
||||||
|
+ close(fd);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ if (ifc.ifc_len == lastlen) {
|
||||||
|
+ /*
|
||||||
|
+ * The length is the same as the last time; we're done...
|
||||||
|
+ */
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ lastlen = ifc.ifc_len;
|
||||||
|
+ }
|
||||||
|
+ free(ifc.ifc_buf); /* no SNMP_FREE, getting ready to reassign */
|
||||||
|
}
|
||||||
|
- while (ifc.ifc_len >= (sizeof(struct ifreq) * num_interfaces));
|
||||||
|
-
|
||||||
|
+
|
||||||
|
+ close(fd);
|
||||||
|
ifr = ifc.ifc_req;
|
||||||
|
}
|
||||||
|
|
36
net-snmp-5.8-man-page.patch
Normal file
36
net-snmp-5.8-man-page.patch
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
diff -urNp a/man/net-snmp-create-v3-user.1.def b/man/net-snmp-create-v3-user.1.def
|
||||||
|
--- a/man/net-snmp-create-v3-user.1.def 2020-06-10 13:43:18.443070961 +0200
|
||||||
|
+++ b/man/net-snmp-create-v3-user.1.def 2020-06-10 13:49:25.975363441 +0200
|
||||||
|
@@ -3,7 +3,7 @@
|
||||||
|
net-snmp-create-v3-user \- create a SNMPv3 user in net-snmp configuration file
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.PP
|
||||||
|
-.B net-snmp-create-v3-user [-ro] [-a authpass] [-x privpass] [-X DES|AES]
|
||||||
|
+.B net-snmp-create-v3-user [-ro] [-A authpass] [-a MD5|SHA] [-X privpass] [-x DES|AES]
|
||||||
|
.B [username]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.PP
|
||||||
|
@@ -16,13 +16,16 @@ new user in net-snmp configuration file
|
||||||
|
displays the net-snmp version number
|
||||||
|
.TP
|
||||||
|
\fB\-ro\fR
|
||||||
|
-create an user with read-only permissions
|
||||||
|
+creates a user with read-only permissions
|
||||||
|
.TP
|
||||||
|
-\fB\-a authpass\fR
|
||||||
|
-specify authentication password
|
||||||
|
+\fB\-A authpass\fR
|
||||||
|
+specifies the authentication password
|
||||||
|
.TP
|
||||||
|
-\fB\-x privpass\fR
|
||||||
|
-specify encryption password
|
||||||
|
+\fB\-a MD5|SHA\fR
|
||||||
|
+specifies the authentication password hashing algorithm
|
||||||
|
.TP
|
||||||
|
-\fB\-X DES|AES\fR
|
||||||
|
-specify encryption algorithm
|
||||||
|
+\fB\-X privpass\fR
|
||||||
|
+specifies the encryption password
|
||||||
|
+.TP
|
||||||
|
+\fB\-x DES|AES\fR
|
||||||
|
+specifies the encryption algorithm
|
83
net-snmp-5.8-modern-rpm-api.patch
Normal file
83
net-snmp-5.8-modern-rpm-api.patch
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
diff -urNp a/agent/mibgroup/host/data_access/swinst_rpm.c b/agent/mibgroup/host/data_access/swinst_rpm.c
|
||||||
|
--- a/agent/mibgroup/host/data_access/swinst_rpm.c 2018-07-18 16:12:19.583503903 +0200
|
||||||
|
+++ b/agent/mibgroup/host/data_access/swinst_rpm.c 2018-07-18 16:50:38.599703588 +0200
|
||||||
|
@@ -102,7 +102,6 @@ netsnmp_swinst_arch_load( netsnmp_contai
|
||||||
|
rpmtd td_name, td_version, td_release, td_group, td_time;
|
||||||
|
#else
|
||||||
|
char *n, *v, *r, *g;
|
||||||
|
- int32_t *t;
|
||||||
|
#endif
|
||||||
|
time_t install_time;
|
||||||
|
size_t date_len;
|
||||||
|
@@ -146,14 +145,13 @@ netsnmp_swinst_arch_load( netsnmp_contai
|
||||||
|
install_time = rpmtdGetNumber(td_time);
|
||||||
|
g = rpmtdGetString(td_group);
|
||||||
|
#else
|
||||||
|
- headerGetEntry( h, RPMTAG_NAME, NULL, (void**)&n, NULL);
|
||||||
|
- headerGetEntry( h, RPMTAG_VERSION, NULL, (void**)&v, NULL);
|
||||||
|
- headerGetEntry( h, RPMTAG_RELEASE, NULL, (void**)&r, NULL);
|
||||||
|
- headerGetEntry( h, RPMTAG_GROUP, NULL, (void**)&g, NULL);
|
||||||
|
- headerGetEntry( h, RPMTAG_INSTALLTIME, NULL, (void**)&t, NULL);
|
||||||
|
+ n = headerGetString( h, RPMTAG_NAME);
|
||||||
|
+ v = headerGetString( h, RPMTAG_VERSION);
|
||||||
|
+ r = headerGetString( h, RPMTAG_RELEASE);
|
||||||
|
+ g = headerGetString( h, RPMTAG_GROUP);
|
||||||
|
+ install_time = headerGetNumber( h, RPMTAG_INSTALLTIME);
|
||||||
|
entry->swName_len = snprintf( entry->swName, sizeof(entry->swName),
|
||||||
|
"%s-%s-%s", n, v, r);
|
||||||
|
- install_time = *t;
|
||||||
|
#endif
|
||||||
|
entry->swType = (g && NULL != strstr( g, "System Environment"))
|
||||||
|
? 2 /* operatingSystem */
|
||||||
|
diff -urNp a/agent/mibgroup/host/hr_swinst.c b/agent/mibgroup/host/hr_swinst.c
|
||||||
|
--- a/agent/mibgroup/host/hr_swinst.c 2018-07-18 16:12:19.582503907 +0200
|
||||||
|
+++ b/agent/mibgroup/host/hr_swinst.c 2018-07-18 17:09:29.716564197 +0200
|
||||||
|
@@ -479,9 +479,9 @@ var_hrswinst(struct variable * vp,
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# ifdef HAVE_LIBRPM
|
||||||
|
- char *rpm_groups;
|
||||||
|
- if ( headerGetEntry(swi->swi_h, RPMTAG_GROUP, NULL, (void **) &rpm_groups, NULL) ) {
|
||||||
|
- if ( strstr(rpm_groups, "System Environment") != NULL )
|
||||||
|
+ const char *rpm_group = headerGetString(swi->swi_h, RPMTAG_GROUP);
|
||||||
|
+ if ( NULL != rpm_group ) {
|
||||||
|
+ if ( strstr(rpm_group, "System Environment") != NULL )
|
||||||
|
long_return = 2; /* operatingSystem */
|
||||||
|
else
|
||||||
|
long_return = 4; /* applcation */
|
||||||
|
@@ -498,9 +498,8 @@ var_hrswinst(struct variable * vp,
|
||||||
|
case HRSWINST_DATE:
|
||||||
|
{
|
||||||
|
#ifdef HAVE_LIBRPM
|
||||||
|
- int32_t *rpm_data;
|
||||||
|
- if ( headerGetEntry(swi->swi_h, RPMTAG_INSTALLTIME, NULL, (void **) &rpm_data, NULL) ) {
|
||||||
|
- time_t installTime = *rpm_data;
|
||||||
|
+ time_t installTime = headerGetNumber(swi->swi_h, RPMTAG_INSTALLTIME);
|
||||||
|
+ if ( 0 != installTime ) {
|
||||||
|
ret = date_n_time(&installTime, var_len);
|
||||||
|
} else {
|
||||||
|
ret = date_n_time(NULL, var_len);
|
||||||
|
@@ -660,7 +659,7 @@ Save_HR_SW_info(int ix)
|
||||||
|
if (1 <= ix && ix <= swi->swi_nrec && ix != swi->swi_prevx) {
|
||||||
|
int offset;
|
||||||
|
Header h;
|
||||||
|
- char *n, *v, *r;
|
||||||
|
+ const char *n, *v, *r;
|
||||||
|
|
||||||
|
offset = swi->swi_recs[ix - 1];
|
||||||
|
|
||||||
|
@@ -685,11 +684,9 @@ Save_HR_SW_info(int ix)
|
||||||
|
swi->swi_h = h;
|
||||||
|
swi->swi_prevx = ix;
|
||||||
|
|
||||||
|
- headerGetEntry(swi->swi_h, RPMTAG_NAME, NULL, (void **) &n, NULL);
|
||||||
|
- headerGetEntry(swi->swi_h, RPMTAG_VERSION, NULL, (void **) &v,
|
||||||
|
- NULL);
|
||||||
|
- headerGetEntry(swi->swi_h, RPMTAG_RELEASE, NULL, (void **) &r,
|
||||||
|
- NULL);
|
||||||
|
+ n = headerGetString(swi->swi_h, RPMTAG_NAME);
|
||||||
|
+ v = headerGetString(swi->swi_h, RPMTAG_VERSION);
|
||||||
|
+ r = headerGetString(swi->swi_h, RPMTAG_RELEASE);
|
||||||
|
snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", n, v, r);
|
||||||
|
swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
|
||||||
|
}
|
26
net-snmp-5.8-rpm-memory-leak.patch
Normal file
26
net-snmp-5.8-rpm-memory-leak.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
diff -urNp a/agent/mibgroup/host/data_access/swinst_rpm.c b/agent/mibgroup/host/data_access/swinst_rpm.c
|
||||||
|
--- a/agent/mibgroup/host/data_access/swinst_rpm.c 2020-06-10 14:32:43.330486233 +0200
|
||||||
|
+++ b/agent/mibgroup/host/data_access/swinst_rpm.c 2020-06-10 14:35:46.672298741 +0200
|
||||||
|
@@ -75,6 +75,9 @@ netsnmp_swinst_arch_init(void)
|
||||||
|
snprintf( pkg_directory, SNMP_MAXPATH, "%s/Packages", dbpath );
|
||||||
|
SNMP_FREE(rpmdbpath);
|
||||||
|
dbpath = NULL;
|
||||||
|
+#ifdef HAVE_RPMGETPATH
|
||||||
|
+ rpmFreeRpmrc();
|
||||||
|
+#endif
|
||||||
|
if (-1 == stat( pkg_directory, &stat_buf )) {
|
||||||
|
snmp_log(LOG_ERR, "Can't find directory of RPM packages");
|
||||||
|
pkg_directory[0] = '\0';
|
||||||
|
diff -urNp a/agent/mibgroup/host/hr_swinst.c b/agent/mibgroup/host/hr_swinst.c
|
||||||
|
--- a/agent/mibgroup/host/hr_swinst.c 2020-06-10 14:32:43.325486184 +0200
|
||||||
|
+++ b/agent/mibgroup/host/hr_swinst.c 2020-06-10 14:36:44.423872418 +0200
|
||||||
|
@@ -231,6 +231,9 @@ init_hr_swinst(void)
|
||||||
|
snprintf(path, sizeof(path), "%s/packages.rpm", swi->swi_dbpath);
|
||||||
|
path[ sizeof(path)-1 ] = 0;
|
||||||
|
swi->swi_directory = strdup(path);
|
||||||
|
+#ifdef HAVE_RPMGETPATH
|
||||||
|
+ rpmFreeRpmrc();
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# ifdef _PATH_HRSW_directory
|
18
net-snmp-5.9-aes-config.patch
Normal file
18
net-snmp-5.9-aes-config.patch
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
diff --git a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in
|
||||||
|
index afd6fa4..07c26fe 100644
|
||||||
|
--- a/net-snmp-create-v3-user.in
|
||||||
|
+++ b/net-snmp-create-v3-user.in
|
||||||
|
@@ -58,11 +58,11 @@ case $1 in
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
case $1 in
|
||||||
|
- DES|AES|AES128)
|
||||||
|
+ DES|AES|AES128|AES192|AES256)
|
||||||
|
Xalgorithm=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
- des|aes|aes128)
|
||||||
|
+ des|aes|aes128|aes192|aes256)
|
||||||
|
Xalgorithm=`echo $1 | tr a-z A-Z`
|
||||||
|
shift
|
||||||
|
;;
|
46
net-snmp-5.9-autofs-skip.patch
Normal file
46
net-snmp-5.9-autofs-skip.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
diff --git a/agent/mibgroup/host/hr_filesys.c b/agent/mibgroup/host/hr_filesys.c
|
||||||
|
index 4f78df3..fd25b3f 100644
|
||||||
|
--- a/agent/mibgroup/host/hr_filesys.c
|
||||||
|
+++ b/agent/mibgroup/host/hr_filesys.c
|
||||||
|
@@ -704,6 +704,7 @@ static const char *HRFS_ignores[] = {
|
||||||
|
"shm",
|
||||||
|
"sockfs",
|
||||||
|
"sysfs",
|
||||||
|
+ "tmpfs",
|
||||||
|
"usbdevfs",
|
||||||
|
"usbfs",
|
||||||
|
#endif
|
||||||
|
diff --git a/agent/mibgroup/host/hr_storage.c b/agent/mibgroup/host/hr_storage.c
|
||||||
|
index 6b459ec..f7a376b 100644
|
||||||
|
--- a/agent/mibgroup/host/hr_storage.c
|
||||||
|
+++ b/agent/mibgroup/host/hr_storage.c
|
||||||
|
@@ -540,9 +540,10 @@ really_try_next:
|
||||||
|
|
||||||
|
store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ];
|
||||||
|
if (store_idx > NETSNMP_MEM_TYPE_MAX ) {
|
||||||
|
- if ( netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||||
|
+ if ( (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||||
|
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
|
||||||
|
- Check_HR_FileSys_NFS())
|
||||||
|
+ Check_HR_FileSys_NFS()) ||
|
||||||
|
+ Check_HR_FileSys_AutoFs())
|
||||||
|
return NULL; /* or goto try_next; */
|
||||||
|
if (Check_HR_FileSys_AutoFs())
|
||||||
|
return NULL;
|
||||||
|
diff --git a/agent/mibgroup/host/hrh_storage.c b/agent/mibgroup/host/hrh_storage.c
|
||||||
|
index 8967d35..9bf2659 100644
|
||||||
|
--- a/agent/mibgroup/host/hrh_storage.c
|
||||||
|
+++ b/agent/mibgroup/host/hrh_storage.c
|
||||||
|
@@ -366,9 +366,10 @@ really_try_next:
|
||||||
|
store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ];
|
||||||
|
if (HRFS_entry &&
|
||||||
|
store_idx > NETSNMP_MEM_TYPE_MAX &&
|
||||||
|
- netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||||
|
+ ((netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||||
|
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
|
||||||
|
- Check_HR_FileSys_NFS())
|
||||||
|
+ Check_HR_FileSys_NFS()) ||
|
||||||
|
+ Check_HR_FileSys_AutoFs()))
|
||||||
|
return NULL;
|
||||||
|
if (HRFS_entry && Check_HR_FileSys_AutoFs())
|
||||||
|
return NULL;
|
143
net-snmp-5.9-available-memory.patch
Normal file
143
net-snmp-5.9-available-memory.patch
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
From 5b8bf5d4130761c3374f9ad618e8a76bb75eb634 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Yuwei Ba <i@xiaoba.me>
|
||||||
|
Date: Fri, 21 Aug 2020 15:06:10 +0800
|
||||||
|
Subject: [PATCH] snmpd: support MemAvailable on Linux
|
||||||
|
|
||||||
|
See also https://github.com/net-snmp/net-snmp/pull/167 .
|
||||||
|
|
||||||
|
[bvanassche: modified the behavior of this patch]
|
||||||
|
---
|
||||||
|
agent/mibgroup/hardware/memory/memory_linux.c | 20 ++++++++++++++++++-
|
||||||
|
agent/mibgroup/ucd-snmp/memory.c | 12 ++++++++++-
|
||||||
|
agent/mibgroup/ucd-snmp/memory.h | 1 +
|
||||||
|
include/net-snmp/agent/hardware/memory.h | 1 +
|
||||||
|
mibs/UCD-SNMP-MIB.txt | 16 +++++++++++++++
|
||||||
|
5 files changed, 48 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/agent/mibgroup/hardware/memory/memory_linux.c b/agent/mibgroup/hardware/memory/memory_linux.c
|
||||||
|
index 6d5e86cde..4ae235c2d 100644
|
||||||
|
--- a/agent/mibgroup/hardware/memory/memory_linux.c
|
||||||
|
+++ b/agent/mibgroup/hardware/memory/memory_linux.c
|
||||||
|
@@ -24,7 +24,8 @@ int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
|
||||||
|
static int first = 1;
|
||||||
|
ssize_t bytes_read;
|
||||||
|
char *b;
|
||||||
|
- unsigned long memtotal = 0, memfree = 0, memshared = 0,
|
||||||
|
+ int have_memavail = 0;
|
||||||
|
+ unsigned long memtotal = 0, memavail = 0, memfree = 0, memshared = 0,
|
||||||
|
buffers = 0, cached = 0, sreclaimable = 0,
|
||||||
|
swaptotal = 0, swapfree = 0;
|
||||||
|
|
||||||
|
@@ -81,6 +82,11 @@ int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
|
||||||
|
if (first)
|
||||||
|
snmp_log(LOG_ERR, "No MemTotal line in /proc/meminfo\n");
|
||||||
|
}
|
||||||
|
+ b = strstr(buff, "MemAvailable: ");
|
||||||
|
+ if (b) {
|
||||||
|
+ have_memavail = 1;
|
||||||
|
+ sscanf(b, "MemAvailable: %lu", &memavail);
|
||||||
|
+ }
|
||||||
|
b = strstr(buff, "MemFree: ");
|
||||||
|
if (b)
|
||||||
|
sscanf(b, "MemFree: %lu", &memfree);
|
||||||
|
@@ -151,6 +157,18 @@ int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
|
||||||
|
mem->other = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (have_memavail) {
|
||||||
|
+ mem = netsnmp_memory_get_byIdx(NETSNMP_MEM_TYPE_AVAILMEM, 1);
|
||||||
|
+ if (mem) {
|
||||||
|
+ if (!mem->descr)
|
||||||
|
+ mem->descr = strdup("Available memory");
|
||||||
|
+ mem->units = 1024;
|
||||||
|
+ mem->size = memavail;
|
||||||
|
+ mem->free = memavail;
|
||||||
|
+ mem->other = -1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_VIRTMEM, 1 );
|
||||||
|
if (!mem) {
|
||||||
|
snmp_log_perror("No Virtual Memory info entry");
|
||||||
|
diff --git a/agent/mibgroup/ucd-snmp/memory.c b/agent/mibgroup/ucd-snmp/memory.c
|
||||||
|
index 371a77e9a..158b28e67 100644
|
||||||
|
--- a/agent/mibgroup/ucd-snmp/memory.c
|
||||||
|
+++ b/agent/mibgroup/ucd-snmp/memory.c
|
||||||
|
@@ -26,7 +26,7 @@ init_memory(void)
|
||||||
|
netsnmp_create_handler_registration("memory", handle_memory,
|
||||||
|
memory_oid, OID_LENGTH(memory_oid),
|
||||||
|
HANDLER_CAN_RONLY),
|
||||||
|
- 1, 26);
|
||||||
|
+ 1, 27);
|
||||||
|
netsnmp_register_scalar(
|
||||||
|
netsnmp_create_handler_registration("memSwapError", handle_memory,
|
||||||
|
memSwapError_oid, OID_LENGTH(memSwapError_oid),
|
||||||
|
@@ -272,6 +272,16 @@ handle_memory(netsnmp_mib_handler *handler,
|
||||||
|
c64.low = val & 0xFFFFFFFF;
|
||||||
|
c64.high = val >>32;
|
||||||
|
break;
|
||||||
|
+ case MEMORY_SYS_AVAIL:
|
||||||
|
+ type = ASN_COUNTER64;
|
||||||
|
+ mem_info = netsnmp_memory_get_byIdx(NETSNMP_MEM_TYPE_AVAILMEM, 0);
|
||||||
|
+ if (!mem_info)
|
||||||
|
+ goto NOSUCH;
|
||||||
|
+ val = mem_info->size; /* memavail */
|
||||||
|
+ val *= (mem_info->units/1024);
|
||||||
|
+ c64.low = val & 0xFFFFFFFF;
|
||||||
|
+ c64.high = val >> 32;
|
||||||
|
+ break;
|
||||||
|
case MEMORY_SWAP_ERROR:
|
||||||
|
mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 0 );
|
||||||
|
if (!mem_info)
|
||||||
|
diff --git a/agent/mibgroup/ucd-snmp/memory.h b/agent/mibgroup/ucd-snmp/memory.h
|
||||||
|
index ded214022..54a56a2fd 100644
|
||||||
|
--- a/agent/mibgroup/ucd-snmp/memory.h
|
||||||
|
+++ b/agent/mibgroup/ucd-snmp/memory.h
|
||||||
|
@@ -41,6 +41,7 @@ Netsnmp_Node_Handler handle_memory;
|
||||||
|
#define MEMORY_SHARED_X 24
|
||||||
|
#define MEMORY_BUFFER_X 25
|
||||||
|
#define MEMORY_CACHED_X 26
|
||||||
|
+#define MEMORY_SYS_AVAIL 27
|
||||||
|
#define MEMORY_SWAP_ERROR 100
|
||||||
|
#define MEMORY_SWAP_ERRMSG 101
|
||||||
|
#endif /* MEMORY_H */
|
||||||
|
diff --git a/include/net-snmp/agent/hardware/memory.h b/include/net-snmp/agent/hardware/memory.h
|
||||||
|
index 54265cf22..aca3a4d00 100644
|
||||||
|
--- a/include/net-snmp/agent/hardware/memory.h
|
||||||
|
+++ b/include/net-snmp/agent/hardware/memory.h
|
||||||
|
@@ -10,6 +10,7 @@ typedef struct netsnmp_memory_info_s netsnmp_memory_info;
|
||||||
|
#define NETSNMP_MEM_TYPE_SHARED 8
|
||||||
|
#define NETSNMP_MEM_TYPE_SHARED2 9
|
||||||
|
#define NETSNMP_MEM_TYPE_SWAP 10
|
||||||
|
+#define NETSNMP_MEM_TYPE_AVAILMEM 11
|
||||||
|
/* Leave space for individual swap devices */
|
||||||
|
#define NETSNMP_MEM_TYPE_MAX 30
|
||||||
|
|
||||||
|
diff --git a/mibs/UCD-SNMP-MIB.txt b/mibs/UCD-SNMP-MIB.txt
|
||||||
|
index cde67feb5..d360bad02 100644
|
||||||
|
--- a/mibs/UCD-SNMP-MIB.txt
|
||||||
|
+++ b/mibs/UCD-SNMP-MIB.txt
|
||||||
|
@@ -746,6 +746,22 @@ memCachedX OBJECT-TYPE
|
||||||
|
memory as specifically reserved for this purpose."
|
||||||
|
::= { memory 26 }
|
||||||
|
|
||||||
|
+memSysAvail OBJECT-TYPE
|
||||||
|
+ SYNTAX CounterBasedGauge64
|
||||||
|
+ UNITS "kB"
|
||||||
|
+ MAX-ACCESS read-only
|
||||||
|
+ STATUS current
|
||||||
|
+ DESCRIPTION
|
||||||
|
+ "The total amount of available memory, which is an estimate
|
||||||
|
+ of how much memory is available for starting new applications,
|
||||||
|
+ without swapping.
|
||||||
|
+
|
||||||
|
+ This object will not be implemented on hosts where the
|
||||||
|
+ underlying operating system does not explicitly identify
|
||||||
|
+ memory as specifically reserved for this purpose."
|
||||||
|
+ ::= { memory 27 }
|
||||||
|
+
|
||||||
|
+
|
||||||
|
memSwapError OBJECT-TYPE
|
||||||
|
SYNTAX UCDErrorFlag
|
||||||
|
MAX-ACCESS read-only
|
||||||
|
|
36
net-snmp-5.9-cflags.patch
Normal file
36
net-snmp-5.9-cflags.patch
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
diff -urNp a/net-snmp-config.in b/net-snmp-config.in
|
||||||
|
--- a/net-snmp-config.in 2018-07-18 13:43:12.264426052 +0200
|
||||||
|
+++ b/net-snmp-config.in 2018-07-18 13:52:06.917089518 +0200
|
||||||
|
@@ -140,10 +140,10 @@ else
|
||||||
|
;;
|
||||||
|
#################################################### compile
|
||||||
|
--base-cflags)
|
||||||
|
- echo @CFLAGS@ @CPPFLAGS@ -I${NSC_INCLUDEDIR}
|
||||||
|
+ echo -I${NSC_INCLUDEDIR}
|
||||||
|
;;
|
||||||
|
--cflags|--cf*)
|
||||||
|
- echo @CFLAGS@ @DEVFLAGS@ @CPPFLAGS@ -I. -I${NSC_INCLUDEDIR}
|
||||||
|
+ echo @DEVFLAGS@ -I. -I${NSC_INCLUDEDIR}
|
||||||
|
;;
|
||||||
|
--srcdir)
|
||||||
|
echo $NSC_SRCDIR
|
||||||
|
diff -urNp a/perl/Makefile.PL b/perl/Makefile.PL
|
||||||
|
--- a/perl/Makefile.PL 2020-08-26 08:32:52.498909823 +0200
|
||||||
|
+++ b/perl/Makefile.PL 2020-08-26 09:30:45.584951552 +0200
|
||||||
|
@@ -1,3 +1,4 @@
|
||||||
|
+use lib '.';
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use ExtUtils::MakeMaker;
|
||||||
|
diff -urNp a/perl/MakefileSubs.pm b/perl/MakefileSubs.pm
|
||||||
|
--- a/perl/MakefileSubs.pm 2020-08-26 08:32:52.498909823 +0200
|
||||||
|
+++ b/perl/MakefileSubs.pm 2020-08-26 08:36:44.097218448 +0200
|
||||||
|
@@ -116,7 +116,7 @@ sub AddCommonParams {
|
||||||
|
append($Params->{'CCFLAGS'}, $cflags);
|
||||||
|
append($Params->{'CCFLAGS'}, $Config{'ccflags'});
|
||||||
|
# Suppress known Perl header shortcomings.
|
||||||
|
- $Params->{'CCFLAGS'} =~ s/ -W(cast-qual|write-strings)//g;
|
||||||
|
+ $Params->{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g;
|
||||||
|
append($Params->{'CCFLAGS'}, '-Wformat');
|
||||||
|
}
|
||||||
|
}
|
22
net-snmp-5.9-coverity.patch
Normal file
22
net-snmp-5.9-coverity.patch
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
diff --git a/agent/mibgroup/disman/event/mteTrigger.c b/agent/mibgroup/disman/event/mteTrigger.c
|
||||||
|
index e9a8831..5a1d8e7 100644
|
||||||
|
--- a/agent/mibgroup/disman/event/mteTrigger.c
|
||||||
|
+++ b/agent/mibgroup/disman/event/mteTrigger.c
|
||||||
|
@@ -1012,7 +1012,7 @@ mteTrigger_run( unsigned int reg, void *clientarg)
|
||||||
|
* Similarly, if no fallEvent is configured,
|
||||||
|
* there's no point in trying to fire it either.
|
||||||
|
*/
|
||||||
|
- if (entry->mteTThRiseEvent[0] != '\0' ) {
|
||||||
|
+ if (entry->mteTThFallEvent[0] != '\0' ) {
|
||||||
|
entry->mteTriggerXOwner = entry->mteTThObjOwner;
|
||||||
|
entry->mteTriggerXObjects = entry->mteTThObjects;
|
||||||
|
entry->mteTriggerFired = vp1;
|
||||||
|
@@ -1105,7 +1105,7 @@ mteTrigger_run( unsigned int reg, void *clientarg)
|
||||||
|
* Similarly, if no fallEvent is configured,
|
||||||
|
* there's no point in trying to fire it either.
|
||||||
|
*/
|
||||||
|
- if (entry->mteTThDRiseEvent[0] != '\0' ) {
|
||||||
|
+ if (entry->mteTThDFallEvent[0] != '\0' ) {
|
||||||
|
entry->mteTriggerXOwner = entry->mteTThObjOwner;
|
||||||
|
entry->mteTriggerXObjects = entry->mteTThObjects;
|
||||||
|
entry->mteTriggerFired = vp1;
|
24
net-snmp-5.9-dir-fix.patch
Normal file
24
net-snmp-5.9-dir-fix.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
diff --git a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in
|
||||||
|
index 452c269..afd6fa4 100644
|
||||||
|
--- a/net-snmp-create-v3-user.in
|
||||||
|
+++ b/net-snmp-create-v3-user.in
|
||||||
|
@@ -16,6 +16,10 @@ Xalgorithm="DES"
|
||||||
|
token=rwuser
|
||||||
|
|
||||||
|
while test "x$done" = "x" -a "x$1" != "x" -a "x$usage" != "xyes"; do
|
||||||
|
+case "$1" in
|
||||||
|
+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||||
|
+ *) optarg= ;;
|
||||||
|
+esac
|
||||||
|
|
||||||
|
unset shifted
|
||||||
|
case $1 in
|
||||||
|
@@ -134,7 +138,7 @@ echo $line >> $outfile
|
||||||
|
prefix="@prefix@"
|
||||||
|
# Avoid that configure complains that this script ignores @datarootdir@
|
||||||
|
echo "@datarootdir@" >/dev/null
|
||||||
|
-outfile="@datadir@/snmp/snmpd.conf"
|
||||||
|
+outfile="/etc/snmp/snmpd.conf"
|
||||||
|
line="$token $user"
|
||||||
|
echo "adding the following line to $outfile:"
|
||||||
|
echo " " $line
|
182
net-snmp-5.9-dskTable-dynamic.patch
Normal file
182
net-snmp-5.9-dskTable-dynamic.patch
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
diff --git a/agent/mibgroup/ucd-snmp/disk.c b/agent/mibgroup/ucd-snmp/disk.c
|
||||||
|
index 5206235..5e98476 100644
|
||||||
|
--- a/agent/mibgroup/ucd-snmp/disk.c
|
||||||
|
+++ b/agent/mibgroup/ucd-snmp/disk.c
|
||||||
|
@@ -153,9 +153,10 @@ static void disk_free_config(void);
|
||||||
|
static void disk_parse_config(const char *, char *);
|
||||||
|
static void disk_parse_config_all(const char *, char *);
|
||||||
|
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
|
||||||
|
-static void find_and_add_allDisks(int minpercent);
|
||||||
|
+static void refresh_disk_table(int addNewDisks, int minpercent);
|
||||||
|
static void add_device(char *path, char *device,
|
||||||
|
- int minspace, int minpercent, int override);
|
||||||
|
+ int minspace, int minpercent, int addNewDisks,
|
||||||
|
+ int override);
|
||||||
|
static void modify_disk_parameters(int index, int minspace,
|
||||||
|
int minpercent);
|
||||||
|
static int disk_exists(char *path);
|
||||||
|
@@ -167,6 +168,7 @@ struct diskpart {
|
||||||
|
char path[STRMAX];
|
||||||
|
int minimumspace;
|
||||||
|
int minpercent;
|
||||||
|
+ int alive;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAX_INT_32 0x7fffffff
|
||||||
|
@@ -174,6 +176,7 @@ struct diskpart {
|
||||||
|
|
||||||
|
unsigned int numdisks;
|
||||||
|
int allDisksIncluded = 0;
|
||||||
|
+int allDisksMinPercent = 0;
|
||||||
|
unsigned int maxdisks = 0;
|
||||||
|
struct diskpart *disks;
|
||||||
|
|
||||||
|
@@ -238,6 +241,7 @@ init_disk(void)
|
||||||
|
disk_free_config,
|
||||||
|
"minpercent%");
|
||||||
|
allDisksIncluded = 0;
|
||||||
|
+ allDisksMinPercent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -253,6 +257,7 @@ disk_free_config(void)
|
||||||
|
disks[i].minpercent = -1;
|
||||||
|
}
|
||||||
|
allDisksIncluded = 0;
|
||||||
|
+ allDisksMinPercent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -313,7 +318,7 @@ disk_parse_config(const char *token, char *cptr)
|
||||||
|
* check if the disk already exists, if so then modify its
|
||||||
|
* parameters. if it does not exist then add it
|
||||||
|
*/
|
||||||
|
- add_device(path, find_device(path), minspace, minpercent, 1);
|
||||||
|
+ add_device(path, find_device(path), minspace, minpercent, 1, 1);
|
||||||
|
#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -372,7 +377,7 @@ disk_parse_config_all(const char *token, char *cptr)
|
||||||
|
|
||||||
|
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
|
||||||
|
static void
|
||||||
|
-add_device(char *path, char *device, int minspace, int minpercent, int override)
|
||||||
|
+add_device(char *path, char *device, int minspace, int minpercent, int addNewDisks, int override)
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
@@ -402,10 +407,16 @@ add_device(char *path, char *device, int minspace, int minpercent, int override)
|
||||||
|
}
|
||||||
|
|
||||||
|
index = disk_exists(path);
|
||||||
|
- if((index != -1) && (index < maxdisks) && (override==1)) {
|
||||||
|
- modify_disk_parameters(index, minspace, minpercent);
|
||||||
|
+ if((index != -1) && (index < maxdisks)) {
|
||||||
|
+ /* the path is already in the table */
|
||||||
|
+ disks[index].alive = 1;
|
||||||
|
+ /* -> update its device */
|
||||||
|
+ strlcpy(disks[index].device, device, sizeof(disks[index].device));
|
||||||
|
+ if (override == 1) {
|
||||||
|
+ modify_disk_parameters(index, minspace, minpercent);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
- else if(index == -1){
|
||||||
|
+ else if(index == -1 && addNewDisks){
|
||||||
|
/* add if and only if the device was found */
|
||||||
|
if(device[0] != 0) {
|
||||||
|
/* The following buffers are cleared above, no need to add '\0' */
|
||||||
|
@@ -413,6 +424,7 @@ add_device(char *path, char *device, int minspace, int minpercent, int override)
|
||||||
|
strlcpy(disks[numdisks].device, device, sizeof(disks[numdisks].device));
|
||||||
|
disks[numdisks].minimumspace = minspace;
|
||||||
|
disks[numdisks].minpercent = minpercent;
|
||||||
|
+ disks[numdisks].alive = 1;
|
||||||
|
numdisks++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
@@ -420,6 +432,7 @@ add_device(char *path, char *device, int minspace, int minpercent, int override)
|
||||||
|
disks[numdisks].minpercent = -1;
|
||||||
|
disks[numdisks].path[0] = 0;
|
||||||
|
disks[numdisks].device[0] = 0;
|
||||||
|
+ disks[numdisks].alive = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -444,7 +457,7 @@ int disk_exists(char *path)
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
-find_and_add_allDisks(int minpercent)
|
||||||
|
+refresh_disk_table(int addNewDisks, int minpercent)
|
||||||
|
{
|
||||||
|
#if HAVE_GETMNTENT
|
||||||
|
#if HAVE_SYS_MNTTAB_H
|
||||||
|
@@ -480,7 +493,7 @@ find_and_add_allDisks(int minpercent)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while (mntfp && NULL != (mntent = getmntent(mntfp))) {
|
||||||
|
- add_device(mntent->mnt_dir, mntent->mnt_fsname, -1, minpercent, 0);
|
||||||
|
+ add_device(mntent->mnt_dir, mntent->mnt_fsname, -1, minpercent, addNewDisks, 0);
|
||||||
|
dummy = 1;
|
||||||
|
}
|
||||||
|
if (mntfp)
|
||||||
|
@@ -497,7 +510,7 @@ find_and_add_allDisks(int minpercent)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while ((i = getmntent(mntfp, &mnttab)) == 0) {
|
||||||
|
- add_device(mnttab.mnt_mountp, mnttab.mnt_special, -1, minpercent, 0);
|
||||||
|
+ add_device(mnttab.mnt_mountp, mnttab.mnt_special, -1, minpercent, addNewDisks, 0);
|
||||||
|
dummy = 1;
|
||||||
|
}
|
||||||
|
fclose(mntfp);
|
||||||
|
@@ -510,7 +523,7 @@ find_and_add_allDisks(int minpercent)
|
||||||
|
#elif HAVE_FSTAB_H
|
||||||
|
setfsent(); /* open /etc/fstab */
|
||||||
|
while((fstab1 = getfsent()) != NULL) {
|
||||||
|
- add_device(fstab1->fs_file, fstab1->fs_spec, -1, minpercent, 0);
|
||||||
|
+ add_device(fstab1->fs_file, fstab1->fs_spec, -1, minpercent, addNewDisks, 0);
|
||||||
|
dummy = 1;
|
||||||
|
}
|
||||||
|
endfsent(); /* close /etc/fstab */
|
||||||
|
@@ -521,7 +534,7 @@ find_and_add_allDisks(int minpercent)
|
||||||
|
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
|
||||||
|
for (i = 0; i < mntsize; i++) {
|
||||||
|
if (strncmp(mntbuf[i].f_fstypename, "zfs", 3) == 0) {
|
||||||
|
- add_device(mntbuf[i].f_mntonname, mntbuf[i].f_mntfromname, -1, minpercent, 0);
|
||||||
|
+ add_device(mntbuf[i].f_mntonname, mntbuf[i].f_mntfromname, -1, minpercent, addNewDisks, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -537,7 +550,7 @@ find_and_add_allDisks(int minpercent)
|
||||||
|
* statfs we default to the root partition "/"
|
||||||
|
*/
|
||||||
|
if (statfs("/", &statf) == 0) {
|
||||||
|
- add_device("/", statf.f_mntfromname, -1, minpercent, 0);
|
||||||
|
+ add_device("/", statf.f_mntfromname, -1, minpercent, addNewDisks, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else {
|
||||||
|
@@ -696,6 +709,10 @@ fill_dsk_entry(int disknum, struct dsk_entry *entry)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+ if (disks[disknum].alive == 0){
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
entry->dskPercentInode = -1;
|
||||||
|
|
||||||
|
#if defined(HAVE_STATVFS) || defined(HAVE_STATFS)
|
||||||
|
@@ -827,6 +844,13 @@ var_extensible_disk(struct variable *vp,
|
||||||
|
static char *errmsg;
|
||||||
|
static char empty_str[1];
|
||||||
|
|
||||||
|
+ int i;
|
||||||
|
+ for (i = 0; i < numdisks; i++){
|
||||||
|
+ disks[i].alive = 0;
|
||||||
|
+ }
|
||||||
|
+ /* dynamically add new disks + update alive flag */
|
||||||
|
+ refresh_disk_table(allDisksIncluded, allDisksMinPercent);
|
||||||
|
+
|
||||||
|
tryAgain:
|
||||||
|
if (header_simple_table
|
||||||
|
(vp, name, length, exact, var_len, write_method, numdisks))
|
13
net-snmp-5.9-libnetsnmptrapd-against-MYSQL_LIBS.patch
Normal file
13
net-snmp-5.9-libnetsnmptrapd-against-MYSQL_LIBS.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/apps/Makefile.in b/apps/Makefile.in
|
||||||
|
index d4529d3..175242b 100644
|
||||||
|
--- a/apps/Makefile.in
|
||||||
|
+++ b/apps/Makefile.in
|
||||||
|
@@ -237,7 +237,7 @@ snmppcap$(EXEEXT): snmppcap.$(OSUFFIX) $(USELIBS)
|
||||||
|
$(LINK) ${CFLAGS} -o $@ snmppcap.$(OSUFFIX) ${LDFLAGS} ${LIBS} -lpcap
|
||||||
|
|
||||||
|
libnetsnmptrapd.$(LIB_EXTENSION)$(LIB_VERSION): $(LLIBTRAPD_OBJS)
|
||||||
|
- $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LDFLAGS)
|
||||||
|
+ $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(MYSQL_LIBS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
snmpinforminstall:
|
28
net-snmp-5.9-memory-reporting.patch
Normal file
28
net-snmp-5.9-memory-reporting.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
diff --git a/agent/mibgroup/hardware/memory/memory_linux.c b/agent/mibgroup/hardware/memory/memory_linux.c
|
||||||
|
index 6d5e86c..68b55d2 100644
|
||||||
|
--- a/agent/mibgroup/hardware/memory/memory_linux.c
|
||||||
|
+++ b/agent/mibgroup/hardware/memory/memory_linux.c
|
||||||
|
@@ -123,6 +123,13 @@ int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
|
||||||
|
if (first)
|
||||||
|
snmp_log(LOG_ERR, "No SwapTotal line in /proc/meminfo\n");
|
||||||
|
}
|
||||||
|
+ b = strstr(buff, "SReclaimable: ");
|
||||||
|
+ if (b)
|
||||||
|
+ sscanf(b, "SReclaimable: %lu", &sreclaimable);
|
||||||
|
+ else {
|
||||||
|
+ if (first)
|
||||||
|
+ snmp_log(LOG_ERR, "No SReclaimable line in /proc/meminfo\n");
|
||||||
|
+ }
|
||||||
|
b = strstr(buff, "SwapFree: ");
|
||||||
|
if (b)
|
||||||
|
sscanf(b, "SwapFree: %lu", &swapfree);
|
||||||
|
@@ -130,9 +137,6 @@ int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
|
||||||
|
if (first)
|
||||||
|
snmp_log(LOG_ERR, "No SwapFree line in /proc/meminfo\n");
|
||||||
|
}
|
||||||
|
- b = strstr(buff, "SReclaimable: ");
|
||||||
|
- if (b)
|
||||||
|
- sscanf(b, "SReclaimable: %lu", &sreclaimable);
|
||||||
|
first = 0;
|
||||||
|
|
||||||
|
|
48
net-snmp-5.9-multilib.patch
Normal file
48
net-snmp-5.9-multilib.patch
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
diff --git a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def
|
||||||
|
index 90b20d9..bd5abe1 100644
|
||||||
|
--- a/man/netsnmp_config_api.3.def
|
||||||
|
+++ b/man/netsnmp_config_api.3.def
|
||||||
|
@@ -295,7 +295,7 @@ for one particular machine.
|
||||||
|
.PP
|
||||||
|
The default list of directories to search is \fC SYSCONFDIR/snmp\fP,
|
||||||
|
followed by \fC DATADIR/snmp\fP,
|
||||||
|
-followed by \fC LIBDIR/snmp\fP,
|
||||||
|
+followed by \fC /usr/lib(64)/snmp\fP,
|
||||||
|
followed by \fC $HOME/.snmp\fP.
|
||||||
|
This list can be changed by setting the environmental variable
|
||||||
|
.I SNMPCONFPATH
|
||||||
|
@@ -367,7 +367,7 @@ A colon separated list of directories to search for configuration
|
||||||
|
files in.
|
||||||
|
Default:
|
||||||
|
.br
|
||||||
|
-SYSCONFDIR/snmp:\:DATADIR/snmp:\:LIBDIR/snmp:\:$HOME/.snmp
|
||||||
|
+SYSCONFDIR/snmp:\:DATADIR/snmp:\:/usr/lib(64)/snmp:\:$HOME/.snmp
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
netsnmp_mib_api(3), snmp_api(3)
|
||||||
|
.\" Local Variables:
|
||||||
|
diff --git a/man/snmp_config.5.def b/man/snmp_config.5.def
|
||||||
|
index fd30873..c3437d6 100644
|
||||||
|
--- a/man/snmp_config.5.def
|
||||||
|
+++ b/man/snmp_config.5.def
|
||||||
|
@@ -10,7 +10,7 @@ First off, there are numerous places that configuration files can be
|
||||||
|
found and read from. By default, the applications look for
|
||||||
|
configuration files in the following 4 directories, in order:
|
||||||
|
SYSCONFDIR/snmp,
|
||||||
|
-DATADIR/snmp, LIBDIR/snmp, and $HOME/.snmp. In each of these
|
||||||
|
+DATADIR/snmp, /usr/lib(64)/snmp, and $HOME/.snmp. In each of these
|
||||||
|
directories, it looks for files snmp.conf, snmpd.conf and/or
|
||||||
|
snmptrapd.conf, as well as snmp.local.conf, snmpd.local.conf
|
||||||
|
and/or snmptrapd.local.conf. *.local.conf are always
|
||||||
|
diff --git a/man/snmpd.conf.5.def b/man/snmpd.conf.5.def
|
||||||
|
index 7ce8a46..a4000f9 100644
|
||||||
|
--- a/man/snmpd.conf.5.def
|
||||||
|
+++ b/man/snmpd.conf.5.def
|
||||||
|
@@ -1593,7 +1593,7 @@ filename), and call the initialisation routine \fIinit_NAME\fR.
|
||||||
|
.RS
|
||||||
|
.IP "Note:"
|
||||||
|
If the specified PATH is not a fully qualified filename, it will
|
||||||
|
-be interpreted relative to LIBDIR/snmp/dlmod, and \fC.so\fR
|
||||||
|
+be interpreted relative to /usr/lib(64)/snmp/dlmod, and \fC.so\fR
|
||||||
|
will be appended to the filename.
|
||||||
|
.RE
|
||||||
|
.PP
|
26
net-snmp-5.9-pie.patch
Normal file
26
net-snmp-5.9-pie.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
diff --git a/agent/Makefile.in b/agent/Makefile.in
|
||||||
|
index b5d692d..1a30209 100644
|
||||||
|
--- a/agent/Makefile.in
|
||||||
|
+++ b/agent/Makefile.in
|
||||||
|
@@ -297,7 +297,7 @@ getmibstat.o: mibgroup/kernel_sunos5.c
|
||||||
|
$(CC) $(CFLAGS) -o $@ -D_GETMIBSTAT_TEST -DDODEBUG -c $?
|
||||||
|
|
||||||
|
snmpd$(EXEEXT): ${LAGENTOBJS} $(USELIBS) $(AGENTLIB) $(HELPERLIB) $(MIBLIB) $(LIBTARG)
|
||||||
|
- $(LINK) $(CFLAGS) -o $@ ${LAGENTOBJS} ${LDFLAGS} ${OUR_AGENT_LIBS}
|
||||||
|
+ $(LINK) $(CFLAGS) -o $@ -pie ${LAGENTOBJS} ${LDFLAGS} ${OUR_AGENT_LIBS}
|
||||||
|
|
||||||
|
libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION): ${LLIBAGENTOBJS} $(USELIBS)
|
||||||
|
$(LIB_LD_CMD) $(AGENTLIB) ${LLIBAGENTOBJS} $(USELIBS) ${LAGENTLIBS} @LD_NO_UNDEFINED@ $(LDFLAGS) $(PERLLDOPTS_FOR_LIBS) @AGENTLIBS@
|
||||||
|
diff --git a/apps/Makefile.in b/apps/Makefile.in
|
||||||
|
index 43f3b9c..d4529d3 100644
|
||||||
|
--- a/apps/Makefile.in
|
||||||
|
+++ b/apps/Makefile.in
|
||||||
|
@@ -190,7 +190,7 @@ snmptest$(EXEEXT): snmptest.$(OSUFFIX) $(USELIBS)
|
||||||
|
$(LINK) ${CFLAGS} -o $@ snmptest.$(OSUFFIX) ${LDFLAGS} ${LIBS}
|
||||||
|
|
||||||
|
snmptrapd$(EXEEXT): $(TRAPD_OBJECTS) $(USETRAPLIBS) $(INSTALLLIBS)
|
||||||
|
- $(LINK) ${CFLAGS} -o $@ $(TRAPD_OBJECTS) $(INSTALLLIBS) ${LDFLAGS} ${TRAPLIBS}
|
||||||
|
+ $(LINK) ${CFLAGS} -o $@ -pie $(TRAPD_OBJECTS) $(INSTALLLIBS) ${LDFLAGS} ${TRAPLIBS}
|
||||||
|
|
||||||
|
snmptrap$(EXEEXT): snmptrap.$(OSUFFIX) $(USELIBS)
|
||||||
|
$(LINK) ${CFLAGS} -o $@ snmptrap.$(OSUFFIX) ${LDFLAGS} ${LIBS}
|
13
net-snmp-5.9-proxy-getnext.patch
Normal file
13
net-snmp-5.9-proxy-getnext.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/agent/mibgroup/ucd-snmp/proxy.c b/agent/mibgroup/ucd-snmp/proxy.c
|
||||||
|
index e0ee96b..8abe7a3 100644
|
||||||
|
--- a/agent/mibgroup/ucd-snmp/proxy.c
|
||||||
|
+++ b/agent/mibgroup/ucd-snmp/proxy.c
|
||||||
|
@@ -463,7 +463,7 @@ proxy_handler(netsnmp_mib_handler *handler,
|
||||||
|
if (sp->base_len &&
|
||||||
|
reqinfo->mode == MODE_GETNEXT &&
|
||||||
|
(snmp_oid_compare(ourname, ourlength,
|
||||||
|
- sp->base, sp->base_len) < 0)) {
|
||||||
|
+ sp->name, sp->name_len) < 0)) {
|
||||||
|
DEBUGMSGTL(( "proxy", "request is out of registered range\n"));
|
||||||
|
/*
|
||||||
|
* Create GETNEXT request with an OID so the
|
21
net-snmp-5.9-python-ld-flags.patch
Normal file
21
net-snmp-5.9-python-ld-flags.patch
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
diff --git a/python/setup.py b/python/setup.py
|
||||||
|
index 2547842..0c68cd8 100644
|
||||||
|
--- a/python/setup.py
|
||||||
|
+++ b/python/setup.py
|
||||||
|
@@ -17,14 +17,14 @@ if intree:
|
||||||
|
netsnmp_libs = os.popen(basedir+'/net-snmp-config --libs').read()
|
||||||
|
libdir = os.popen(basedir+'/net-snmp-config --build-lib-dirs '+basedir).read()
|
||||||
|
incdir = os.popen(basedir+'/net-snmp-config --build-includes '+basedir).read() + " " + os.popen(basedir+'/net-snmp-config --base-cflags '+basedir).read()
|
||||||
|
- libs = re.findall(r"-l(\S+)", netsnmp_libs)
|
||||||
|
+ libs = re.findall(r"\s-l(\S+)", netsnmp_libs)
|
||||||
|
libdirs = re.findall(r"-L(\S+)", libdir)
|
||||||
|
incdirs = re.findall(r"-I(\S+)", incdir)
|
||||||
|
else:
|
||||||
|
netsnmp_libs = os.popen('net-snmp-config --libs').read()
|
||||||
|
libdirs = re.findall(r"-L(\S+)", netsnmp_libs)
|
||||||
|
incdirs = []
|
||||||
|
- libs = re.findall(r"-l(\S+)", netsnmp_libs)
|
||||||
|
+ libs = re.findall(r"\s-l(\S+)", netsnmp_libs)
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="netsnmp-python", version="1.0a1",
|
38
net-snmp-5.9-python3.patch
Normal file
38
net-snmp-5.9-python3.patch
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
diff --git a/Makefile.in b/Makefile.in
|
||||||
|
index 912f6b2..862fb5f 100644
|
||||||
|
--- a/Makefile.in
|
||||||
|
+++ b/Makefile.in
|
||||||
|
@@ -227,7 +227,7 @@ perlcleanfeatures:
|
||||||
|
|
||||||
|
# python specific build rules
|
||||||
|
#
|
||||||
|
-PYMAKE=$(PYTHON) setup.py $(PYTHONARGS)
|
||||||
|
+PYMAKE=/usr/bin/python3 setup.py $(PYTHONARGS)
|
||||||
|
pythonmodules: subdirs
|
||||||
|
@(dir=`pwd`; cd python; $(PYMAKE) build --basedir=$$dir) ; \
|
||||||
|
if test $$? != 0 ; then \
|
||||||
|
diff --git a/python/netsnmp/client.py b/python/netsnmp/client.py
|
||||||
|
index daf11a4..3a30a64 100644
|
||||||
|
--- a/python/netsnmp/client.py
|
||||||
|
+++ b/python/netsnmp/client.py
|
||||||
|
@@ -56,7 +56,7 @@ class Varbind(object):
|
||||||
|
def __init__(self, tag=None, iid=None, val=None, type_arg=None):
|
||||||
|
self.tag = STR(tag)
|
||||||
|
self.iid = STR(iid)
|
||||||
|
- self.val = STR(val)
|
||||||
|
+ self.val = val
|
||||||
|
self.type = STR(type_arg)
|
||||||
|
# parse iid out of tag if needed
|
||||||
|
if iid is None and tag is not None:
|
||||||
|
@@ -66,7 +66,10 @@ class Varbind(object):
|
||||||
|
(self.tag, self.iid) = match.group(1, 2)
|
||||||
|
|
||||||
|
def __setattr__(self, name, val):
|
||||||
|
- self.__dict__[name] = STR(val)
|
||||||
|
+ if name == 'val':
|
||||||
|
+ self.__dict__[name] = val
|
||||||
|
+ else:
|
||||||
|
+ self.__dict__[name] = STR(val)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return obj_to_str(self)
|
110
net-snmp-5.9-test-debug.patch
Normal file
110
net-snmp-5.9-test-debug.patch
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
diff --git a/testing/fulltests/default/T070com2sec_simple b/testing/fulltests/default/T070com2sec_simple
|
||||||
|
index 6c07f74..7df0b51 100644
|
||||||
|
--- a/testing/fulltests/default/T070com2sec_simple
|
||||||
|
+++ b/testing/fulltests/default/T070com2sec_simple
|
||||||
|
@@ -134,34 +134,30 @@ SAVECHECKAGENT '<"c406a", 255.255.255.255/255.255.255.255> => "t406a"'
|
||||||
|
SAVECHECKAGENT 'line 30: Error:' # msg from h_strerror so it varies
|
||||||
|
SAVECHECKAGENT 'line 31: Error:' # msg from h_strerror so it varies
|
||||||
|
|
||||||
|
-if false; then
|
||||||
|
- # The two tests below have been disabled because these rely on resolving a
|
||||||
|
- # domain name into a local IP address. Such DNS replies are filtered out by
|
||||||
|
- # many security devices because to avoid DNS rebinding attacks. See also
|
||||||
|
- # https://en.wikipedia.org/wiki/DNS_rebinding.
|
||||||
|
-
|
||||||
|
- CHECKAGENT '<"c408a"'
|
||||||
|
- if [ "$snmp_last_test_result" -eq 0 ] ; then
|
||||||
|
- CHECKAGENT 'line 32: Error:'
|
||||||
|
- if [ "$snmp_last_test_result" -ne 1 ] ; then
|
||||||
|
- return_value=1
|
||||||
|
- FINISHED
|
||||||
|
- fi
|
||||||
|
- elif [ "$snmp_last_test_result" -ne 1 ] ; then
|
||||||
|
+FINISHED
|
||||||
|
+
|
||||||
|
+# don't test the rest, it depends on DNS, which is not available in Koji
|
||||||
|
+
|
||||||
|
+CHECKAGENT '<"c408a"'
|
||||||
|
+if [ "$snmp_last_test_result" -eq 0 ] ; then
|
||||||
|
+ CHECKAGENT 'line 32: Error:'
|
||||||
|
+ if [ "$snmp_last_test_result" -ne 1 ] ; then
|
||||||
|
return_value=1
|
||||||
|
FINISHED
|
||||||
|
fi
|
||||||
|
+elif [ "$snmp_last_test_result" -ne 1 ] ; then
|
||||||
|
+ return_value=1
|
||||||
|
+ FINISHED
|
||||||
|
+fi
|
||||||
|
|
||||||
|
- CHECKAGENT '<"c408b"'
|
||||||
|
- if [ "$snmp_last_test_result" -eq 0 ] ; then
|
||||||
|
- CHECKAGENT 'line 33: Error:'
|
||||||
|
- if [ "$snmp_last_test_result" -ne 1 ] ; then
|
||||||
|
- return_value=1
|
||||||
|
- fi
|
||||||
|
- elif [ "$snmp_last_test_result" -ne 1 ] ; then
|
||||||
|
+CHECKAGENT '<"c408b"'
|
||||||
|
+if [ "$snmp_last_test_result" -eq 0 ] ; then
|
||||||
|
+ CHECKAGENT 'line 33: Error:'
|
||||||
|
+ if [ "$snmp_last_test_result" -ne 1 ] ; then
|
||||||
|
return_value=1
|
||||||
|
fi
|
||||||
|
-
|
||||||
|
+elif [ "$snmp_last_test_result" -ne 1 ] ; then
|
||||||
|
+ return_value=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
FINISHED
|
||||||
|
diff --git a/testing/fulltests/default/T071com2sec6_simple b/testing/fulltests/default/T071com2sec6_simple
|
||||||
|
index 76da70b..bc2d432 100644
|
||||||
|
--- a/testing/fulltests/default/T071com2sec6_simple
|
||||||
|
+++ b/testing/fulltests/default/T071com2sec6_simple
|
||||||
|
@@ -132,30 +132,27 @@ SAVECHECKAGENT '<"c606a", ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/ffff:ffff:ffff
|
||||||
|
SAVECHECKAGENT 'line 27: Error:'
|
||||||
|
SAVECHECKAGENT 'line 28: Error:'
|
||||||
|
|
||||||
|
-if false; then
|
||||||
|
- # The two tests below have been disabled because these rely on resolving a
|
||||||
|
- # domain name into a local IP address. Such DNS replies are filtered out by
|
||||||
|
- # many security devices because to avoid DNS rebinding attacks. See also
|
||||||
|
- # https://en.wikipedia.org/wiki/DNS_rebinding.
|
||||||
|
-
|
||||||
|
- # 608
|
||||||
|
- CHECKAGENT '<"c608a"'
|
||||||
|
- if [ "$snmp_last_test_result" -eq 0 ] ; then
|
||||||
|
- CHECKAGENT 'line 29: Error:'
|
||||||
|
- errnum=`expr $errnum - 1`
|
||||||
|
- if [ "$snmp_last_test_result" -ne 1 ] ; then
|
||||||
|
- FINISHED
|
||||||
|
- fi
|
||||||
|
- elif [ "$snmp_last_test_result" -ne 1 ] ; then
|
||||||
|
+FINISHED
|
||||||
|
+
|
||||||
|
+# don't test the rest, it depends on DNS, which is not available in Koji
|
||||||
|
+
|
||||||
|
+# 608
|
||||||
|
+CHECKAGENT '<"c608a"'
|
||||||
|
+if [ "$snmp_last_test_result" -eq 0 ] ; then
|
||||||
|
+ CHECKAGENT 'line 29: Error:'
|
||||||
|
+ errnum=`expr $errnum - 1`
|
||||||
|
+ if [ "$snmp_last_test_result" -ne 1 ] ; then
|
||||||
|
FINISHED
|
||||||
|
fi
|
||||||
|
+elif [ "$snmp_last_test_result" -ne 1 ] ; then
|
||||||
|
+ FINISHED
|
||||||
|
+fi
|
||||||
|
|
||||||
|
- CHECKAGENTCOUNT atleastone '<"c608b"'
|
||||||
|
- if [ "$snmp_last_test_result" -eq 0 ] ; then
|
||||||
|
- CHECKAGENT 'line 30: Error:'
|
||||||
|
- if [ "$snmp_last_test_result" -eq 1 ] ; then
|
||||||
|
- errnum=`expr $errnum - 1`
|
||||||
|
- fi
|
||||||
|
+CHECKAGENTCOUNT atleastone '<"c608b"'
|
||||||
|
+if [ "$snmp_last_test_result" -eq 0 ] ; then
|
||||||
|
+ CHECKAGENT 'line 30: Error:'
|
||||||
|
+ if [ "$snmp_last_test_result" -eq 1 ] ; then
|
||||||
|
+ errnum=`expr $errnum - 1`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
12
net-snmp-5.9-usage-exit.patch
Normal file
12
net-snmp-5.9-usage-exit.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff --git a/agent/snmpd.c b/agent/snmpd.c
|
||||||
|
index ae73eda..f01b890 100644
|
||||||
|
--- a/agent/snmpd.c
|
||||||
|
+++ b/agent/snmpd.c
|
||||||
|
@@ -289,6 +289,7 @@ usage(char *prog)
|
||||||
|
" -S d|i|0-7\t\tuse -Ls <facility> instead\n"
|
||||||
|
"\n"
|
||||||
|
);
|
||||||
|
+ exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
62
net-snmp-config
Executable file
62
net-snmp-config
Executable file
@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# net-snmp-config
|
||||||
|
#
|
||||||
|
# this shell script is designed to merely dump the configuration
|
||||||
|
# information about how the net-snmp package was compiled. The
|
||||||
|
# information is particularily useful for applications that need to
|
||||||
|
# link against the net-snmp libraries and hence must know about any
|
||||||
|
# other libraries that must be linked in as well.
|
||||||
|
|
||||||
|
# this particular shell script calls arch specific script to avoid
|
||||||
|
# multilib conflicts
|
||||||
|
|
||||||
|
# Supported arches ix86 ia64 ppc ppc64 s390 s390x x86_64 alpha sparc sparc64
|
||||||
|
|
||||||
|
arch=`arch`
|
||||||
|
echo $arch | grep -q i.86
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
net-snmp-config-i386 "$@"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$arch" = "ia64" ] ; then
|
||||||
|
net-snmp-config-ia64 "$@"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$arch" = "ppc" ] ; then
|
||||||
|
net-snmp-config-ppc "$@"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$arch" = "ppc64" ] ; then
|
||||||
|
net-snmp-config-ppc64 "$@"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$arch" = "s390" ] ; then
|
||||||
|
net-snmp-config-s390 "$@"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$arch" = "s390x" ] ; then
|
||||||
|
net-snmp-config-s390x "$@"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$arch" = "x86_64" ] ; then
|
||||||
|
net-snmp-config-x86_64 "$@"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$arch" = "alpha" ] ; then
|
||||||
|
net-snmp-config-alpha "$@"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$arch" = "sparc" ] ; then
|
||||||
|
net-snmp-config-sparc "$@"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$arch" = "sparc64" ] ; then
|
||||||
|
net-snmp-config-sparc64 "$@"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$arch" = "aarch64" ] ; then
|
||||||
|
net-snmp-config-aarch64 "$@"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "Cannot determine architecture"
|
38
net-snmp-config.h
Normal file
38
net-snmp-config.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/* This file is here to prevent a file conflict on multiarch systems. A
|
||||||
|
* conflict will frequently occur because arch-specific build-time
|
||||||
|
* configuration options are stored (and used, so they can't just be stripped
|
||||||
|
* out) in net-snmp-config.h. The original net-snmp-config.h has been renamed.
|
||||||
|
* DO NOT INCLUDE THE NEW FILE DIRECTLY -- ALWAYS INCLUDE THIS ONE INSTEAD. */
|
||||||
|
|
||||||
|
#ifdef net_snmp_config_multilib_redirection_h
|
||||||
|
#error "Do not define net_snmp_config_multilib_redirection_h!"
|
||||||
|
#endif
|
||||||
|
#define net_snmp_config_multilib_redirection_h
|
||||||
|
|
||||||
|
#if defined(__i386__)
|
||||||
|
#include "net-snmp-config-i386.h"
|
||||||
|
#elif defined(__ia64__)
|
||||||
|
#include "net-snmp-config-ia64.h"
|
||||||
|
#elif defined(__powerpc64__)
|
||||||
|
#include "net-snmp-config-ppc64.h"
|
||||||
|
#elif defined(__powerpc__)
|
||||||
|
#include "net-snmp-config-ppc.h"
|
||||||
|
#elif defined(__s390x__)
|
||||||
|
#include "net-snmp-config-s390x.h"
|
||||||
|
#elif defined(__s390__)
|
||||||
|
#include "net-snmp-config-s390.h"
|
||||||
|
#elif defined(__x86_64__)
|
||||||
|
#include "net-snmp-config-x86_64.h"
|
||||||
|
#elif defined(__alpha__)
|
||||||
|
#include "net-snmp-config-alpha.h"
|
||||||
|
#elif defined(__sparc__) && defined (__arch64__)
|
||||||
|
#include "net-snmp-config-sparc64.h"
|
||||||
|
#elif defined(__sparc__)
|
||||||
|
#include "net-snmp-config-sparc.h"
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#include "net-snmp-config-aarch64.h"
|
||||||
|
#else
|
||||||
|
#error "net-snmp-devel package does not work on your architecture"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef net_snmp_config_multilib_redirection_h
|
1
net-snmp-tmpfs.conf
Normal file
1
net-snmp-tmpfs.conf
Normal file
@ -0,0 +1 @@
|
|||||||
|
d /var/run/net-snmp 0755 root root
|
6
net-snmp-trapd.redhat.conf
Normal file
6
net-snmp-trapd.redhat.conf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Example configuration file for snmptrapd
|
||||||
|
#
|
||||||
|
# No traps are handled by default, you must edit this file!
|
||||||
|
#
|
||||||
|
# authCommunity log,execute,net public
|
||||||
|
# traphandle SNMPv2-MIB::coldStart /usr/bin/bin/my_great_script cold
|
462
net-snmp.redhat.conf
Normal file
462
net-snmp.redhat.conf
Normal file
@ -0,0 +1,462 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# snmpd.conf:
|
||||||
|
# An example configuration file for configuring the ucd-snmp snmpd agent.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# This file is intended to only be as a starting point. Many more
|
||||||
|
# configuration directives exist than are mentioned in this file. For
|
||||||
|
# full details, see the snmpd.conf(5) manual page.
|
||||||
|
#
|
||||||
|
# All lines beginning with a '#' are comments and are intended for you
|
||||||
|
# to read. All other lines are configuration commands for the agent.
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Access Control
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
# As shipped, the snmpd demon will only respond to queries on the
|
||||||
|
# system mib group until this file is replaced or modified for
|
||||||
|
# security purposes. Examples are shown below about how to increase the
|
||||||
|
# level of access.
|
||||||
|
|
||||||
|
# By far, the most common question I get about the agent is "why won't
|
||||||
|
# it work?", when really it should be "how do I configure the agent to
|
||||||
|
# allow me to access it?"
|
||||||
|
#
|
||||||
|
# By default, the agent responds to the "public" community for read
|
||||||
|
# only access, if run out of the box without any configuration file in
|
||||||
|
# place. The following examples show you other ways of configuring
|
||||||
|
# the agent so that you can change the community names, and give
|
||||||
|
# yourself write access to the mib tree as well.
|
||||||
|
#
|
||||||
|
# For more information, read the FAQ as well as the snmpd.conf(5)
|
||||||
|
# manual page.
|
||||||
|
|
||||||
|
####
|
||||||
|
# First, map the community name "public" into a "security name"
|
||||||
|
|
||||||
|
# sec.name source community
|
||||||
|
#com2sec notConfigUser default public
|
||||||
|
|
||||||
|
####
|
||||||
|
# Second, map the security name into a group name:
|
||||||
|
|
||||||
|
# groupName securityModel securityName
|
||||||
|
#group notConfigGroup v1 notConfigUser
|
||||||
|
#group notConfigGroup v2c notConfigUser
|
||||||
|
|
||||||
|
####
|
||||||
|
# Third, create a view for us to let the group have rights to:
|
||||||
|
|
||||||
|
# Make at least snmpwalk -v 1 localhost -c public system fast again.
|
||||||
|
# name incl/excl subtree mask(optional)
|
||||||
|
view systemview included .1.3.6.1.2.1.1
|
||||||
|
view systemview included .1.3.6.1.2.1.25.1.1
|
||||||
|
|
||||||
|
####
|
||||||
|
# Finally, grant the group read-only access to the systemview view.
|
||||||
|
|
||||||
|
# group context sec.model sec.level prefix read write notif
|
||||||
|
access notConfigGroup "" any noauth exact systemview none none
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Here is a commented out example configuration that allows less
|
||||||
|
# restrictive access.
|
||||||
|
|
||||||
|
# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY
|
||||||
|
# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO
|
||||||
|
# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE.
|
||||||
|
|
||||||
|
## sec.name source community
|
||||||
|
#com2sec local localhost COMMUNITY
|
||||||
|
#com2sec mynetwork NETWORK/24 COMMUNITY
|
||||||
|
|
||||||
|
## group.name sec.model sec.name
|
||||||
|
#group MyRWGroup any local
|
||||||
|
#group MyROGroup any mynetwork
|
||||||
|
#
|
||||||
|
#group MyRWGroup any otherv3user
|
||||||
|
#...
|
||||||
|
|
||||||
|
## incl/excl subtree mask
|
||||||
|
#view all included .1 80
|
||||||
|
|
||||||
|
## -or just the mib2 tree-
|
||||||
|
|
||||||
|
#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
|
||||||
|
|
||||||
|
|
||||||
|
## context sec.model sec.level prefix read write notif
|
||||||
|
#access MyROGroup "" any noauth 0 all none none
|
||||||
|
#access MyRWGroup "" any noauth 0 all all all
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Sample configuration to make net-snmpd RFC 1213.
|
||||||
|
# Unfortunately v1 and v2c don't allow any user based authentification, so
|
||||||
|
# opening up the default config is not an option from a security point.
|
||||||
|
#
|
||||||
|
# WARNING: If you uncomment the following lines you allow write access to your
|
||||||
|
# snmpd daemon from any source! To avoid this use different names for your
|
||||||
|
# community or split out the write access to a different community and
|
||||||
|
# restrict it to your local network.
|
||||||
|
# Also remember to comment the syslocation and syscontact parameters later as
|
||||||
|
# otherwise they are still read only (see FAQ for net-snmp).
|
||||||
|
#
|
||||||
|
|
||||||
|
# First, map the community name "public" into a "security name"
|
||||||
|
# sec.name source community
|
||||||
|
#com2sec notConfigUser default public
|
||||||
|
|
||||||
|
# Second, map the security name into a group name:
|
||||||
|
# groupName securityModel securityName
|
||||||
|
#group notConfigGroup v1 notConfigUser
|
||||||
|
#group notConfigGroup v2c notConfigUser
|
||||||
|
|
||||||
|
# Third, create a view for us to let the group have rights to:
|
||||||
|
# Open up the whole tree for ro, make the RFC 1213 required ones rw.
|
||||||
|
# name incl/excl subtree mask(optional)
|
||||||
|
#view roview included .1
|
||||||
|
#view rwview included system.sysContact
|
||||||
|
#view rwview included system.sysName
|
||||||
|
#view rwview included system.sysLocation
|
||||||
|
#view rwview included interfaces.ifTable.ifEntry.ifAdminStatus
|
||||||
|
#view rwview included at.atTable.atEntry.atPhysAddress
|
||||||
|
#view rwview included at.atTable.atEntry.atNetAddress
|
||||||
|
#view rwview included ip.ipForwarding
|
||||||
|
#view rwview included ip.ipDefaultTTL
|
||||||
|
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteDest
|
||||||
|
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex
|
||||||
|
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric1
|
||||||
|
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric2
|
||||||
|
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric3
|
||||||
|
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric4
|
||||||
|
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteType
|
||||||
|
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteAge
|
||||||
|
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMask
|
||||||
|
#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric5
|
||||||
|
#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaIfIndex
|
||||||
|
#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress
|
||||||
|
#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaNetAddress
|
||||||
|
#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType
|
||||||
|
#view rwview included tcp.tcpConnTable.tcpConnEntry.tcpConnState
|
||||||
|
#view rwview included egp.egpNeighTable.egpNeighEntry.egpNeighEventTrigger
|
||||||
|
#view rwview included snmp.snmpEnableAuthenTraps
|
||||||
|
|
||||||
|
# Finally, grant the group read-only access to the systemview view.
|
||||||
|
# group context sec.model sec.level prefix read write notif
|
||||||
|
#access notConfigGroup "" any noauth exact roview rwview none
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# System contact information
|
||||||
|
#
|
||||||
|
|
||||||
|
# It is also possible to set the sysContact and sysLocation system
|
||||||
|
# variables through the snmpd.conf file:
|
||||||
|
|
||||||
|
syslocation Unknown (edit /etc/snmp/snmpd.conf)
|
||||||
|
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
|
||||||
|
|
||||||
|
# Example output of snmpwalk:
|
||||||
|
# % snmpwalk -v 1 localhost -c public system
|
||||||
|
# system.sysDescr.0 = "SunOS name sun4c"
|
||||||
|
# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4
|
||||||
|
# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55
|
||||||
|
# system.sysContact.0 = "Me <me@somewhere.org>"
|
||||||
|
# system.sysName.0 = "name"
|
||||||
|
# system.sysLocation.0 = "Right here, right now."
|
||||||
|
# system.sysServices.0 = 72
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Logging
|
||||||
|
#
|
||||||
|
|
||||||
|
# We do not want annoying "Connection from UDP: " messages in syslog.
|
||||||
|
# If the following option is commented out, snmpd will print each incoming
|
||||||
|
# connection, which can be useful for debugging.
|
||||||
|
|
||||||
|
dontLogTCPWrappersConnects yes
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Process checks.
|
||||||
|
#
|
||||||
|
# The following are examples of how to use the agent to check for
|
||||||
|
# processes running on the host. The syntax looks something like:
|
||||||
|
#
|
||||||
|
# proc NAME [MAX=0] [MIN=0]
|
||||||
|
#
|
||||||
|
# NAME: the name of the process to check for. It must match
|
||||||
|
# exactly (ie, http will not find httpd processes).
|
||||||
|
# MAX: the maximum number allowed to be running. Defaults to 0.
|
||||||
|
# MIN: the minimum number to be running. Defaults to 0.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Examples (commented out by default):
|
||||||
|
#
|
||||||
|
|
||||||
|
# Make sure mountd is running
|
||||||
|
#proc mountd
|
||||||
|
|
||||||
|
# Make sure there are no more than 4 ntalkds running, but 0 is ok too.
|
||||||
|
#proc ntalkd 4
|
||||||
|
|
||||||
|
# Make sure at least one sendmail, but less than or equal to 10 are running.
|
||||||
|
#proc sendmail 10 1
|
||||||
|
|
||||||
|
# A snmpwalk of the process mib tree would look something like this:
|
||||||
|
#
|
||||||
|
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.2
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd"
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd"
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail"
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prMin.1 = 0
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prMin.2 = 0
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prMin.3 = 1
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prMax.1 = 0
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prMax.2 = 4
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prMax.3 = 10
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prCount.1 = 0
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prCount.2 = 0
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prCount.3 = 1
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running."
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = ""
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = ""
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0
|
||||||
|
# enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0
|
||||||
|
#
|
||||||
|
# Note that the errorFlag for mountd is set to 1 because one is not
|
||||||
|
# running (in this case an rpc.mountd is, but thats not good enough),
|
||||||
|
# and the ErrMessage tells you what's wrong. The configuration
|
||||||
|
# imposed in the snmpd.conf file is also shown.
|
||||||
|
#
|
||||||
|
# Special Case: When the min and max numbers are both 0, it assumes
|
||||||
|
# you want a max of infinity and a min of 1.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Executables/scripts
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# You can also have programs run by the agent that return a single
|
||||||
|
# line of output and an exit code. Here are two examples.
|
||||||
|
#
|
||||||
|
# exec NAME PROGRAM [ARGS ...]
|
||||||
|
#
|
||||||
|
# NAME: A generic name. The name must be unique for each exec statement.
|
||||||
|
# PROGRAM: The program to run. Include the path!
|
||||||
|
# ARGS: optional arguments to be passed to the program
|
||||||
|
|
||||||
|
# a simple hello world
|
||||||
|
|
||||||
|
#exec echotest /bin/echo hello world
|
||||||
|
|
||||||
|
# Run a shell script containing:
|
||||||
|
#
|
||||||
|
# #!/bin/sh
|
||||||
|
# echo hello world
|
||||||
|
# echo hi there
|
||||||
|
# exit 35
|
||||||
|
#
|
||||||
|
# Note: this has been specifically commented out to prevent
|
||||||
|
# accidental security holes due to someone else on your system writing
|
||||||
|
# a /tmp/shtest before you do. Uncomment to use it.
|
||||||
|
#
|
||||||
|
#exec shelltest /bin/sh /tmp/shtest
|
||||||
|
|
||||||
|
# Then,
|
||||||
|
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.8
|
||||||
|
# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1
|
||||||
|
# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2
|
||||||
|
# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest"
|
||||||
|
# enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest"
|
||||||
|
# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world"
|
||||||
|
# enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest"
|
||||||
|
# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0
|
||||||
|
# enterprises.ucdavis.extTable.extEntry.extResult.2 = 35
|
||||||
|
# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world."
|
||||||
|
# enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world."
|
||||||
|
# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0
|
||||||
|
# enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0
|
||||||
|
|
||||||
|
# Note that the second line of the /tmp/shtest shell script is cut
|
||||||
|
# off. Also note that the exit status of 35 was returned.
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# disk checks
|
||||||
|
#
|
||||||
|
|
||||||
|
# The agent can check the amount of available disk space, and make
|
||||||
|
# sure it is above a set limit.
|
||||||
|
|
||||||
|
# disk PATH [MIN=100000]
|
||||||
|
#
|
||||||
|
# PATH: mount path to the disk in question.
|
||||||
|
# MIN: Disks with space below this value will have the Mib's errorFlag set.
|
||||||
|
# Default value = 100000.
|
||||||
|
|
||||||
|
# Check the / partition and make sure it contains at least 10 megs.
|
||||||
|
|
||||||
|
#disk / 10000
|
||||||
|
|
||||||
|
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.9
|
||||||
|
# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0
|
||||||
|
# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F
|
||||||
|
# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0"
|
||||||
|
# enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000
|
||||||
|
# enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130
|
||||||
|
# enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325
|
||||||
|
# enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092
|
||||||
|
# enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58
|
||||||
|
# enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0
|
||||||
|
# enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = ""
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# load average checks
|
||||||
|
#
|
||||||
|
|
||||||
|
# load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0]
|
||||||
|
#
|
||||||
|
# 1MAX: If the 1 minute load average is above this limit at query
|
||||||
|
# time, the errorFlag will be set.
|
||||||
|
# 5MAX: Similar, but for 5 min average.
|
||||||
|
# 15MAX: Similar, but for 15 min average.
|
||||||
|
|
||||||
|
# Check for loads:
|
||||||
|
#load 12 14 14
|
||||||
|
|
||||||
|
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.10
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1"
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5"
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15"
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00"
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00"
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00"
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = ""
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = ""
|
||||||
|
# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = ""
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Extensible sections.
|
||||||
|
#
|
||||||
|
|
||||||
|
# This alleviates the multiple line output problem found in the
|
||||||
|
# previous executable mib by placing each mib in its own mib table:
|
||||||
|
|
||||||
|
# Run a shell script containing:
|
||||||
|
#
|
||||||
|
# #!/bin/sh
|
||||||
|
# echo hello world
|
||||||
|
# echo hi there
|
||||||
|
# exit 35
|
||||||
|
#
|
||||||
|
# Note: this has been specifically commented out to prevent
|
||||||
|
# accidental security holes due to someone else on your system writing
|
||||||
|
# a /tmp/shtest before you do. Uncomment to use it.
|
||||||
|
#
|
||||||
|
# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest
|
||||||
|
|
||||||
|
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.50
|
||||||
|
# enterprises.ucdavis.50.1.1 = 1
|
||||||
|
# enterprises.ucdavis.50.2.1 = "shelltest"
|
||||||
|
# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest"
|
||||||
|
# enterprises.ucdavis.50.100.1 = 35
|
||||||
|
# enterprises.ucdavis.50.101.1 = "hello world."
|
||||||
|
# enterprises.ucdavis.50.101.2 = "hi there."
|
||||||
|
# enterprises.ucdavis.50.102.1 = 0
|
||||||
|
|
||||||
|
# Now the Output has grown to two lines, and we can see the 'hi
|
||||||
|
# there.' output as the second line from our shell script.
|
||||||
|
#
|
||||||
|
# Note that you must alter the mib.txt file to be correct if you want
|
||||||
|
# the .50.* outputs above to change to reasonable text descriptions.
|
||||||
|
|
||||||
|
# Other ideas:
|
||||||
|
#
|
||||||
|
# exec .1.3.6.1.4.1.2021.51 ps /bin/ps
|
||||||
|
# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top
|
||||||
|
# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Pass through control.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Usage:
|
||||||
|
# pass MIBOID EXEC-COMMAND
|
||||||
|
#
|
||||||
|
# This will pass total control of the mib underneath the MIBOID
|
||||||
|
# portion of the mib to the EXEC-COMMAND.
|
||||||
|
#
|
||||||
|
# Note: You'll have to change the path of the passtest script to your
|
||||||
|
# source directory or install it in the given location.
|
||||||
|
#
|
||||||
|
# Example: (see the script for details)
|
||||||
|
# (commented out here since it requires that you place the
|
||||||
|
# script in the right location. (its not installed by default))
|
||||||
|
|
||||||
|
# pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/local/passtest
|
||||||
|
|
||||||
|
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.255
|
||||||
|
# enterprises.ucdavis.255.1 = "life the universe and everything"
|
||||||
|
# enterprises.ucdavis.255.2.1 = 42
|
||||||
|
# enterprises.ucdavis.255.2.2 = OID: 42.42.42
|
||||||
|
# enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42
|
||||||
|
# enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1
|
||||||
|
# enterprises.ucdavis.255.5 = 42
|
||||||
|
# enterprises.ucdavis.255.6 = Gauge: 42
|
||||||
|
#
|
||||||
|
# % snmpget -v 1 localhost public .1.3.6.1.4.1.2021.255.5
|
||||||
|
# enterprises.ucdavis.255.5 = 42
|
||||||
|
#
|
||||||
|
# % snmpset -v 1 localhost public .1.3.6.1.4.1.2021.255.1 s "New string"
|
||||||
|
# enterprises.ucdavis.255.1 = "New string"
|
||||||
|
#
|
||||||
|
|
||||||
|
# For specific usage information, see the man/snmpd.conf.5 manual page
|
||||||
|
# as well as the local/passtest script used in the above example.
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Further Information
|
||||||
|
#
|
||||||
|
# See the snmpd.conf manual page, and the output of "snmpd -H".
|
1914
net-snmp.spec
Normal file
1914
net-snmp.spec
Normal file
File diff suppressed because it is too large
Load Diff
3
net-snmpd.sysconfig
Normal file
3
net-snmpd.sysconfig
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# snmpd command line options
|
||||||
|
# '-f' is implicitly added by snmpd systemd unit file
|
||||||
|
# OPTIONS="-LS0-6d"
|
3
net-snmptrapd.sysconfig
Normal file
3
net-snmptrapd.sysconfig
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# snmptrapd command line options
|
||||||
|
# '-f' is implicitly added by snmptrapd systemd unit file
|
||||||
|
# OPTIONS="-Lsd"
|
13
snmpd.service
Normal file
13
snmpd.service
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Simple Network Management Protocol (SNMP) Daemon.
|
||||||
|
After=syslog.target network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=notify
|
||||||
|
Environment=OPTIONS="-LS0-6d"
|
||||||
|
EnvironmentFile=-/etc/sysconfig/snmpd
|
||||||
|
ExecStart=/usr/sbin/snmpd $OPTIONS -f
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
13
snmptrapd.service
Normal file
13
snmptrapd.service
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Simple Network Management Protocol (SNMP) Trap Daemon.
|
||||||
|
After=syslog.target network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=notify
|
||||||
|
Environment=OPTIONS="-Lsd"
|
||||||
|
EnvironmentFile=-/etc/sysconfig/snmptrapd
|
||||||
|
ExecStart=/usr/sbin/snmptrapd $OPTIONS -f
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
|||||||
|
SHA512 (net-snmp-5.9.tar.gz) = 045a54be69a318ee8ed7ec8fd044bdb32821c189703cc7b1700b20f17a18af17a631588b3815f07ffa1f146f2e5be7f199a2929c6ab1f796d02fe6a2f3e8b3e5
|
36
tests/integration-tests/Makefile
Normal file
36
tests/integration-tests/Makefile
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Makefile of /CoreOS/net-snmp
|
||||||
|
# Description: Test if net-snmp working ok
|
||||||
|
# Author: Susant Sahani<susant@redhat.com>
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
export TEST=/CoreOS/net-snmp
|
||||||
|
export TESTVERSION=1.0
|
||||||
|
BUILT_FILES=
|
||||||
|
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||||
|
.PHONY: all install download clean
|
||||||
|
run: $(FILES) build
|
||||||
|
./runtest.sh
|
||||||
|
build: $(BUILT_FILES)
|
||||||
|
test -x runtest.sh || chmod a+x runtest.sh
|
||||||
|
clean:
|
||||||
|
rm -f *~ $(BUILT_FILES)
|
||||||
|
include /usr/share/rhts/lib/rhts-make.include
|
||||||
|
$(METADATA): Makefile
|
||||||
|
@echo "Owner: Susant Sahani<susant@redhat.com>" > $(METADATA)
|
||||||
|
@echo "Name: $(TEST)" >> $(METADATA)
|
||||||
|
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||||
|
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||||
|
@echo "Description: Test snmpd" >> $(METADATA)
|
||||||
|
@echo "Type: Sanity" >> $(METADATA)
|
||||||
|
@echo "TestTime: 5m" >> $(METADATA)
|
||||||
|
@echo "RunFor: net-snmp" >> $(METADATA)
|
||||||
|
@echo "Requires: net=snmp" >> $(METADATA)
|
||||||
|
@echo "Priority: Normal" >> $(METADATA)
|
||||||
|
@echo "License: GPLv2" >> $(METADATA)
|
||||||
|
@echo "Confidential: no" >> $(METADATA)
|
||||||
|
@echo "Destructive: no" >> $(METADATA)
|
||||||
|
@echo "Releases: -Fedora 28" >> $(METADATA)
|
||||||
|
rhts-lint $(METADATA)
|
3
tests/integration-tests/PURPOSE
Normal file
3
tests/integration-tests/PURPOSE
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
PURPOSE of /CoreOS/net-snmp
|
||||||
|
Description: tests for net-snmp
|
||||||
|
Author: Susant Sahani<susant@redhat.com>
|
175
tests/integration-tests/net-snmp-tests.py
Executable file
175
tests/integration-tests/net-snmp-tests.py
Executable file
@ -0,0 +1,175 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
# ~~~
|
||||||
|
# Description: Tests for snmpd
|
||||||
|
#
|
||||||
|
# Author: Susant Sahani <susant@redhat.com>
|
||||||
|
# Copyright (c) 2018 Red Hat, Inc.
|
||||||
|
# ~~~
|
||||||
|
|
||||||
|
import errno
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import unittest
|
||||||
|
import subprocess
|
||||||
|
import signal
|
||||||
|
import shutil
|
||||||
|
import psutil
|
||||||
|
import socket
|
||||||
|
import platform
|
||||||
|
import re
|
||||||
|
from pyroute2 import IPRoute
|
||||||
|
from psutil import virtual_memory
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
HOST='192.168.111.50'
|
||||||
|
|
||||||
|
def setUpModule():
|
||||||
|
"""Initialize the environment, and perform sanity checks on it."""
|
||||||
|
|
||||||
|
if shutil.which('snmpd') is None:
|
||||||
|
raise OSError(errno.ENOENT, 'snmpd not found')
|
||||||
|
|
||||||
|
if shutil.which('snmpwalk') is None:
|
||||||
|
raise OSError(errno.ENOENT, 'snmpwalk not found')
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
pass
|
||||||
|
|
||||||
|
class GenericUtilities():
|
||||||
|
"""Provide a set of utility functions start stop daemons. write config files etc """
|
||||||
|
|
||||||
|
def StartSnmpd(self):
|
||||||
|
"""Start snmpd"""
|
||||||
|
subprocess.check_output(['systemctl', 'start', 'snmpd'])
|
||||||
|
|
||||||
|
def StopSnmpd(self):
|
||||||
|
"""Stop snmpd"""
|
||||||
|
subprocess.check_output(['systemctl', 'stop', 'snmpd'])
|
||||||
|
|
||||||
|
def SetupVethInterface(self):
|
||||||
|
"""Setup veth interface"""
|
||||||
|
|
||||||
|
ip = IPRoute()
|
||||||
|
|
||||||
|
ip.link('add', ifname='veth-test', peer='veth-peer', kind='veth')
|
||||||
|
idx_veth_test = ip.link_lookup(ifname='veth-test')[0]
|
||||||
|
idx_veth_peer = ip.link_lookup(ifname='veth-peer')[0]
|
||||||
|
|
||||||
|
ip.link('set', index=idx_veth_test, address='12:11:12:13:14:18')
|
||||||
|
ip.link('set', index=idx_veth_peer, address='22:21:22:23:24:29')
|
||||||
|
ip.link('set', index=idx_veth_test, state='up')
|
||||||
|
ip.link('set', index=idx_veth_peer, state='up')
|
||||||
|
ip.addr('add', index=idx_veth_test, address='192.168.111.50')
|
||||||
|
ip.addr('add', index=idx_veth_peer, address='192.168.111.51')
|
||||||
|
|
||||||
|
ip.close()
|
||||||
|
|
||||||
|
def TearDownVethInterface(self):
|
||||||
|
ip = IPRoute()
|
||||||
|
|
||||||
|
ip.link('del', index=ip.link_lookup(ifname='veth-test')[0])
|
||||||
|
ip.close()
|
||||||
|
|
||||||
|
class SnmpdTests(unittest.TestCase, GenericUtilities):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.SetupVethInterface()
|
||||||
|
time.sleep(1)
|
||||||
|
self.StartSnmpd()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.StopSnmpd()
|
||||||
|
self.TearDownVethInterface()
|
||||||
|
|
||||||
|
def test_UCD_SNMP_MIB_memory(self):
|
||||||
|
''' UCD-SNMP-MIB::memory '''
|
||||||
|
|
||||||
|
subprocess.check_output(['snmpwalk', '-v2c', '-c' , 'public', HOST, 'UCD-SNMP-MIB::memory'])
|
||||||
|
|
||||||
|
meminfo=OrderedDict()
|
||||||
|
with open('/proc/meminfo') as f:
|
||||||
|
for line in f:
|
||||||
|
meminfo[line.split(':')[0]] = line.split(':')[1].strip()
|
||||||
|
|
||||||
|
output=subprocess.check_output(['snmpwalk', '-v2c', '-c' , 'public', HOST, 'UCD-SNMP-MIB::memTotalReal.0']).rstrip().decode('utf-8')
|
||||||
|
self.assertRegex(output, meminfo['MemTotal'])
|
||||||
|
|
||||||
|
def test_SNMP_hrSWRunPath(self):
|
||||||
|
""" process id """
|
||||||
|
output=subprocess.check_output(['snmpwalk', '-v2c', '-c' , 'public', HOST, 'HOST-RESOURCES-MIB::hrSWRunPath.1']).rstrip().decode('utf-8')
|
||||||
|
self.assertRegex(output, 'systemd')
|
||||||
|
|
||||||
|
def test_SNMP_IF_MIB_network_interface(self):
|
||||||
|
""" verify network interface (1.3.6.1.2.1.2.2.1) SNMP variables """
|
||||||
|
|
||||||
|
ip = IPRoute()
|
||||||
|
|
||||||
|
subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST, '1.3.6.1.2.1.2.2.1'])
|
||||||
|
|
||||||
|
# 1.3.6.1.2.1.2.2.1.1 IF-MIB::ifIndex
|
||||||
|
output=subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST, '1.3.6.1.2.1.2.2.1.1']).rstrip().decode('utf-8')
|
||||||
|
self.assertRegex(output, 'IF-MIB::ifIndex.1 = INTEGER: 1')
|
||||||
|
|
||||||
|
# 1.3.6.1.2.1.2.2.1.1 IF-MIB::ifDescr
|
||||||
|
output=subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST, '1.3.6.1.2.1.2.2.1.2']).rstrip().decode('utf-8')
|
||||||
|
for link in ip.get_links():
|
||||||
|
self.assertRegex(output, link.get_attr('IFLA_IFNAME'))
|
||||||
|
|
||||||
|
# IP-MIB::ipAdEntAddr 1.3.6.1.2.1.4.20.1.1
|
||||||
|
output=subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST, '1.3.6.1.2.1.4.20.1.1']).rstrip().decode('utf-8')
|
||||||
|
for addr in ip.get_addr():
|
||||||
|
if addr.get_attr('IFA_ADDRESS'):
|
||||||
|
if addr.get_attr('IFA_ADDRESS') != '::1' and addr.get_attr('Ifamily') == 2:
|
||||||
|
self.assertRegex(output, addr.get_attr('IFA_ADDRESS'))
|
||||||
|
|
||||||
|
# IF-MIB::ifPhysAddress. 1.3.6.1.2.1.2.2.1.6
|
||||||
|
output=subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST, '1.3.6.1.2.1.2.2.1.6']).rstrip().decode('utf-8')
|
||||||
|
for link in ip.get_links():
|
||||||
|
if link.get_attr('IFLA_ADDRESS') and link.get_attr('IFLA_ADDRESS') != '00:00:00:00:00:00':
|
||||||
|
snmp_mac = re.sub(r'\b0+(\d)', r'\1', link.get_attr('IFLA_ADDRESS')).lstrip('0')
|
||||||
|
self.assertRegex(output, snmp_mac)
|
||||||
|
|
||||||
|
ip.close()
|
||||||
|
|
||||||
|
def test_SNMP_MIB_2_System(self):
|
||||||
|
""" verify RFC 1213 System (1.3.6.1.2.1.1) SNMP variables"""
|
||||||
|
|
||||||
|
subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST, '1.3.6.1.2.1.1']).rstrip().decode('utf-8')
|
||||||
|
|
||||||
|
# 1.3.6.1.2.1.1.1 - sysDescr
|
||||||
|
output=subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST, '1.3.6.1.2.1.1.1']).rstrip().decode('utf-8')
|
||||||
|
self.assertRegex(output, platform.machine())
|
||||||
|
self.assertRegex(output, platform.node())
|
||||||
|
self.assertRegex(output, platform.processor())
|
||||||
|
self.assertRegex(output, platform.release())
|
||||||
|
self.assertRegex(output, platform.version())
|
||||||
|
|
||||||
|
# 1.3.6.1.2.1.1.2 - sysObjectID
|
||||||
|
subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST, '1.3.6.1.2.1.1.2'])
|
||||||
|
|
||||||
|
# 1.3.6.1.2.1.1.3 - sysUpTime
|
||||||
|
subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST, '1.3.6.1.2.1.1.3'])
|
||||||
|
|
||||||
|
# 1.3.6.1.2.1.1.4 - sysContact
|
||||||
|
output=subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST, '1.3.6.1.2.1.1.4']).rstrip().decode('utf-8')
|
||||||
|
self.assertRegex(output, 'fedora-ci <fedoraci@fedoraproject.org>')
|
||||||
|
|
||||||
|
# 1.3.6.1.2.1.1.5 - sysName
|
||||||
|
output=subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST, '1.3.6.1.2.1.1.5']).rstrip().decode('utf-8')
|
||||||
|
self.assertRegex(output, socket.gethostname())
|
||||||
|
|
||||||
|
# 1.3.6.1.2.1.1.6 - sysLocation
|
||||||
|
output=subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST, '1.3.6.1.2.1.1.6']).rstrip().decode('utf-8')
|
||||||
|
self.assertRegex(output, 'Pune, IN')
|
||||||
|
|
||||||
|
def test_basic_snmpwalk(self):
|
||||||
|
""" verify snmpwalk getting success snmpwalk -v2c -c public localhost """
|
||||||
|
|
||||||
|
subprocess.check_output(['snmpwalk', '-v2c', '-c', 'public', HOST])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout,
|
||||||
|
verbosity=3))
|
51
tests/integration-tests/runtest.sh
Executable file
51
tests/integration-tests/runtest.sh
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
|
# ~~~
|
||||||
|
# runtest.sh of net-snmp
|
||||||
|
# Description: net-snmp tests
|
||||||
|
#
|
||||||
|
# Author: Susant Sahani <susant@redhat.com>
|
||||||
|
# Copyright (c) 2018 Red Hat, Inc.
|
||||||
|
# ~~~
|
||||||
|
|
||||||
|
# Include Beaker environment
|
||||||
|
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||||
|
|
||||||
|
PACKAGE_NET_SNMP="net-snmp"
|
||||||
|
PACKAGE_NET_SNMP_UTILS="net-snmp-utils"
|
||||||
|
|
||||||
|
NET_SNMP_CONF_FILE="/etc/snmp/snmpd.conf"
|
||||||
|
|
||||||
|
rlJournalStart
|
||||||
|
rlPhaseStartSetup
|
||||||
|
rlAssertRpm $PACKAGE_NET_SNMP
|
||||||
|
rlAssertRpm $PACKAGE_NET_SNMP_UTILS
|
||||||
|
|
||||||
|
rlRun "systemctl stop firewalld" 0,5
|
||||||
|
rlRun "setenforce 0" 0,1
|
||||||
|
|
||||||
|
rlRun "[ -e /sys/class/net/veth-test ] && ip link del veth-test" 0,1
|
||||||
|
rlRun "cp net-snmp-tests.py /usr/bin/"
|
||||||
|
|
||||||
|
rlFileBackup "$NET_SNMP_CONF_FILE"
|
||||||
|
rlRun "cp snmpd.conf $NET_SNMP_CONF_FILE"
|
||||||
|
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartTest
|
||||||
|
rlLog "Starting net-snmp tests ..."
|
||||||
|
rlRun "/usr/bin/python3 /usr/bin/net-snmp-tests.py"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartCleanup
|
||||||
|
rlRun "rm /usr/bin/net-snmp-tests.py $NET_SNMP_CONFIG_FILE"
|
||||||
|
rlRun "systemctl daemon-reload"
|
||||||
|
rlRun "[ -e /sys/class/net/veth-test ] && ip link del veth-test" 0,1
|
||||||
|
rlFileRestore
|
||||||
|
rlRun "setenforce 1" 0,1
|
||||||
|
rlLog "net-snmp tests done"
|
||||||
|
rlPhaseEnd
|
||||||
|
rlJournalPrintText
|
||||||
|
rlJournalEnd
|
||||||
|
|
||||||
|
rlGetTestState
|
7
tests/integration-tests/snmpd.conf
Normal file
7
tests/integration-tests/snmpd.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
agentAddress udp:192.168.111.50:161
|
||||||
|
|
||||||
|
syslocation Pune, IN
|
||||||
|
syscontact fedora-ci <fedoraci@fedoraproject.org>
|
||||||
|
|
||||||
|
dontLogTCPWrappersConnects yes
|
||||||
|
rocommunity public
|
14
tests/tests.yml
Normal file
14
tests/tests.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
- hosts: localhost
|
||||||
|
roles:
|
||||||
|
- role: standard-test-beakerlib
|
||||||
|
tags:
|
||||||
|
- classic
|
||||||
|
tests:
|
||||||
|
- integration-tests
|
||||||
|
required_packages:
|
||||||
|
- python3
|
||||||
|
- systemd
|
||||||
|
- iproute
|
||||||
|
- python3-pyroute2
|
||||||
|
- net-snmp
|
||||||
|
- net-snmp-utils
|
Loading…
Reference in New Issue
Block a user