Package init
This commit is contained in:
commit
ee9d3405c5
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.
|
||||
10
net-snmp-5.7.2-autoreconf.patch
Normal file
10
net-snmp-5.7.2-autoreconf.patch
Normal file
@ -0,0 +1,10 @@
|
||||
926223 - net-snmp: Does not support aarch64 in f19 and rawhide
|
||||
|
||||
Update autoconf version to make the test suite happy.
|
||||
|
||||
diff -up net-snmp-5.7.2/dist/autoconf-version.autoreconf net-snmp-5.7.2/dist/autoconf-version
|
||||
--- net-snmp-5.7.2/dist/autoconf-version.autoreconf 2013-03-25 13:00:15.002745347 +0100
|
||||
+++ net-snmp-5.7.2/dist/autoconf-version 2013-03-25 13:00:17.207736442 +0100
|
||||
@@ -1 +1 @@
|
||||
-2.68
|
||||
+2.69
|
||||
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 {
|
||||
24
net-snmp-5.7.2-pie.patch
Normal file
24
net-snmp-5.7.2-pie.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff -up net-snmp-5.7.2/agent/Makefile.in.pie net-snmp-5.7.2/agent/Makefile.in
|
||||
--- net-snmp-5.7.2/agent/Makefile.in.pie 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ net-snmp-5.7.2/agent/Makefile.in 2012-10-18 09:45:13.298613099 +0200
|
||||
@@ -294,7 +294,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) $(LIB_LD_LIBS) @AGENTLIBS@
|
||||
diff -up net-snmp-5.7.2/apps/Makefile.in.pie net-snmp-5.7.2/apps/Makefile.in
|
||||
--- net-snmp-5.7.2/apps/Makefile.in.pie 2012-10-10 00:28:58.000000000 +0200
|
||||
+++ net-snmp-5.7.2/apps/Makefile.in 2012-10-18 09:44:27.827774580 +0200
|
||||
@@ -170,7 +170,7 @@ snmptest$(EXEEXT): snmptest.$(OSUFFIX
|
||||
$(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}
|
||||
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 2018-03-26 09:00:39.932335587 +0200
|
||||
+++ new/agent/mibgroup/host/data_access/swrun.c 2018-03-26 09:03:00.845876681 +0200
|
||||
@@ -102,7 +102,9 @@ swrun_count_processes_by_name( char *nam
|
||||
return 0; /* or -1 */
|
||||
|
||||
it = CONTAINER_ITERATOR( swrun_container );
|
||||
- while ((entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) != NULL) {
|
||||
+ for (entry = (netsnmp_swrun_entry*)ITERATOR_FIRST( it );
|
||||
+ entry;
|
||||
+ entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) {
|
||||
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
|
||||
12
net-snmp-5.8-agentx-disconnect-crash.patch
Normal file
12
net-snmp-5.8-agentx-disconnect-crash.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -urNp a/agent/mibgroup/agentx/master.c b/agent/mibgroup/agentx/master.c
|
||||
--- a/agent/mibgroup/agentx/master.c 2018-07-18 12:13:49.953014652 +0200
|
||||
+++ b/agent/mibgroup/agentx/master.c 2018-07-18 12:20:23.537626773 +0200
|
||||
@@ -221,7 +221,7 @@ agentx_got_response(int operation,
|
||||
/* response is too late, free the cache */
|
||||
if (magic)
|
||||
netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic);
|
||||
- return 0;
|
||||
+ return 1;
|
||||
}
|
||||
requests = cache->requests;
|
||||
|
||||
199
net-snmp-5.8-autofs-skip.patch
Normal file
199
net-snmp-5.8-autofs-skip.patch
Normal file
@ -0,0 +1,199 @@
|
||||
diff -urNp b/agent/mibgroup/hardware/fsys/fsys_mntctl.c net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntctl.c
|
||||
--- b/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2018-07-18 16:12:20.674499629 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2018-07-18 16:15:46.782859398 +0200
|
||||
@@ -43,8 +43,9 @@ _fsys_type( int type)
|
||||
|
||||
case MNT_NFS:
|
||||
case MNT_NFS3:
|
||||
- case MNT_AUTOFS:
|
||||
return NETSNMP_FS_TYPE_NFS;
|
||||
+ case MNT_AUTOFS:
|
||||
+ return NETSNMP_FS_TYPE_AUTOFS;
|
||||
|
||||
/*
|
||||
* The following code covers selected filesystems
|
||||
@@ -156,10 +157,12 @@ netsnmp_fsys_arch_load( void )
|
||||
|
||||
/*
|
||||
* Optionally skip retrieving statistics for remote mounts
|
||||
+ * AUTOFS is skipped by default
|
||||
*/
|
||||
- if ( (entry->flags & NETSNMP_FS_FLAG_REMOTE) &&
|
||||
+ if ( ((entry->flags & NETSNMP_FS_FLAG_REMOTE) &&
|
||||
netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
|
||||
- NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES))
|
||||
+ NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES)) ||
|
||||
+ entry->type == (NETSNMP_FS_TYPE_AUTOFS))
|
||||
continue;
|
||||
|
||||
if ( statfs( entry->path, &stat_buf ) < 0 ) {
|
||||
diff -urNp b/agent/mibgroup/hardware/fsys/fsys_mntent.c net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntent.c
|
||||
--- b/agent/mibgroup/hardware/fsys/fsys_mntent.c 2018-07-18 16:12:20.674499629 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/hardware/fsys/fsys_mntent.c 2018-07-18 16:15:46.782859398 +0200
|
||||
@@ -150,6 +150,13 @@ _fsys_type( char *typename )
|
||||
!strcmp(typename, MNTTYPE_LOFS))
|
||||
return NETSNMP_FS_TYPE_OTHER;
|
||||
|
||||
+ /* Detection of AUTOFS.
|
||||
+ * This file system will be ignored by default
|
||||
+ */
|
||||
+ else if ( !strcmp(typename, MNTTYPE_AUTOFS))
|
||||
+ return NETSNMP_FS_TYPE_AUTOFS;
|
||||
+
|
||||
+
|
||||
/*
|
||||
* All other types are silently skipped
|
||||
*/
|
||||
@@ -239,6 +246,10 @@ netsnmp_fsys_arch_load( void )
|
||||
NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES))
|
||||
continue;
|
||||
|
||||
+ /* Skip AUTOFS enteries */
|
||||
+ if ( entry->type == (NETSNMP_FS_TYPE_AUTOFS))
|
||||
+ continue;
|
||||
+
|
||||
#ifdef irix6
|
||||
if ( NSFS_STATFS( entry->path, &stat_buf, sizeof(struct statfs), 0) < 0 )
|
||||
#else
|
||||
diff -urNp b/agent/mibgroup/hardware/fsys/mnttypes.h net-snmp-5.8/agent/mibgroup/hardware/fsys/mnttypes.h
|
||||
--- b/agent/mibgroup/hardware/fsys/mnttypes.h 2018-07-18 16:12:20.674499629 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/hardware/fsys/mnttypes.h 2018-07-18 16:15:46.782859398 +0200
|
||||
@@ -165,6 +165,9 @@
|
||||
#ifndef MNTTYPE_APP
|
||||
#define MNTTYPE_APP "app"
|
||||
#endif
|
||||
+#ifndef MNTTYPE_AUTOFS
|
||||
+#define MNTTYPE_AUTOFS "autofs"
|
||||
+#endif
|
||||
#ifndef MNTTYPE_DEVPTS
|
||||
#define MNTTYPE_DEVPTS "devpts"
|
||||
#endif
|
||||
diff -urNp b/agent/mibgroup/host/hr_filesys.c net-snmp-5.8/agent/mibgroup/host/hr_filesys.c
|
||||
--- b/agent/mibgroup/host/hr_filesys.c 2018-07-18 16:12:20.668499652 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/host/hr_filesys.c 2018-07-18 16:15:46.783859399 +0200
|
||||
@@ -834,6 +834,27 @@ Check_HR_FileSys_NFS (void)
|
||||
return 0; /* no NFS file system */
|
||||
}
|
||||
|
||||
+/* This function checks whether current file system is an AutoFs
|
||||
+ * HRFS_entry must be valid prior to calling this function
|
||||
+ * return 1 if AutoFs, 0 otherwise
|
||||
+ */
|
||||
+int
|
||||
+Check_HR_FileSys_AutoFs (void)
|
||||
+{
|
||||
+#if HAVE_GETFSSTAT
|
||||
+ if ( HRFS_entry->HRFS_type != NULL &&
|
||||
+#if defined(MNTTYPE_AUTOFS)
|
||||
+ !strcmp( HRFS_entry->HRFS_type, MNTTYPE_AUTOFS)
|
||||
+#else
|
||||
+ !strcmp( HRFS_entry->HRFS_type, "autofs")
|
||||
+#endif
|
||||
+ )
|
||||
+#endif /* HAVE_GETFSSTAT */
|
||||
+ return 1; /* AUTOFS */
|
||||
+
|
||||
+ return 0; /* no AUTOFS */
|
||||
+}
|
||||
+
|
||||
void
|
||||
End_HR_FileSys(void)
|
||||
{
|
||||
diff -urNp b/agent/mibgroup/host/hr_filesys.h net-snmp-5.8/agent/mibgroup/host/hr_filesys.h
|
||||
--- b/agent/mibgroup/host/hr_filesys.h 2018-07-18 16:12:20.669499648 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/host/hr_filesys.h 2018-07-18 16:15:46.784859400 +0200
|
||||
@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void);
|
||||
extern FindVarMethod var_hrfilesys;
|
||||
extern int Get_Next_HR_FileSys(void);
|
||||
extern int Check_HR_FileSys_NFS(void);
|
||||
+extern int Check_HR_FileSys_AutoFs(void);
|
||||
|
||||
extern int Get_FSIndex(char *);
|
||||
extern long Get_FSSize(char *); /* Temporary */
|
||||
diff -urNp b/agent/mibgroup/host/hrh_filesys.c net-snmp-5.8/agent/mibgroup/host/hrh_filesys.c
|
||||
--- b/agent/mibgroup/host/hrh_filesys.c 2018-07-18 16:12:20.668499652 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/host/hrh_filesys.c 2018-07-18 16:15:46.785859402 +0200
|
||||
@@ -429,3 +429,9 @@ Check_HR_FileSys_NFS (void)
|
||||
{
|
||||
return (HRFS_entry->flags & NETSNMP_FS_FLAG_REMOTE) ? 1 : 0;
|
||||
}
|
||||
+
|
||||
+int
|
||||
+Check_HR_FileSys_AutoFs (void)
|
||||
+{
|
||||
+ return (HRFS_entry->type == (NETSNMP_FS_TYPE_AUTOFS)) ? 1 : 0;
|
||||
+}
|
||||
diff -urNp b/agent/mibgroup/host/hrh_filesys.h net-snmp-5.8/agent/mibgroup/host/hrh_filesys.h
|
||||
--- b/agent/mibgroup/host/hrh_filesys.h 2018-07-18 16:12:20.669499648 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/host/hrh_filesys.h 2018-07-18 16:15:46.785859402 +0200
|
||||
@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void);
|
||||
extern FindVarMethod var_hrhfilesys;
|
||||
extern int Get_Next_HR_FileSys(void);
|
||||
extern int Check_HR_FileSys_NFS(void);
|
||||
+extern int Check_HR_FileSys_AutoFs(void);
|
||||
|
||||
extern int Get_FSIndex(char *);
|
||||
extern long Get_FSSize(char *); /* Temporary */
|
||||
diff -urNp b/agent/mibgroup/host/hrh_storage.c net-snmp-5.8/agent/mibgroup/host/hrh_storage.c
|
||||
--- b/agent/mibgroup/host/hrh_storage.c 2018-07-18 16:12:20.668499652 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/host/hrh_storage.c 2018-07-18 16:15:46.786859402 +0200
|
||||
@@ -367,9 +367,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 (store_idx <= NETSNMP_MEM_TYPE_MAX ) {
|
||||
mem = (netsnmp_memory_info*)ptr;
|
||||
@@ -508,7 +509,8 @@ Get_Next_HR_Store(void)
|
||||
if (HRS_index >= 0) {
|
||||
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 HRS_index + NETSNMP_MEM_TYPE_MAX;
|
||||
}
|
||||
} else {
|
||||
diff -urNp b/agent/mibgroup/host/hr_storage.c net-snmp-5.8/agent/mibgroup/host/hr_storage.c
|
||||
--- b/agent/mibgroup/host/hr_storage.c 2018-07-18 16:12:20.670499644 +0200
|
||||
+++ net-snmp-5.8/agent/mibgroup/host/hr_storage.c 2018-07-18 16:15:46.786859402 +0200
|
||||
@@ -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 (HRFS_statfs(HRFS_entry->HRFS_mount, &stat_buf) < 0) {
|
||||
snmp_log_perror(HRFS_entry->HRFS_mount);
|
||||
@@ -683,7 +684,8 @@ Get_Next_HR_Store(void)
|
||||
if (HRS_index >= 0) {
|
||||
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 HRS_index + NETSNMP_MEM_TYPE_MAX;
|
||||
}
|
||||
} else {
|
||||
diff -urNp b/include/net-snmp/agent/hardware/fsys.h net-snmp-5.8/include/net-snmp/agent/hardware/fsys.h
|
||||
--- b/include/net-snmp/agent/hardware/fsys.h 2018-07-18 16:12:20.649499726 +0200
|
||||
+++ net-snmp-5.8/include/net-snmp/agent/hardware/fsys.h 2018-07-18 16:19:33.994918912 +0200
|
||||
@@ -41,6 +41,7 @@ typedef struct netsnmp_fsys_info_s netsn
|
||||
#define NETSNMP_FS_TYPE_SYSFS (4 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT)
|
||||
#define NETSNMP_FS_TYPE_TMPFS (5 | _NETSNMP_FS_TYPE_LOCAL)
|
||||
#define NETSNMP_FS_TYPE_USBFS (6 | _NETSNMP_FS_TYPE_LOCAL)
|
||||
+#define NETSNMP_FS_TYPE_AUTOFS (7 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT)
|
||||
|
||||
#define NETSNMP_FS_FLAG_ACTIVE 0x01
|
||||
#define NETSNMP_FS_FLAG_REMOTE 0x02
|
||||
112
net-snmp-5.8-cflags.patch
Normal file
112
net-snmp-5.8-cflags.patch
Normal file
@ -0,0 +1,112 @@
|
||||
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/agent/default_store/Makefile.PL b/perl/agent/default_store/Makefile.PL
|
||||
--- a/perl/agent/default_store/Makefile.PL 2018-07-18 13:43:12.170426290 +0200
|
||||
+++ b/perl/agent/default_store/Makefile.PL 2018-07-18 13:51:31.812176486 +0200
|
||||
@@ -83,7 +83,7 @@ sub AgentDefaultStoreInitMakeParams {
|
||||
" " . $Params{'LIBS'};
|
||||
$Params{'CCFLAGS'} = "-I../../../include " . $Params{'CCFLAGS'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
diff -urNp a/perl/agent/Makefile.PL b/perl/agent/Makefile.PL
|
||||
--- a/perl/agent/Makefile.PL 2018-07-18 13:43:12.169426292 +0200
|
||||
+++ b/perl/agent/Makefile.PL 2018-07-18 13:52:53.884973275 +0200
|
||||
@@ -98,7 +98,7 @@ sub AgentInitMakeParams {
|
||||
$Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . $Params{'LIBS'};
|
||||
# $Params{'PREREQ_PM'} = {'NetSNMP::OID' => '0.1'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
diff -urNp a/perl/agent/Support/Makefile.PL b/perl/agent/Support/Makefile.PL
|
||||
--- a/perl/agent/Support/Makefile.PL 2018-07-18 13:43:12.169426292 +0200
|
||||
+++ b/perl/agent/Support/Makefile.PL 2018-07-18 13:53:11.414929921 +0200
|
||||
@@ -90,7 +90,7 @@ sub SupportInitMakeParams {
|
||||
" " . $Params{'LIBS'};
|
||||
$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
diff -urNp a/perl/ASN/Makefile.PL b/perl/ASN/Makefile.PL
|
||||
--- a/perl/ASN/Makefile.PL 2018-07-18 13:43:12.171426287 +0200
|
||||
+++ b/perl/ASN/Makefile.PL 2018-07-18 13:53:46.652842822 +0200
|
||||
@@ -93,7 +93,7 @@ sub AsnInitMakeParams {
|
||||
" " . $Params{'LIBS'};
|
||||
$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
diff -urNp a/perl/default_store/Makefile.PL b/perl/default_store/Makefile.PL
|
||||
--- a/perl/default_store/Makefile.PL 2018-07-18 13:43:12.175426277 +0200
|
||||
+++ b/perl/default_store/Makefile.PL 2018-07-18 13:54:20.814758441 +0200
|
||||
@@ -83,7 +83,7 @@ sub DefaultStoreInitMakeParams {
|
||||
" " . $Params{'LIBS'};
|
||||
$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
diff -urNp a/perl/OID/Makefile.PL b/perl/OID/Makefile.PL
|
||||
--- a/perl/OID/Makefile.PL 2018-07-18 13:43:12.175426277 +0200
|
||||
+++ b/perl/OID/Makefile.PL 2018-07-18 13:54:43.348702811 +0200
|
||||
@@ -90,7 +90,7 @@ sub OidInitMakeParams {
|
||||
# } else {
|
||||
# $Params{'PREREQ_PM'} = {'SNMP' => '5.0'};
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
diff -urNp a/perl/SNMP/Makefile.PL b/perl/SNMP/Makefile.PL
|
||||
--- a/perl/SNMP/Makefile.PL 2018-07-18 13:43:12.173426282 +0200
|
||||
+++ b/perl/SNMP/Makefile.PL 2018-07-18 13:55:07.220643903 +0200
|
||||
@@ -103,7 +103,7 @@ sub SnmpInitMakeParams {
|
||||
# } else {
|
||||
# $Params{'PREREQ_PM'} = { 'NetSNMP::default_store' => 0.01 };
|
||||
}
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if (!$ENV{'NETSNMP_PREFIX'}) {
|
||||
$prefix = `$opts->{'nsconfig'} --prefix`;
|
||||
diff -urNp a/perl/TrapReceiver/Makefile.PL b/perl/TrapReceiver/Makefile.PL
|
||||
--- a/perl/TrapReceiver/Makefile.PL 2018-07-18 13:43:12.172426285 +0200
|
||||
+++ b/perl/TrapReceiver/Makefile.PL 2018-07-18 13:55:43.100647233 +0200
|
||||
@@ -132,7 +132,7 @@ sub TrapReceiverInitMakeParams {
|
||||
$Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . " $Params{'LIBS'}";
|
||||
}
|
||||
|
||||
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
|
||||
$Params{'CCFLAGS'} .= ' -Wformat';
|
||||
if ($Params{'CCFLAGS'} eq "") {
|
||||
die "You need to install net-snmp first (I can't find net-snmp-config)";
|
||||
12
net-snmp-5.8-dir-fix.patch
Normal file
12
net-snmp-5.8-dir-fix.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -urNp a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in
|
||||
--- a/net-snmp-create-v3-user.in 2018-07-18 11:11:53.227015237 +0200
|
||||
+++ b/net-snmp-create-v3-user.in 2018-07-18 11:12:13.375010176 +0200
|
||||
@@ -137,7 +137,7 @@ fi
|
||||
echo $line >> $outfile
|
||||
prefix="@prefix@"
|
||||
datarootdir="@datarootdir@"
|
||||
-outfile="@datadir@/snmp/snmpd.conf"
|
||||
+outfile="/etc/snmp/snmpd.conf"
|
||||
line="$token $user"
|
||||
echo "adding the following line to $outfile:"
|
||||
echo " " $line
|
||||
12
net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch
Normal file
12
net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -urNp a/apps/Makefile.in b/apps/Makefile.in
|
||||
--- a/apps/Makefile.in 2018-07-18 15:39:28.069251000 +0200
|
||||
+++ b/apps/Makefile.in 2018-07-18 15:54:52.261943123 +0200
|
||||
@@ -230,7 +230,7 @@ snmppcap$(EXEEXT): snmppcap.$(OSUFFIX
|
||||
$(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) $(LIB_LD_LIBS)
|
||||
+ $(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(MYSQL_LIB)
|
||||
$(RANLIB) $@
|
||||
|
||||
snmpinforminstall:
|
||||
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;
|
||||
}
|
||||
45
net-snmp-5.8-multilib.patch
Normal file
45
net-snmp-5.8-multilib.patch
Normal file
@ -0,0 +1,45 @@
|
||||
diff -urNp a/man/netsnmp_config_api.3.def b/man/netsnmp_config_api.3.def
|
||||
--- a/man/netsnmp_config_api.3.def 2018-07-18 11:18:06.196792766 +0200
|
||||
+++ b/man/netsnmp_config_api.3.def 2018-07-18 11:20:04.631679886 +0200
|
||||
@@ -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
|
||||
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 -urNp a/man/snmp_config.5.def b/man/snmp_config.5.def
|
||||
--- a/man/snmp_config.5.def 2018-07-18 11:18:06.194792767 +0200
|
||||
+++ b/man/snmp_config.5.def 2018-07-18 11:20:56.423626117 +0200
|
||||
@@ -10,7 +10,7 @@ First off, there are numerous places tha
|
||||
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 -urNp a/man/snmpd.conf.5.def b/man/snmpd.conf.5.def
|
||||
--- a/man/snmpd.conf.5.def 2018-07-18 11:18:06.196792766 +0200
|
||||
+++ b/man/snmpd.conf.5.def 2018-07-18 11:21:44.263574388 +0200
|
||||
@@ -1559,7 +1559,7 @@ filename), and call the initialisation r
|
||||
.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
|
||||
720
net-snmp-5.8-python3.patch
Normal file
720
net-snmp-5.8-python3.patch
Normal file
@ -0,0 +1,720 @@
|
||||
diff -urNp a/configure b/configure
|
||||
--- a/configure 2018-07-18 17:11:53.178147565 +0200
|
||||
+++ b/configure 2018-07-18 17:14:01.254774416 +0200
|
||||
@@ -7742,8 +7742,8 @@ $as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
-# Extract the first word of "python", so it can be a program name with args.
|
||||
-set dummy python; ac_word=$2
|
||||
+# Extract the first word of "python3", so it can be a program name with args.
|
||||
+set dummy python3; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_PYTHONPROG+:} false; then :
|
||||
diff -urNp a/configure.d/config_os_progs b/configure.d/config_os_progs
|
||||
--- a/configure.d/config_os_progs 2018-07-18 17:11:53.197147510 +0200
|
||||
+++ b/configure.d/config_os_progs 2018-07-18 17:14:29.963690646 +0200
|
||||
@@ -57,7 +57,7 @@ AC_PATH_PROG(AUTOCONF, autoconf, [:
|
||||
AC_PATH_PROG(AUTOHEADER, autoheader, [:])
|
||||
AC_PATH_PROG([PERLPROG], perl)
|
||||
AC_PATH_PROG([PSPROG], ps)
|
||||
-AC_PATH_PROG([PYTHONPROG],python)
|
||||
+AC_PATH_PROG([PYTHONPROG],python3)
|
||||
|
||||
AC_PATH_PROG([UNAMEPROG], uname)
|
||||
AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG", [Where is the uname command])
|
||||
diff -urNp a/Makefile.in b/Makefile.in
|
||||
--- a/Makefile.in 2018-07-18 17:11:53.175147574 +0200
|
||||
+++ b/Makefile.in 2018-07-18 17:16:21.331365317 +0200
|
||||
@@ -226,7 +226,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 -urNp a/python/netsnmp/client_intf.c b/python/netsnmp/client_intf.c
|
||||
--- a/python/netsnmp/client_intf.c 2018-07-18 17:11:53.262147321 +0200
|
||||
+++ b/python/netsnmp/client_intf.c 2018-07-18 17:33:16.495712833 +0200
|
||||
@@ -1,11 +1,5 @@
|
||||
#include <Python.h>
|
||||
|
||||
-#if PY_VERSION_HEX < 0x02050000
|
||||
-typedef int Py_ssize_t;
|
||||
-#define PY_SSIZE_T_MAX INT_MAX
|
||||
-#define PY_SSIZE_T_MIN INT_MIN
|
||||
-#endif
|
||||
-
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
#include <sys/types.h>
|
||||
@@ -852,8 +846,40 @@ py_netsnmp_attr_string(PyObject *obj, ch
|
||||
if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) {
|
||||
PyObject *attr = PyObject_GetAttrString(obj, attr_name);
|
||||
if (attr) {
|
||||
+ *val = PyUnicode_AsUTF8AndSize(attr, len);
|
||||
+ Py_DECREF(attr);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+py_netsnmp_attr_set_bytes(PyObject *obj, char *attr_name,
|
||||
+ char *val, size_t len)
|
||||
+{
|
||||
+ int ret = -1;
|
||||
+ if (obj && attr_name) {
|
||||
+ PyObject* val_obj = (val ?
|
||||
+ PyBytes_FromStringAndSize(val, len) :
|
||||
+ Py_BuildValue(""));
|
||||
+ ret = PyObject_SetAttrString(obj, attr_name, val_obj);
|
||||
+ Py_DECREF(val_obj);
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+py_netsnmp_attr_bytes(PyObject *obj, char * attr_name, char **val,
|
||||
+ Py_ssize_t *len)
|
||||
+{
|
||||
+ *val = NULL;
|
||||
+ if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) {
|
||||
+ PyObject *attr = PyObject_GetAttrString(obj, attr_name);
|
||||
+ if (attr) {
|
||||
int retval;
|
||||
- retval = PyString_AsStringAndSize(attr, val, len);
|
||||
+ retval = PyBytes_AsStringAndSize(attr, val, len);
|
||||
Py_DECREF(attr);
|
||||
return retval;
|
||||
}
|
||||
@@ -870,7 +896,7 @@ py_netsnmp_attr_long(PyObject *obj, char
|
||||
if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) {
|
||||
PyObject *attr = PyObject_GetAttrString(obj, attr_name);
|
||||
if (attr) {
|
||||
- val = PyInt_AsLong(attr);
|
||||
+ val = PyLong_AsLong(attr);
|
||||
Py_DECREF(attr);
|
||||
}
|
||||
}
|
||||
@@ -955,13 +981,13 @@ __py_netsnmp_update_session_errors(PyObj
|
||||
|
||||
py_netsnmp_attr_set_string(session, "ErrorStr", err_str, STRLEN(err_str));
|
||||
|
||||
- tmp_for_conversion = PyInt_FromLong(err_num);
|
||||
+ tmp_for_conversion = PyLong_FromLong(err_num);
|
||||
if (!tmp_for_conversion)
|
||||
return; /* nothing better to do? */
|
||||
PyObject_SetAttrString(session, "ErrorNum", tmp_for_conversion);
|
||||
Py_DECREF(tmp_for_conversion);
|
||||
|
||||
- tmp_for_conversion = PyInt_FromLong(err_ind);
|
||||
+ tmp_for_conversion = PyLong_FromLong(err_ind);
|
||||
if (!tmp_for_conversion)
|
||||
return; /* nothing better to do? */
|
||||
PyObject_SetAttrString(session, "ErrorInd", tmp_for_conversion);
|
||||
@@ -1323,7 +1349,7 @@ netsnmp_get(PyObject *self, PyObject *ar
|
||||
|
||||
ss = (SnmpSession *)py_netsnmp_attr_void_ptr(session, "sess_ptr");
|
||||
|
||||
- if (py_netsnmp_attr_string(session, "ErrorStr", &tmpstr, &tmplen) < 0) {
|
||||
+ if (py_netsnmp_attr_bytes(session, "ErrorStr", &tmpstr, &tmplen) < 0) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -2015,7 +2041,7 @@ netsnmp_walk(PyObject *self, PyObject *a
|
||||
vars, tp, type, sprintval_flag);
|
||||
str_buf[len] = '\0';
|
||||
|
||||
- py_netsnmp_attr_set_string(varbind, "val", (char *) str_buf,
|
||||
+ py_netsnmp_attr_set_bytes(varbind, "val", (char *) str_buf,
|
||||
len);
|
||||
|
||||
/* push the varbind onto the return varbinds */
|
||||
@@ -2266,7 +2292,7 @@ netsnmp_getbulk(PyObject *self, PyObject
|
||||
|
||||
__get_type_str(type, type_str);
|
||||
|
||||
- py_netsnmp_attr_set_string(varbind, "type", type_str,
|
||||
+ py_netsnmp_attr_set_bytes(varbind, "type", type_str,
|
||||
strlen(type_str));
|
||||
|
||||
len = __snprint_value((char **)&str_buf, &str_buf_len,
|
||||
@@ -2409,7 +2435,7 @@ netsnmp_set(PyObject *self, PyObject *ar
|
||||
}
|
||||
}
|
||||
|
||||
- if (py_netsnmp_attr_string(varbind, "val", &val, &tmplen) < 0) {
|
||||
+ if (py_netsnmp_attr_bytes(varbind, "val", &val, &tmplen) < 0) {
|
||||
snmp_free_pdu(pdu);
|
||||
goto done;
|
||||
}
|
||||
@@ -2467,7 +2493,6 @@ netsnmp_set(PyObject *self, PyObject *ar
|
||||
return (ret ? ret : Py_BuildValue(""));
|
||||
}
|
||||
|
||||
-
|
||||
static PyMethodDef ClientMethods[] = {
|
||||
{"session", netsnmp_create_session, METH_VARARGS,
|
||||
"create a netsnmp session."},
|
||||
@@ -2490,10 +2515,23 @@ static PyMethodDef ClientMethods[] = {
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
+static struct PyModuleDef ModuleDefinition = {
|
||||
+ PyModuleDef_HEAD_INIT,
|
||||
+ "client_intf",
|
||||
+ NULL,
|
||||
+ -1,
|
||||
+ ClientMethods,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ NULL
|
||||
+};
|
||||
+
|
||||
PyMODINIT_FUNC
|
||||
-initclient_intf(void)
|
||||
+PyInit_client_intf(void)
|
||||
{
|
||||
- (void) Py_InitModule("client_intf", ClientMethods);
|
||||
+ PyObject *module = PyModule_Create(&ModuleDefinition);
|
||||
+ return module;
|
||||
}
|
||||
|
||||
|
||||
diff -urNp a/python/netsnmp/client.py b/python/netsnmp/client.py
|
||||
--- a/python/netsnmp/client.py 2018-07-18 17:11:53.262147321 +0200
|
||||
+++ b/python/netsnmp/client.py 2018-07-18 17:37:10.489221397 +0200
|
||||
@@ -34,12 +34,12 @@ def _parse_session_args(kargs):
|
||||
'TheirHostname':'',
|
||||
'TrustCert':''
|
||||
}
|
||||
- keys = kargs.keys()
|
||||
+ keys = list(kargs.keys())
|
||||
for key in keys:
|
||||
- if sessArgs.has_key(key):
|
||||
+ if key in sessArgs:
|
||||
sessArgs[key] = kargs[key]
|
||||
else:
|
||||
- print >>stderr, "ERROR: unknown key", key
|
||||
+ print("ERROR: unknown key", key, file=stderr)
|
||||
return sessArgs
|
||||
|
||||
def STR(obj):
|
||||
@@ -55,7 +55,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:
|
||||
@@ -65,7 +65,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)
|
||||
@@ -132,7 +135,7 @@ class Session(object):
|
||||
|
||||
sess_args = _parse_session_args(args)
|
||||
|
||||
- for k, v in sess_args.items():
|
||||
+ for k, v in list(sess_args.items()):
|
||||
self.__dict__[k] = v
|
||||
|
||||
|
||||
diff -urNp a/python/netsnmp/__init__.py b/python/netsnmp/__init__.py
|
||||
--- a/python/netsnmp/__init__.py 2018-07-18 17:11:53.262147321 +0200
|
||||
+++ b/python/netsnmp/__init__.py 2018-07-18 17:37:32.553172525 +0200
|
||||
@@ -1 +1 @@
|
||||
-from client import *
|
||||
+from .client import *
|
||||
diff -urNp a/python/netsnmp/tests/test.py b/python/netsnmp/tests/test.py
|
||||
--- a/python/netsnmp/tests/test.py 2018-07-18 17:11:53.263147318 +0200
|
||||
+++ b/python/netsnmp/tests/test.py 2018-07-18 17:38:21.272063355 +0200
|
||||
@@ -12,7 +12,7 @@ def snmp_dest(**kwargs):
|
||||
'DestHost': 'localhost:' + os.environ.get("SNMP_SNMPD_PORT", 161),
|
||||
'Community': 'public',
|
||||
}
|
||||
- for key, value in kwargs.iteritems():
|
||||
+ for key, value in kwargs.items():
|
||||
dest[key] = value
|
||||
return dest
|
||||
|
||||
@@ -62,107 +62,107 @@ class BasicTests(unittest.TestCase):
|
||||
self.assertEqual(var.iid, '')
|
||||
|
||||
def test_v1_get(self):
|
||||
- print "\n"
|
||||
- print "---v1 GET tests -------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 GET tests -------------------------------------\n")
|
||||
var = netsnmp.Varbind('.1.3.6.1.2.1.1.1', '0')
|
||||
res = netsnmp.snmpget(var, **snmp_dest())
|
||||
|
||||
- print "v1 snmpget result: ", res, "\n"
|
||||
+ print("v1 snmpget result: ", res, "\n")
|
||||
self.assertEqual(len(res), 1)
|
||||
|
||||
- print "v1 get var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print("v1 get var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
self.assertEqual(var.tag, 'sysDescr')
|
||||
self.assertEqual(var.iid, '0')
|
||||
self.assertEqual(var.val, res[0])
|
||||
self.assertEqual(var.type, 'OCTETSTR')
|
||||
|
||||
def test_v1_getnext(self):
|
||||
- print "\n"
|
||||
- print "---v1 GETNEXT tests-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 GETNEXT tests-------------------------------------\n")
|
||||
var = netsnmp.Varbind('.1.3.6.1.2.1.1.1', '0')
|
||||
res = netsnmp.snmpgetnext(var, **snmp_dest())
|
||||
|
||||
- print "v1 snmpgetnext result: ", res, "\n"
|
||||
+ print("v1 snmpgetnext result: ", res, "\n")
|
||||
self.assertEqual(len(res), 1)
|
||||
|
||||
- print "v1 getnext var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print("v1 getnext var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
self.assertTrue(var.tag is not None)
|
||||
self.assertTrue(var.iid is not None)
|
||||
self.assertTrue(var.val is not None)
|
||||
self.assertTrue(var.type is not None)
|
||||
|
||||
def test_v1_set(self):
|
||||
- print "\n"
|
||||
- print "---v1 SET tests-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 SET tests-------------------------------------\n")
|
||||
var = netsnmp.Varbind('sysLocation', '0', 'my new location')
|
||||
res = netsnmp.snmpset(var, **snmp_dest())
|
||||
|
||||
- print "v1 snmpset result: ", res, "\n"
|
||||
+ print("v1 snmpset result: ", res, "\n")
|
||||
self.assertEqual(res, 1)
|
||||
|
||||
- print "v1 set var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print("v1 set var: ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
self.assertEqual(var.tag, 'sysLocation')
|
||||
self.assertEqual(var.iid, '0')
|
||||
self.assertEqual(var.val, 'my new location')
|
||||
self.assertTrue(var.type is None)
|
||||
|
||||
def test_v1_walk(self):
|
||||
- print "\n"
|
||||
- print "---v1 walk tests-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 walk tests-------------------------------------\n")
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('system'))
|
||||
|
||||
- print "v1 varlist walk in: "
|
||||
+ print("v1 varlist walk in: ")
|
||||
for var in varlist:
|
||||
- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
res = netsnmp.snmpwalk(varlist, **snmp_dest())
|
||||
- print "v1 snmpwalk result: ", res, "\n"
|
||||
+ print("v1 snmpwalk result: ", res, "\n")
|
||||
self.assertTrue(len(res) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
def test_v1_walk_2(self):
|
||||
- print "\n"
|
||||
- print "---v1 walk 2-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 walk 2-------------------------------------\n")
|
||||
|
||||
- print "v1 varbind walk in: "
|
||||
+ print("v1 varbind walk in: ")
|
||||
var = netsnmp.Varbind('system')
|
||||
self.assertEqual(var.tag, 'system')
|
||||
self.assertEqual(var.iid, '')
|
||||
self.assertEqual(var.val, None)
|
||||
self.assertEqual(var.type, None)
|
||||
res = netsnmp.snmpwalk(var, **snmp_dest())
|
||||
- print "v1 snmpwalk result (should be = orig): ", res, "\n"
|
||||
+ print("v1 snmpwalk result (should be = orig): ", res, "\n")
|
||||
self.assertTrue(len(res) > 0)
|
||||
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
self.assertEqual(var.tag, 'system')
|
||||
self.assertEqual(var.iid, '')
|
||||
self.assertEqual(var.val, None)
|
||||
self.assertEqual(var.type, None)
|
||||
|
||||
def test_v1_mv_get(self):
|
||||
- print "\n"
|
||||
- print "---v1 multi-varbind test-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 multi-varbind test-------------------------------------\n")
|
||||
sess = setup_v1()
|
||||
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0),
|
||||
netsnmp.Varbind('sysContact', 0),
|
||||
netsnmp.Varbind('sysLocation', 0))
|
||||
vals = sess.get(varlist)
|
||||
- print "v1 sess.get result: ", vals, "\n"
|
||||
+ print("v1 sess.get result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
vals = sess.getnext(varlist)
|
||||
- print "v1 sess.getnext result: ", vals, "\n"
|
||||
+ print("v1 sess.getnext result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime'),
|
||||
netsnmp.Varbind('sysORLastChange'),
|
||||
@@ -171,71 +171,71 @@ class BasicTests(unittest.TestCase):
|
||||
netsnmp.Varbind('sysORUpTime'))
|
||||
|
||||
vals = sess.getbulk(2, 8, varlist)
|
||||
- print "v1 sess.getbulk result: ", vals, "\n"
|
||||
+ print("v1 sess.getbulk result: ", vals, "\n")
|
||||
self.assertEqual(vals, None) # GetBulk is not supported for v1
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
def test_v1_set_2(self):
|
||||
- print "\n"
|
||||
- print "---v1 set2-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 set2-------------------------------------\n")
|
||||
|
||||
sess = setup_v1()
|
||||
varlist = netsnmp.VarList(
|
||||
netsnmp.Varbind('sysLocation', '0', 'my newer location'))
|
||||
res = sess.set(varlist)
|
||||
- print "v1 sess.set result: ", res, "\n"
|
||||
+ print("v1 sess.set result: ", res, "\n")
|
||||
|
||||
def test_v1_walk_3(self):
|
||||
- print "\n"
|
||||
- print "---v1 walk3-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v1 walk3-------------------------------------\n")
|
||||
|
||||
sess = setup_v1()
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('system'))
|
||||
|
||||
vals = sess.walk(varlist)
|
||||
- print "v1 sess.walk result: ", vals, "\n"
|
||||
+ print("v1 sess.walk result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
def test_v2c_get(self):
|
||||
- print "\n"
|
||||
- print "---v2c get-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v2c get-------------------------------------\n")
|
||||
|
||||
sess = setup_v2()
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0),
|
||||
netsnmp.Varbind('sysContact', 0),
|
||||
netsnmp.Varbind('sysLocation', 0))
|
||||
vals = sess.get(varlist)
|
||||
- print "v2 sess.get result: ", vals, "\n"
|
||||
+ print("v2 sess.get result: ", vals, "\n")
|
||||
self.assertEqual(len(vals), 3)
|
||||
|
||||
def test_v2c_getnext(self):
|
||||
- print "\n"
|
||||
- print "---v2c getnext-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v2c getnext-------------------------------------\n")
|
||||
|
||||
sess = setup_v2()
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0),
|
||||
netsnmp.Varbind('sysContact', 0),
|
||||
netsnmp.Varbind('sysLocation', 0))
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
vals = sess.getnext(varlist)
|
||||
- print "v2 sess.getnext result: ", vals, "\n"
|
||||
+ print("v2 sess.getnext result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
def test_v2c_getbulk(self):
|
||||
- print "\n"
|
||||
- print "---v2c getbulk-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v2c getbulk-------------------------------------\n")
|
||||
|
||||
sess = setup_v2()
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime'),
|
||||
@@ -245,16 +245,16 @@ class BasicTests(unittest.TestCase):
|
||||
netsnmp.Varbind('sysORUpTime'))
|
||||
|
||||
vals = sess.getbulk(2, 8, varlist)
|
||||
- print "v2 sess.getbulk result: ", vals, "\n"
|
||||
+ print("v2 sess.getbulk result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
def test_v2c_set(self):
|
||||
- print "\n"
|
||||
- print "---v2c set-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v2c set-------------------------------------\n")
|
||||
|
||||
sess = setup_v2()
|
||||
|
||||
@@ -262,54 +262,54 @@ class BasicTests(unittest.TestCase):
|
||||
netsnmp.Varbind('sysLocation', '0', 'my even newer location'))
|
||||
|
||||
res = sess.set(varlist)
|
||||
- print "v2 sess.set result: ", res, "\n"
|
||||
+ print("v2 sess.set result: ", res, "\n")
|
||||
self.assertEqual(res, 1)
|
||||
|
||||
def test_v2c_walk(self):
|
||||
- print "\n"
|
||||
- print "---v2c walk-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v2c walk-------------------------------------\n")
|
||||
|
||||
sess = setup_v2()
|
||||
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('system'))
|
||||
|
||||
vals = sess.walk(varlist)
|
||||
- print "v2 sess.walk result: ", vals, "\n"
|
||||
+ print("v2 sess.walk result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
def test_v3_get(self):
|
||||
- print "\n"
|
||||
+ print("\n")
|
||||
sess = setup_v3();
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0),
|
||||
netsnmp.Varbind('sysContact', 0),
|
||||
netsnmp.Varbind('sysLocation', 0))
|
||||
- print "---v3 get-------------------------------------\n"
|
||||
+ print("---v3 get-------------------------------------\n")
|
||||
vals = sess.get(varlist)
|
||||
- print "v3 sess.get result: ", vals, "\n"
|
||||
+ print("v3 sess.get result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
def test_v3_getnext(self):
|
||||
- print "\n"
|
||||
- print "---v3 getnext-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v3 getnext-------------------------------------\n")
|
||||
|
||||
sess = setup_v3();
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0),
|
||||
netsnmp.Varbind('sysContact', 0),
|
||||
netsnmp.Varbind('sysLocation', 0))
|
||||
vals = sess.getnext(varlist)
|
||||
- print "v3 sess.getnext result: ", vals, "\n"
|
||||
+ print("v3 sess.getnext result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
def test_v3_getbulk(self):
|
||||
sess = setup_v3();
|
||||
@@ -320,47 +320,47 @@ class BasicTests(unittest.TestCase):
|
||||
netsnmp.Varbind('sysORUpTime'))
|
||||
|
||||
vals = sess.getbulk(2, 8, varlist)
|
||||
- print "v3 sess.getbulk result: ", vals, "\n"
|
||||
+ print("v3 sess.getbulk result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
def test_v3_set(self):
|
||||
- print "\n"
|
||||
- print "---v3 set-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v3 set-------------------------------------\n")
|
||||
|
||||
sess = setup_v3();
|
||||
varlist = netsnmp.VarList(
|
||||
netsnmp.Varbind('sysLocation', '0', 'my final destination'))
|
||||
res = sess.set(varlist)
|
||||
- print "v3 sess.set result: ", res, "\n"
|
||||
+ print("v3 sess.set result: ", res, "\n")
|
||||
self.assertEqual(res, 1)
|
||||
|
||||
def test_v3_walk(self):
|
||||
- print "\n"
|
||||
- print "---v3 walk-------------------------------------\n"
|
||||
+ print("\n")
|
||||
+ print("---v3 walk-------------------------------------\n")
|
||||
sess = setup_v3();
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('system'))
|
||||
|
||||
vals = sess.walk(varlist)
|
||||
- print "v3 sess.walk result: ", vals, "\n"
|
||||
+ print("v3 sess.walk result: ", vals, "\n")
|
||||
self.assertTrue(len(vals) > 0)
|
||||
|
||||
for var in varlist:
|
||||
- print " ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print(" ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
|
||||
|
||||
class SetTests(unittest.TestCase):
|
||||
"""SNMP set tests for the Net-SNMP Python interface"""
|
||||
def testFuncs(self):
|
||||
"""Test code"""
|
||||
- print "\n-------------- SET Test Start ----------------------------\n"
|
||||
+ print("\n-------------- SET Test Start ----------------------------\n")
|
||||
|
||||
var = netsnmp.Varbind('sysUpTime', '0')
|
||||
res = netsnmp.snmpget(var, **snmp_dest())
|
||||
- print "uptime = ", res[0]
|
||||
+ print("uptime = ", res[0])
|
||||
self.assertEqual(len(res), 1)
|
||||
|
||||
|
||||
@@ -370,19 +370,19 @@ class SetTests(unittest.TestCase):
|
||||
|
||||
var = netsnmp.Varbind('sysUpTime', '0')
|
||||
res = netsnmp.snmpget(var, **snmp_dest())
|
||||
- print "uptime = ", res[0]
|
||||
+ print("uptime = ", res[0])
|
||||
self.assertEqual(len(res), 1)
|
||||
|
||||
var = netsnmp.Varbind('nsCacheEntry')
|
||||
res = netsnmp.snmpgetnext(var, **snmp_dest())
|
||||
- print "var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print("var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
self.assertEqual(len(res), 1)
|
||||
|
||||
var.val = 65
|
||||
res = netsnmp.snmpset(var, **snmp_dest())
|
||||
self.assertEqual(res, 1)
|
||||
res = netsnmp.snmpget(var, **snmp_dest())
|
||||
- print "var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
+ print("var = ", var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
self.assertEqual(len(res), 1)
|
||||
self.assertEqual(res[0], '65');
|
||||
|
||||
@@ -394,7 +394,7 @@ class SetTests(unittest.TestCase):
|
||||
netsnmp.Varbind('.1.3.6.1.6.3.12.1.2.1.9.116.101.115.116', '', 4))
|
||||
res = sess.set(varlist)
|
||||
|
||||
- print "res = ", res
|
||||
+ print("res = ", res)
|
||||
self.assertEqual(res, 1)
|
||||
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('snmpTargetAddrTDomain'),
|
||||
@@ -414,15 +414,15 @@ class SetTests(unittest.TestCase):
|
||||
self.assertEqual(varlist[2].val, '3')
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
varlist = netsnmp.VarList(
|
||||
netsnmp.Varbind('.1.3.6.1.6.3.12.1.2.1.9.116.101.115.116', '', 6))
|
||||
|
||||
res = sess.set(varlist)
|
||||
|
||||
- print "res = ", res
|
||||
+ print("res = ", res)
|
||||
self.assertEqual(res, 1)
|
||||
|
||||
varlist = netsnmp.VarList(netsnmp.Varbind('snmpTargetAddrTDomain'),
|
||||
@@ -436,10 +436,10 @@ class SetTests(unittest.TestCase):
|
||||
self.assertNotEqual(varlist[2].tag, 'snmpTargetAddrRowStatus')
|
||||
|
||||
for var in varlist:
|
||||
- print var.tag, var.iid, "=", var.val, '(', var.type, ')'
|
||||
- print "\n"
|
||||
+ print(var.tag, var.iid, "=", var.val, '(', var.type, ')')
|
||||
+ print("\n")
|
||||
|
||||
- print "\n-------------- SET Test End ----------------------------\n"
|
||||
+ print("\n-------------- SET Test End ----------------------------\n")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
diff -urNp a/python/setup.py b/python/setup.py
|
||||
--- a/python/setup.py 2018-07-18 17:11:53.262147321 +0200
|
||||
+++ b/python/setup.py 2018-07-18 17:40:36.922751382 +0200
|
||||
@@ -9,9 +9,9 @@ intree=0
|
||||
|
||||
args = sys.argv[:]
|
||||
for arg in args:
|
||||
- if string.find(arg,'--basedir=') == 0:
|
||||
- basedir = string.split(arg,'=')[1]
|
||||
- sys.argv.remove(arg)
|
||||
+ if arg.find('--basedir=') == 0:
|
||||
+ basedir = arg.split('=')[1]
|
||||
+ sys.argv.remove(arg) #tabs
|
||||
intree=1
|
||||
|
||||
if intree:
|
||||
30
net-snmp-5.8-test-debug.patch
Normal file
30
net-snmp-5.8-test-debug.patch
Normal file
@ -0,0 +1,30 @@
|
||||
Don't check tests which depend on DNS - it's disabled in Koji
|
||||
|
||||
diff -urNp a/testing/fulltests/default/T070com2sec_simple b/testing/fulltests/default/T070com2sec_simple
|
||||
--- a/testing/fulltests/default/T070com2sec_simple 2018-07-18 11:52:56.081185545 +0200
|
||||
+++ b/testing/fulltests/default/T070com2sec_simple 2018-07-18 11:54:18.843968880 +0200
|
||||
@@ -134,6 +134,10 @@ SAVECHECKAGENT '<"c406a", 255.255.255.25
|
||||
SAVECHECKAGENT 'line 30: Error:' # msg from h_strerror so it varies
|
||||
SAVECHECKAGENT 'line 31: Error:' # msg from h_strerror so it varies
|
||||
|
||||
+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:'
|
||||
diff -urNp a/testing/fulltests/default/T071com2sec6_simple b/testing/fulltests/default/T071com2sec6_simple
|
||||
--- a/testing/fulltests/default/T071com2sec6_simple 2018-07-18 11:52:56.080185548 +0200
|
||||
+++ b/testing/fulltests/default/T071com2sec6_simple 2018-07-18 11:55:17.779818732 +0200
|
||||
@@ -132,6 +132,10 @@ SAVECHECKAGENT '<"c606a", ffff:ffff:ffff
|
||||
SAVECHECKAGENT 'line 27: Error:'
|
||||
SAVECHECKAGENT 'line 28: Error:'
|
||||
|
||||
+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
|
||||
BIN
net-snmp-5.8.tar.gz
Normal file
BIN
net-snmp-5.8.tar.gz
Normal file
Binary file not shown.
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".
|
||||
316
net-snmp.spec
Normal file
316
net-snmp.spec
Normal file
@ -0,0 +1,316 @@
|
||||
%{!?netsnmp_check: %global netsnmp_check 1}
|
||||
%global multilib_arches x86_64 aarch64
|
||||
|
||||
Name: net-snmp
|
||||
Version: 5.8
|
||||
Release: 4
|
||||
Epoch: 1
|
||||
Summary: SNMP Daemon
|
||||
License: BSD
|
||||
URL: http://net-snmp.sourceforge.net/
|
||||
Source0: https://sourceforge.net/projects/net-snmp/files/net-snmp/%{version}/net-snmp-%{version}.tar.gz
|
||||
Source1: net-snmp.redhat.conf
|
||||
Source2: net-snmp-config.h
|
||||
Source3: net-snmp-config
|
||||
Source4: net-snmp-trapd.redhat.conf
|
||||
Source5: net-snmpd.sysconfig
|
||||
Source6: net-snmptrapd.sysconfig
|
||||
Source7: net-snmp-tmpfs.conf
|
||||
Source8: snmpd.service
|
||||
Source9: snmptrapd.service
|
||||
Source10: IETF-MIB-LICENSE.txt
|
||||
# These patches are from fedora29
|
||||
Patch1: net-snmp-5.7.2-pie.patch
|
||||
Patch2: net-snmp-5.8-dir-fix.patch
|
||||
Patch3: net-snmp-5.8-multilib.patch
|
||||
Patch4: net-snmp-5.8-test-debug.patch
|
||||
Patch5: net-snmp-5.7.2-autoreconf.patch
|
||||
Patch6: net-snmp-5.8-agentx-disconnect-crash.patch
|
||||
Patch7: net-snmp-5.7.2-cert-path.patch
|
||||
Patch8: net-snmp-5.8-cflags.patch
|
||||
Patch9: net-snmp-5.8-Remove-U64-typedef.patch
|
||||
Patch10: net-snmp-5.8-libnetsnmptrapd-against-MYSQL_LIBS.patch
|
||||
Patch11: net-snmp-5.7.3-iterator-fix.patch
|
||||
Patch12: net-snmp-5.8-autofs-skip.patch
|
||||
Patch101: net-snmp-5.8-modern-rpm-api.patch
|
||||
Patch102: net-snmp-5.8-python3.patch
|
||||
|
||||
%{?systemd_requires}
|
||||
BuildRequires: systemd gcc openssl-devel bzip2-devel elfutils-devel libselinux-devel
|
||||
BuildRequires: elfutils-libelf-devel rpm-devel perl-devel perl(ExtUtils::Embed) procps
|
||||
BuildRequires: python3-devel python3-setuptools chrpath mariadb-connector-c-devel net-tools
|
||||
BuildRequires: perl(TAP::Harness) lm_sensors-devel autoconf automake
|
||||
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
|
||||
|
||||
Provides: %{name}-libs
|
||||
Obsoletes: %{name}-libs
|
||||
Provides: %{name}-utils
|
||||
Obsoletes: %{name}-utils
|
||||
Provides: %{name}-agent-libs
|
||||
Obsoletes: %{name}-agent-libs
|
||||
|
||||
%description
|
||||
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
|
||||
and SNMP v3 using both IPv4 and IPv6. The suite includes:
|
||||
|
||||
- An extensible agent for responding to SNMP queries including built-in
|
||||
support for a wide range of MIB information modules
|
||||
- Command-line applications to retrieve and manipulate information from
|
||||
SNMP-capable devices
|
||||
- A daemon application for receiving SNMP notifications
|
||||
- A library for developing new SNMP applications, with C and Perl APIs
|
||||
- A graphical MIB browser.
|
||||
|
||||
%package devel
|
||||
Summary: Development files and Header files for %{name}
|
||||
Requires: %{name} = %{epoch}:%{version}-%{release}
|
||||
Requires: elfutils-devel rpm-devel elfutils-libelf-devel openssl-devel
|
||||
Requires: lm_sensors-devel perl-devel
|
||||
|
||||
%description devel
|
||||
The %{name}-devel package contains libraries and header files for
|
||||
developing applications that use %{name}.
|
||||
|
||||
%package perl
|
||||
Summary: Perl5 SNMP Extension Module
|
||||
Requires: %{name} = %{epoch}:%{version}-%{release} perl-interpreter
|
||||
BuildRequires: perl-interpreter perl-generators
|
||||
|
||||
%description perl
|
||||
The Perl5 'SNMP' Extension Module v3.1.0 for the UCD SNMPv3 library.
|
||||
|
||||
%package gui
|
||||
Summary: An interactive graphical MIB browser for SNMP
|
||||
Requires: perl-Tk net-snmp-perl = %{epoch}:%{version}-%{release}
|
||||
|
||||
%description gui
|
||||
The %{name}-gui package contains tkmib utility. It is also
|
||||
capable of sending or retrieving the SNMP management information
|
||||
to/from the remote agents interactively.
|
||||
|
||||
%package -n python3-net-snmp
|
||||
%{?python_provide:%python_provide python3-net-snmp}
|
||||
Provides: %{name}-python = %{version}-%{release}
|
||||
Provides: %{name}-python%{?_isa} = %{version}-%{release}
|
||||
Obsoletes: %{name}-python < %{version}-%{release}
|
||||
Summary: The Python 'netsnmp' module for the Net-SNMP
|
||||
Requires: %{name} = %{epoch}:%{version}-%{release}
|
||||
|
||||
%description -n python3-net-snmp
|
||||
The 'netsnmp' module provides a full featured, tri-lingual SNMP (SNMPv3,
|
||||
SNMPv2c, SNMPv1) client API. The 'netsnmp' module internals rely on the
|
||||
Net-SNMP toolkit library.
|
||||
%package_help
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
cp %{SOURCE10} .
|
||||
|
||||
%build
|
||||
autoreconf
|
||||
MIBS="host agentx smux \
|
||||
ucd-snmp/diskio tcp-mib udp-mib mibII/mta_sendmail \
|
||||
ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
|
||||
ip-mib/ipAddressPrefixTable/ipAddressPrefixTable \
|
||||
ip-mib/ipDefaultRouterTable/ipDefaultRouterTable \
|
||||
ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable \
|
||||
sctp-mib rmon-mib etherlike-mib"
|
||||
MIBS="$MIBS ucd-snmp/lmsensorsMib"
|
||||
%configure --enable-shared --enable-as-needed --enable-embedded-perl \
|
||||
--enable-ipv6 --enable-local-smux --enable-mfd-rewrites \
|
||||
--enable-ucd-snmp-compatibility --sysconfdir=%{_sysconfdir} \
|
||||
--with-cflags="$RPM_OPT_FLAGS -D_RPM_4_4_COMPAT" \
|
||||
--with-ldflags="-Wl,-z,relro -Wl,-z,now" \
|
||||
--with-logfile="/var/log/snmpd.log" \
|
||||
--with-mib-modules="$MIBS" --with-mysql \
|
||||
--with-openssl --with-persistent-directory="/var/lib/net-snmp" \
|
||||
--with-perl-modules="INSTALLDIRS=vendor" --with-pic \
|
||||
--with-security-modules=tsm --with-sys-location="Unknown" \
|
||||
--with-systemd --with-temp-file-pattern=/var/run/net-snmp/snmp-tmp-XXXXXX \
|
||||
--with-transports="DTLSUDP TLSTCP" --with-sys-contact="root@localhost" <<EOF
|
||||
EOF
|
||||
cp libtool libtool.orig
|
||||
|
||||
%disable_rpath
|
||||
|
||||
make
|
||||
|
||||
find perl/blib -type f -name "*.so" -print -exec chrpath --delete {} \;
|
||||
|
||||
pushd python
|
||||
%{__python3} setup.py --basedir="../" build
|
||||
popd
|
||||
|
||||
%install
|
||||
make install DESTDIR=%{buildroot}
|
||||
|
||||
basearch=%{_arch}
|
||||
|
||||
%ifarch %{multilib_arches}
|
||||
mv %{buildroot}/%{_bindir}/net-snmp-config %{buildroot}/%{_bindir}/net-snmp-config-${basearch}
|
||||
install -m 755 %SOURCE3 %{buildroot}/%{_bindir}/net-snmp-config
|
||||
mv %{buildroot}/%{_includedir}/net-snmp/net-snmp-config.h %{buildroot}/%{_includedir}/net-snmp/net-snmp-config-${basearch}.h
|
||||
install -m644 %SOURCE2 %{buildroot}/%{_includedir}/net-snmp/net-snmp-config.h
|
||||
%endif
|
||||
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/snmp
|
||||
install -m 644 %SOURCE1 %{buildroot}%{_sysconfdir}/snmp/snmpd.conf
|
||||
install -m 644 %SOURCE4 %{buildroot}%{_sysconfdir}/snmp/snmptrapd.conf
|
||||
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
|
||||
install -m 644 %SOURCE5 %{buildroot}%{_sysconfdir}/sysconfig/snmpd
|
||||
install -m 644 %SOURCE6 %{buildroot}%{_sysconfdir}/sysconfig/snmptrapd
|
||||
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/net-snmp/mib_indexes
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/net-snmp/cert_indexes
|
||||
mkdir -p %{buildroot}%{_localstatedir}/run/net-snmp
|
||||
|
||||
rm -f %{buildroot}%{_bindir}/snmpinform
|
||||
ln -s snmptrap %{buildroot}%{_bindir}/snmpinform
|
||||
%delete_la_and_a
|
||||
|
||||
find %{buildroot} -name perllocal.pod -o -name .packlist -o -name "*.bs" \
|
||||
-o -name Makefile.subs.pl | xargs -ri rm -f {}
|
||||
|
||||
install -m 644 local/mib2c.*.conf %{buildroot}%{_datadir}/snmp
|
||||
|
||||
pushd python
|
||||
%{__python3} setup.py --basedir=.. install -O1 --skip-build --root %{buildroot}
|
||||
popd
|
||||
|
||||
find %{buildroot} -name '*.so' | xargs chmod 0755
|
||||
dd bs=1024 count=250 if=ChangeLog of=ChangeLog.trimmed
|
||||
|
||||
for file in README COPYING; do
|
||||
iconv -f 8859_1 -t UTF-8 <$file >$file.utf8
|
||||
mv $file.utf8 $file
|
||||
done
|
||||
chmod 644 local/passtest local/ipf-mod.pl
|
||||
mkdir -p %{buildroot}/usr/include/net-snmp/agent/util_funcs
|
||||
install -m 644 agent/mibgroup/util_funcs/*.h %{buildroot}/usr/include/net-snmp/agent/util_funcs
|
||||
|
||||
mkdir -p %{buildroot}/%{_tmpfilesdir}
|
||||
install -m 644 %SOURCE7 %{buildroot}/%{_tmpfilesdir}/net-snmp.conf
|
||||
mkdir -p %{buildroot}/%{_unitdir}
|
||||
install -m 644 %SOURCE8 %SOURCE9 %{buildroot}/%{_unitdir}/
|
||||
|
||||
%check
|
||||
%if %{netsnmp_check}
|
||||
cp -f libtool.orig libtool
|
||||
chmod 755 local/passtest
|
||||
LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
||||
%endif
|
||||
|
||||
%post
|
||||
%systemd_post snmpd.service snmptrapd.service
|
||||
|
||||
%preun
|
||||
%systemd_preun snmpd.service snmptrapd.service
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart snmpd.service snmptrapd.service
|
||||
|
||||
%ldconfig_scriptlets
|
||||
|
||||
%files
|
||||
%doc COPYING
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/snmpd
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/snmptrapd
|
||||
%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/snmp/snmpd.conf
|
||||
%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/snmp/snmptrapd.conf
|
||||
%{_bindir}/agentxtrap
|
||||
%{_prefix}/lib/systemd/system/*.service
|
||||
%{_prefix}/lib/tmpfiles.d/net-snmp.conf
|
||||
%{_libdir}/libnetsnmp.so.*
|
||||
%{_sbindir}/snmp*
|
||||
%{_datadir}/snmp/snmpconf-data/*
|
||||
%{_bindir}/net-snmp-create-v3-user
|
||||
%{_bindir}/snmpconf
|
||||
%{_bindir}/snmp[^c-]*
|
||||
%{_bindir}/encode_keychange
|
||||
%dir /var/run/net-snmp
|
||||
%{_datadir}/snmp/mibs/*
|
||||
%dir %{_localstatedir}/lib/net-snmp
|
||||
%dir %{_localstatedir}/lib/net-snmp/mib_indexes
|
||||
%dir %{_localstatedir}/lib/net-snmp/cert_indexes
|
||||
%{_libdir}/libnetsnmpagent.so.*
|
||||
%{_libdir}/libnetsnmphelpers.so.*
|
||||
%{_libdir}/libnetsnmpmibs.so.*
|
||||
%{_libdir}/libnetsnmptrapd.so.*
|
||||
%exclude %{_prefix}/lib/debug/usr/sbin/snmptrapd-5.8-1.oe1.aarch64.debug
|
||||
%exclude %{_bindir}/ipf-mod.pl
|
||||
%exclude %{_bindir}/fixproc
|
||||
%exclude %{_bindir}/snmpcheck
|
||||
%exclude %{_libdir}/libsnmp*
|
||||
|
||||
%files devel
|
||||
%attr(0644,root,root)
|
||||
%attr(0755,root,root) %{_bindir}/net-snmp-config*
|
||||
%{_includedir}/net-snmp/*
|
||||
%{_includedir}/ucd-snmp/*.h
|
||||
%{_libdir}/libnet*.so
|
||||
|
||||
%files perl
|
||||
%{_bindir}/mib2c*
|
||||
%{_bindir}/net-snmp-cert
|
||||
%{_bindir}/checkbandwidth
|
||||
%{_bindir}/snmp-bridge-mib
|
||||
%{_bindir}/traptoemail
|
||||
%{_libdir}/perl5/vendor_perl/auto/*SNMP/*
|
||||
%dir %{_libdir}/perl5/vendor_perl/auto/Bundle/NetSNMP
|
||||
%{_libdir}/perl5/vendor_perl/Bundle/MakefileSubs.pm
|
||||
%{_libdir}/perl5/vendor_perl/NetSNMP/*.pm
|
||||
%{_libdir}/perl5/vendor_perl/NetSNMP/agent/*.pm
|
||||
%{_libdir}/perl5/vendor_perl/SNMP.pm
|
||||
%{_datadir}/snmp/mib2c-data/*
|
||||
%{_datadir}/snmp/mib2c*.conf
|
||||
%{_datadir}/snmp/snmp_perl*
|
||||
|
||||
%files gui
|
||||
%{_bindir}/tkmib
|
||||
%attr(0644,root,root) %{_mandir}/man1/tkmib.1.gz
|
||||
|
||||
%files -n python3-net-snmp
|
||||
%doc README
|
||||
%{_libdir}/python3.7/site-packages/*
|
||||
|
||||
%files help
|
||||
%doc ChangeLog.trimmed EXAMPLE.conf FAQ NEWS TODO README.snmpv3
|
||||
%doc README README.agent-mibs README.agentx README.krb5
|
||||
%doc local/passtest local/ipf-mod.pl IETF-MIB-LICENSE.txt
|
||||
%doc README.thread AGENT.txt PORTING local/README.mib2c
|
||||
%doc README.aix README.hpux11 README.osX README.Panasonic_AM3X.txt README.solaris README.win32
|
||||
%attr(0644,root,root)
|
||||
%{_mandir}/man1/agentxtrap.1.gz
|
||||
%{_mandir}/man1/net-snmp-create-v3-user.1.gz
|
||||
%{_mandir}/man1/snmpconf.1.gz
|
||||
%{_mandir}/man5/snmp*.5.gz
|
||||
%{_mandir}/man5/variables.5.gz
|
||||
%{_mandir}/man8/snmp*.8.gz
|
||||
%{_mandir}/man1/snmp*.1.gz
|
||||
%{_mandir}/man1/encode_keychange.1.gz
|
||||
%{_mandir}/man5/variables.5.gz
|
||||
%{_mandir}/man5/snmp.conf.5.gz
|
||||
%{_mandir}/man1/net-snmp-config.1.gz
|
||||
%{_mandir}/man3/*.3.gz
|
||||
%{_mandir}/man1/mib2c*.1.gz
|
||||
%{_mandir}/man1/snmp-bridge-mib.1.gz
|
||||
%{_mandir}/man1/traptoemail.1.gz
|
||||
%{_mandir}/man3/NetSNMP*.3pm.gz
|
||||
%{_mandir}/man5/mib2c.conf.5.gz
|
||||
%{_mandir}/man1/fixproc*
|
||||
|
||||
%changelog
|
||||
* Wed Sep 25 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.8-4
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
|
||||
* Tue Sep 24 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.8-3
|
||||
- Type:version fallback
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
|
||||
* Mon Sep 23 2019 openEuler Buildteam <buildteam@openeuler.org> - 5.8-2
|
||||
- Package init
|
||||
|
||||
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.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.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
|
||||
Loading…
x
Reference in New Issue
Block a user