Hello community, here is the log from the commit of package cacti-spine for openSUSE:Factory checked in at 2019-09-04 09:12:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cacti-spine (Old) and /work/SRC/openSUSE:Factory/.cacti-spine.new.7948 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cacti-spine" Wed Sep 4 09:12:21 2019 rev:22 rq:727765 version:1.2.6 Changes: -------- --- /work/SRC/openSUSE:Factory/cacti-spine/cacti-spine.changes 2019-07-22 12:19:37.343676459 +0200 +++ /work/SRC/openSUSE:Factory/.cacti-spine.new.7948/cacti-spine.changes 2019-09-04 09:12:50.274959035 +0200 @@ -1,0 +2,15 @@ +Mon Sep 2 12:36:11 UTC 2019 - David Liedke <[email protected]> + +-Update to version 1.2.6 + -issue#101: MySQL 8 has retired 'my_bool' type + -issue#104: Spine should report which threads are outstanding + -issue#105: Spine should include 'Process[<id>]' in standard logging + -issue#107: Log Buffer is too small to handle some output + -issue#108: Once an SNMP timeout is reached, snmp_get does not honor + include_host + -issue#109: Initial declarations inside for loop cause compile errors + -issue#110: When compiling, 'directive output may be truncated' + messages can appear + -issue#112: INSTALL instructions have typo in bootstrap command + +------------------------------------------------------------------- Old: ---- 1.2.5.tar.gz New: ---- 1.2.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cacti-spine.spec ++++++ --- /var/tmp/diff_new_pack.GVXnU1/_old 2019-09-04 09:12:50.710958973 +0200 +++ /var/tmp/diff_new_pack.GVXnU1/_new 2019-09-04 09:12:50.710958973 +0200 @@ -17,7 +17,7 @@ Name: cacti-spine -Version: 1.2.5 +Version: 1.2.6 Release: 0 Url: https://github.com/Cacti/spine Source: https://github.com/Cacti/spine/archive/release/%{version}.tar.gz ++++++ 1.2.5.tar.gz -> 1.2.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spine-release-1.2.5/CHANGELOG new/spine-release-1.2.6/CHANGELOG --- old/spine-release-1.2.5/CHANGELOG 2019-07-15 15:06:07.000000000 +0200 +++ new/spine-release-1.2.6/CHANGELOG 2019-09-02 02:09:08.000000000 +0200 @@ -1,5 +1,15 @@ The Cacti Group | spine +1.2.6 +-issue#101: MySQL 8 has retired 'my_bool' type +-issue#104: Spine should report which threads are outstanding +-issue#105: Spine should include 'Process[<id>]' in standard logging +-issue#107: Log Buffer is too small to handle some output +-issue#108: Once an SNMP timeout is reached, snmp_get does not honor include_host +-issue#109: Initial declarations inside for loop cause compile errors +-issue#110: When compiling, 'directive output may be truncated' messages can appear +-issue#112: INSTALL instructions have typo in bootstrap command + 1.2.5 -issue: Improve detection of MySQL vs. MariaDB client library requirement -issue#98: Checking type in poller.c causes compiler error @@ -93,7 +103,7 @@ 1.1.19 -feature: release to match Cacti release -1.1.18 +1.1.18 -issue: Sort devices by polling time to allow long running devices to go first 1.1.17 @@ -190,21 +200,21 @@ -bug:0002639: Spine does not respect snmp_retries from the database -bug:0002640: Spine crashes randomly while polling using multiple threads on one device -bug:0002549: Spine: hasCaps() always returns FALSE --bug:0002638: Spine: ping_udp() uses uninitialised socket timeout +-bug:0002638: Spine: ping_udp() uses uninitialised socket timeout -bug:0002654: On RHEL 6.5, spine ./configure builds Makefile without crypto support 0.8.8f -bug:0002604: cacti-spine, configure script ignores LDFLAGS in certain situations 0.8.8e --bug#0002185: Multiple memory leaks found in spine +-bug#0002185: Multiple memory leaks found in spine -bug#0002398: Buffer overflow --bug#0002447: Building spine on Debian Jessie (testing) fails +-bug#0002447: Building spine on Debian Jessie (testing) fails -bug#0002536: Spine segfaults when 18k+ hosts are to be pulled -bug#0002576: Call to a non-existent column of the database in poller.c -bug#0002578: spine doesn't compile on ubuntu 12.04 -bug#0002585: Spine: buffer overflow in logging when RESULTS_BUFFER>LOGSIZE can SEGV --bug#0002588: Spine "is_numeric" incorrectly returns TRUE for some hexadecimal values +-bug#0002588: Spine "is_numeric" incorrectly returns TRUE for some hexadecimal values 0.8.8d -feature: add snmp system information gathering @@ -230,12 +240,12 @@ -feature: Add a reconnect capability when the mysql server goes away 0.8.7h --bug#0001669: Problems with getting data from script using SPINE on Windows Server 2003 x32 --bug#0001829: Wrong string numerical value got from Spine SNMP poller +-bug#0001669: Problems with getting data from script using SPINE on Windows Server 2003 x32 +-bug#0001829: Wrong string numerical value got from Spine SNMP poller -bug#0001899: spine treats undef replies as 0 -bug#0001968: Spine Error with Cisco FWSM firewalls --bug#0001974: PRIV_PROC_EXEC is required for Spine on Solaris 10 --bug#0002059: Spine doing too many (80+) connections when polling +-bug#0001974: PRIV_PROC_EXEC is required for Spine on Solaris 10 +-bug#0002059: Spine doing too many (80+) connections when polling -bug: Net-snmp API issues cause spine crashes with some SNMP agents -bug: Host list not properly initialized -bug: Mutex locking issues cause deadlocks in Windows @@ -244,7 +254,7 @@ -bug: be smart for SNMP V3 and use AuthNoPriv when privacy passphrase is empty -bug: Do not fail on insert for a duplicate record -bug: Script server results with special characters can cause segfaults --feature#0001852: Another 10% speedup in spine +-feature#0001852: Another 10% speedup in spine -feature#0001878: Add Linux Capabilities to Spine -feature: Add additional ping methods to allow more precise snmp pings -feature: Clean up directory, update bootstrap @@ -253,7 +263,7 @@ -feature: Multi threaded host polling 0.8.7f --bug#0001465: Don't check micro version when comparing installed net-snmp version to version used when building +-bug#0001465: Don't check micro version when comparing installed net-snmp version to version used when building -bug#0001497: Prevent constant reindexes if snmp agent continually returns uptime of 0 -bug#0001510: Speedup spine resorting hosts by estimated polling time -bug#0001519: spine enhancement for parallel collection of data at host level @@ -261,7 +271,7 @@ -bug#0001551: Spine compile problem on AIX 5 -bug#0001563: Spine Compilation Problem on sql.c -bug#0001604: HEX Counter values enclosed in quotes not recognized as HEX --bug#0001657: Spine output shows drop of latest bit from hex value +-bug#0001657: Spine output shows drop of latest bit from hex value -bug#0001653: Transient ICMP Socket create failures causing spine to die -bug: When performing reindex checks, spine does not trim quotes from string values resulting in reindex faiures -bug: Add new option to enable Net-SNMP library vs. header versions @@ -279,12 +289,12 @@ -bug: Don't perform TCP Ping retries in Windows. You cannot set socket send timeouts in Windows 0.8.7d --bug#0001310: Feature request for poller.php- single host polling +-bug#0001310: Feature request for poller.php- single host polling -bug#0001313: Spine takes an excessive amount of time timing out failed tcp pings --bug#0001358: (cacti + spine) svn. Using snmp v3 constantly get "value: U", whereas snmpget returns correct value +-bug#0001358: (cacti + spine) svn. Using snmp v3 constantly get "value: U", whereas snmpget returns correct value -bug#0001379: Ping.c might send more then retry_count icmp packages --bug#0001381: configure script distributed with cacti-spine-0.8.7c is broken --bug#0001420: PCOMMAND: Poller[0] Host[80] WARNING: Recache Event Detected for Host +-bug#0001381: configure script distributed with cacti-spine-0.8.7c is broken +-bug#0001420: PCOMMAND: Poller[0] Host[80] WARNING: Recache Event Detected for Host -bug: A host that for some reason can not initialize snmp can cause a segfault -bug: When using nifty popen, when the script times out, attempt to kill it -bug: Under some platforms tcp and udp ping unresponsive @@ -310,11 +320,11 @@ -bug#0001152: Running spine w/o setuid-root on Solaris -bug#0001186: clarify INSTALL documentation. -bug#0001231: Compiling Spine on Solaris 10 --bug#0001260: Deadlock in ping.c when resolving bad hostnames +-bug#0001260: Deadlock in ping.c when resolving bad hostnames -bug#0001271: hex string to decimal conversion -bug#0001277: Spine reporting partial result or 'U' for SNMP value -bug: Correct a buffer overrun issue in poller.c --bug: If the script server goes away due to a syntax problem, it will not restart +-bug: If the script server goes away due to a syntax problem, it will not restart -bug: If the snmp session is not created spine times out -bug: If your snmp context changes between poller items, the context would not always change -feature: Use threadsafe gethostbyname_r diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spine-release-1.2.5/INSTALL new/spine-release-1.2.6/INSTALL --- old/spine-release-1.2.5/INSTALL 2019-07-15 15:06:07.000000000 +0200 +++ new/spine-release-1.2.6/INSTALL 2019-09-02 02:09:08.000000000 +0200 @@ -25,7 +25,7 @@ 1. Run the bootstrap process to automatically create the configure script - ./bootstratp + ./bootstrap 2. Run the configure process to detect what is available on the system diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spine-release-1.2.5/Makefile.am new/spine-release-1.2.6/Makefile.am --- old/spine-release-1.2.5/Makefile.am 2019-07-15 15:06:07.000000000 +0200 +++ new/spine-release-1.2.6/Makefile.am 2019-09-02 02:09:08.000000000 +0200 @@ -1,6 +1,7 @@ ## Makefile.am -- Process this file with automake to produce Makefile.in AUTOMAKE_OPTIONS = foreign +ACLOCAL_AMFLAGS = -I m4 spine_SOURCES = sql.c spine.c util.c snmp.c locks.c poller.c nft_popen.c php.c ping.c keywords.c error.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spine-release-1.2.5/common.h new/spine-release-1.2.6/common.h --- old/spine-release-1.2.5/common.h 2019-07-15 15:06:07.000000000 +0200 +++ new/spine-release-1.2.6/common.h 2019-09-02 02:09:08.000000000 +0200 @@ -92,7 +92,7 @@ #include <stdarg.h> #include <stdio.h> #include <syslog.h> - +#include <stdbool.h> #if HAVE_STDINT_H # include <stdint.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spine-release-1.2.5/configure.ac new/spine-release-1.2.6/configure.ac --- old/spine-release-1.2.5/configure.ac 2019-07-15 15:06:07.000000000 +0200 +++ new/spine-release-1.2.6/configure.ac 2019-09-02 02:09:08.000000000 +0200 @@ -1,5 +1,5 @@ AC_PREREQ(2.53) -AC_INIT(Spine Poller, 1.2.5, http://www.cacti.net/issues.php) +AC_INIT(Spine Poller, 1.2.6, http://www.cacti.net/issues.php) AC_CONFIG_AUX_DIR(config) AC_SUBST(ac_aux_dir) @@ -239,10 +239,22 @@ ) # Determine MySQL installation paths +MYSQL_SUB_DIR="include include/mysql include/mariadb mysql"; for i in $MYSQL_DIR /usr /usr/local /opt /opt/mysql /usr/pkg /usr/local/mysql; do - test -f $i/include/mysql.h && MYSQL_INC_DIR=$i/include && break - test -f $i/include/mysql/mysql.h && MYSQL_INC_DIR=$i/include/mysql && break - test -f $i/mysql/include/mysql.h && MYSQL_INC_DIR=$i/mysql/include && break + for d in $MYSQL_SUB_DIR; do + if [[ -f $i/$d/mysql.h ]]; then + MYSQL_INC_DIR=$i/$d + break; + fi + done + + if [[ ! -z $MYSQL_INC_DIR ]]; then + break; + fi +# test -f $i/include/mysql.h && MYSQL_INC_DIR=$i/include && break +# test -f $i/include/mysql/mysql.h && MYSQL_INC_DIR=$i/include/mysql && break +# test -f $i/include/mariadb/mysql.h && MYSQL_INC_DIR=$i/include/mariadb && break +# test -f $i/mysql/include/mysql.h && MYSQL_INC_DIR=$i/mysql/include && break done if test -z "$MYSQL_INC_DIR"; then @@ -260,6 +272,11 @@ MYSQL_LIB_CHK($i/lib/mysql) done +if test -n "$MYSQL_LIB_DIR" ; then + LDFLAGS="-L$MYSQL_LIB_DIR $LDFLAGS" +fi + CFLAGS="-I$MYSQL_INC_DIR $CFLAGS" + AC_CHECK_LIB(mysqlclient, mysql_init, [ LIBS="-lmysqlclient -lm -ldl $LIBS" AC_DEFINE(HAVE_MYSQL, 1, MySQL Client API) @@ -267,11 +284,6 @@ [ HAVE_MYSQL=no ] ) -if test -n "$MYSQL_LIB_DIR" ; then - LDFLAGS="-L$MYSQL_LIB_DIR $LDFLAGS" -fi -CFLAGS="-I$MYSQL_INC_DIR $CFLAGS" - if test $MYSQL_REENTRANT = 1 ; then LIBS="-lmysqlclient_r -lm -ldl $LIBS" else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spine-release-1.2.5/poller.c new/spine-release-1.2.6/poller.c --- old/spine-release-1.2.5/poller.c 2019-07-15 15:06:07.000000000 +0200 +++ new/spine-release-1.2.6/poller.c 2019-09-02 02:09:08.000000000 +0200 @@ -68,8 +68,6 @@ /* Allows main thread to proceed with creation of other threads */ sem_post(poller_details.thread_init_sem); - free(arg); - if (is_debug_device(host_id)) { SPINE_LOG(("DEBUG: In Poller, About to Start Polling of Device for Device ID %i", host_id)); } else { @@ -90,6 +88,7 @@ thread_mutex_lock(LOCK_PEND); pending_threads--; + poller_details.complete = TRUE; SPINE_LOG_MEDIUM(("POLLER: Active Threads is %i, Pending is %i", set.threads - a_threads_value, pending_threads)); thread_mutex_unlock(LOCK_PEND); @@ -820,7 +819,7 @@ } if (!reindex_err) { - if (!(query3 = (char *)malloc(BUFSIZE))) { + if (!(query3 = (char *)malloc(LRG_BUFSIZE))) { die("ERROR: Fatal malloc error: poller.c reindex insert!"); } query3[0] = '\0'; @@ -843,7 +842,7 @@ } if (host_thread == 1) { - snprintf(query3, BUFSIZE, "REPLACE INTO poller_command (poller_id, time, action,command) values (%i, NOW(), %i, '%i:%i')", set.poller_id, POLLER_COMMAND_REINDEX, host->id, reindex->data_query_id); + snprintf(query3, LRG_BUFSIZE, "REPLACE INTO poller_command (poller_id, time, action,command) values (%i, NOW(), %i, '%i:%i')", set.poller_id, POLLER_COMMAND_REINDEX, host->id, reindex->data_query_id); if (set.mode == REMOTE_ONLINE) { db_insert(&mysqlr, REMOTE, query3); @@ -865,7 +864,7 @@ } if (host_thread == 1) { - snprintf(query3, BUFSIZE, "REPLACE INTO poller_command (poller_id, time, action, command) values (%i, NOW(), %i, '%i:%i')", set.poller_id, POLLER_COMMAND_REINDEX, host->id, reindex->data_query_id); + snprintf(query3, LRG_BUFSIZE, "REPLACE INTO poller_command (poller_id, time, action, command) values (%i, NOW(), %i, '%i:%i')", set.poller_id, POLLER_COMMAND_REINDEX, host->id, reindex->data_query_id); if (set.mode == REMOTE_ONLINE) { db_insert(&mysqlr, REMOTE, query3); @@ -889,7 +888,7 @@ } if (host_thread == 1) { - snprintf(query3, BUFSIZE, "REPLACE INTO poller_command (poller_id, time, action, command) values (%i, NOW(), %i, '%i:%i')", set.poller_id, POLLER_COMMAND_REINDEX, host->id, reindex->data_query_id); + snprintf(query3, LRG_BUFSIZE, "REPLACE INTO poller_command (poller_id, time, action, command) values (%i, NOW(), %i, '%i:%i')", set.poller_id, POLLER_COMMAND_REINDEX, host->id, reindex->data_query_id); if (set.mode == REMOTE_ONLINE) { db_insert(&mysqlr, REMOTE, query3); @@ -910,7 +909,7 @@ if (host_thread == 1) { db_escape(&mysql, temp_poll_result, sizeof(temp_poll_result), poll_result); db_escape(&mysql, temp_arg1, sizeof(temp_arg1), reindex->arg1); - snprintf(query3, BUFSIZE, "UPDATE poller_reindex SET assert_value='%s' WHERE host_id='%i' AND data_query_id='%i' AND arg1='%s'", temp_poll_result, host_id, reindex->data_query_id, temp_arg1); + snprintf(query3, LRG_BUFSIZE, "UPDATE poller_reindex SET assert_value='%s' WHERE host_id='%i' AND data_query_id='%i' AND arg1='%s'", temp_poll_result, host_id, reindex->data_query_id, temp_arg1); db_insert(&mysql, LOCAL, query3); } @@ -1686,9 +1685,9 @@ /* record the polling time for the device */ poll_time = get_time_as_double() - poll_time; if (is_debug_device(host_id)) { - SPINE_LOG(("Device[%i] HT[%i] Total Time: %5.2g Seconds", host_id, host_thread, poll_time)); + SPINE_LOG(("Device[%i] HT[%i] Total Time: %0.2g Seconds", host_id, host_thread, poll_time)); } else { - SPINE_LOG_MEDIUM(("Device[%i] HT[%i] Total Time: %5.2g Seconds", host_id, host_thread, poll_time)); + SPINE_LOG_MEDIUM(("Device[%i] HT[%i] Total Time: %0.2g Seconds", host_id, host_thread, poll_time)); } /* record the total time for the host */ @@ -1769,56 +1768,79 @@ void get_system_information(host_t *host, MYSQL *mysql, int system) { char *poll_result; + SPINE_LOG_MEDIUM(("NOTE: Device[%d] Checking for System Information Update", host->id)); + if (set.mibs || system) { if (is_debug_device(host->id)) { - SPINE_LOG(("Updating Full System Information Table")); + SPINE_LOG(("NOTE: Device[%d] Updating Full System Information Table", host->id)); } else { - SPINE_LOG_MEDIUM(("Updating Full System Information Table")); + SPINE_LOG_MEDIUM(("NOTE: Device[%d] Updating Full System Information Table", host->id)); } + SPINE_LOG_DEVDBG(("DEVDBG: Device[%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.1.0');", host->id)); poll_result = snmp_get(host, ".1.3.6.1.2.1.1.1.0"); + SPINE_LOG_DEVDBG(("DEVDBG: Device[%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.1.0'); [complete]", host->id)); + if (poll_result) { db_escape(mysql, host->snmp_sysDescr, sizeof(host->snmp_sysDescr), poll_result); + free(poll_result); } - free(poll_result); + SPINE_LOG_DEVDBG(("DEVDBG: Device[%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.2.0');", host->id)); poll_result = snmp_get(host, ".1.3.6.1.2.1.1.2.0"); + SPINE_LOG_DEVDBG(("DEVDBG: Device[%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.2.0'); [complete]", host->id)); + if (poll_result) { db_escape(mysql, host->snmp_sysObjectID, sizeof(host->snmp_sysObjectID), poll_result); free(poll_result); } + SPINE_LOG_DEVDBG(("DEVDBG: Device[%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.3.0');", host->id)); poll_result = snmp_get(host, ".1.3.6.1.2.1.1.3.0"); + SPINE_LOG_DEVDBG(("DEVDGB: Device[%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.3.0'); [complete]", host->id)); + if (poll_result) { host->snmp_sysUpTimeInstance = atoi(poll_result); free(poll_result); } + SPINE_LOG_DEVDBG(("DEVDBG: Device [%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.4.0');", host->id)); poll_result = snmp_get(host, ".1.3.6.1.2.1.1.4.0"); + SPINE_LOG_DEVDBG(("DEVDBG: Device [%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.4.0'); [complete]", host->id)); + if (poll_result) { db_escape(mysql, host->snmp_sysContact, sizeof(host->snmp_sysContact), poll_result); free(poll_result); } + SPINE_LOG_DEVDBG(("DEVDBG: Device [%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.5.0');", host->id)); poll_result = snmp_get(host, ".1.3.6.1.2.1.1.5.0"); + SPINE_LOG_DEVDBG(("DEVDBG: Device [%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.5.0'); [complete]", host->id)); + if (poll_result) { db_escape(mysql, host->snmp_sysName, sizeof(host->snmp_sysName), poll_result); free(poll_result); } + SPINE_LOG_DEVDBG(("DEVDBG: Device [%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.6.0');", host->id)); poll_result = snmp_get(host, ".1.3.6.1.2.1.1.6.0"); + SPINE_LOG_DEVDBG(("DEVDBG: Device [%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.6.0'); [complete]", host->id)); + if (poll_result) { db_escape(mysql, host->snmp_sysLocation, sizeof(host->snmp_sysLocation), poll_result); free(poll_result); } } else { if (is_debug_device(host->id)) { - SPINE_LOG(("Updating Short System Information Table")); + SPINE_LOG(("NOTE: Device[%d] Updating Short System Information Table", host->id)); } else { - SPINE_LOG_MEDIUM(("Updating Short System Information Table")); + SPINE_LOG_MEDIUM(("NOTE: Device[%d] Updating Short System Information Table", host->id)); } + SPINE_LOG_DEVDBG(("DEVDBG: Device [%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.3.0');", host->id)); poll_result = snmp_get(host, ".1.3.6.1.2.1.1.3.0"); + SPINE_LOG_DEVDBG(("DEVDBG: Device [%d] poll_result = snmp_get(host, '.1.3.6.1.2.1.1.3.0'); [complete]", host->id)); + if (poll_result) { host->snmp_sysUpTimeInstance = atoi(poll_result); free(poll_result); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spine-release-1.2.5/snmp.c new/spine-release-1.2.6/snmp.c --- old/spine-release-1.2.5/snmp.c 2019-07-15 15:06:07.000000000 +0200 +++ new/spine-release-1.2.6/snmp.c 2019-09-02 02:09:08.000000000 +0200 @@ -115,9 +115,9 @@ * */ void *snmp_host_init(int host_id, char *hostname, int snmp_version, char *snmp_community, - char *snmp_username, char *snmp_password, char *snmp_auth_protocol, - char *snmp_priv_passphrase, char *snmp_priv_protocol, - char *snmp_context, char *snmp_engine_id, int snmp_port, int snmp_timeout) { + char *snmp_username, char *snmp_password, char *snmp_auth_protocol, + char *snmp_priv_passphrase, char *snmp_priv_protocol, + char *snmp_context, char *snmp_engine_id, int snmp_port, int snmp_timeout) { void *sessp = NULL; struct snmp_session session; @@ -189,6 +189,8 @@ session.remote_port = snmp_port; session.timeout = (snmp_timeout * 1000); /* net-snmp likes microseconds */ + SPINE_LOG_MEDIUM(("Device[%i] INFO: SNMP Device '%s' has timeout %ld (%d), retries %d", host_id, hostname, session.timeout, snmp_timeout, session.retries)); + if ((snmp_version == 2) || (snmp_version == 1)) { session.community = (unsigned char*) snmp_community; session.community_len = strlen(snmp_community); @@ -328,6 +330,11 @@ char *result_string; char temp_result[RESULTS_BUFFER]; + if (current_host->ignore_host) { + SPINE_LOG_HIGH(("WARNING: Skipped oid '%s' for Device[%d] as host ignore flag is active", snmp_oid, current_host->id)); + return NULL; + } + if (!(result_string = (char *) malloc(RESULTS_BUFFER))) { die("ERROR: Fatal malloc error: snmp.c snmp_get!"); } @@ -337,18 +344,28 @@ if (current_host->snmp_session != NULL) { anOID_len = MAX_OID_LEN; - pdu = snmp_pdu_create(SNMP_MSG_GET); + SPINE_LOG_DEVDBG(("Device[%i] WARNING: snmp_pdu_create(%s)", current_host->id, snmp_oid)); + pdu = snmp_pdu_create(SNMP_MSG_GET); + SPINE_LOG_DEVDBG(("Device[%i] WARNING: snmp_pdu_create(%s) [complete]", current_host->id, snmp_oid)); + + SPINE_LOG_DEVDBG(("Device[%i] WARNING: snmp_parse_oid(%s)", current_host->id, snmp_oid)); if (!snmp_parse_oid(snmp_oid, anOID, &anOID_len)) { + SPINE_LOG_DEVDBG(("Device[%i] WARNING: snmp_parse_oid(%s) [complete]", current_host->id, snmp_oid)); SPINE_LOG(("Device[%i] ERROR: SNMP Get Problems parsing SNMP OID %s", current_host->id, snmp_oid)); SET_UNDEFINED(result_string); return result_string; } else { + SPINE_LOG_DEVDBG(("Device[%i] WARNING: snmp_parse_oid(%s) [complete]", current_host->id, snmp_oid)); + SPINE_LOG_DEVDBG(("Device[%i] WARNING: snmp_add_null_var(%s)", current_host->id, snmp_oid)); snmp_add_null_var(pdu, anOID, anOID_len); + SPINE_LOG_DEVDBG(("Device[%i] WARNING: snmp_add_null_var(%s) [complete]", current_host->id, snmp_oid)); } /* poll host */ + SPINE_LOG_DEVDBG(("Device[%i] WARNING: snmp_sess_sync_response(%s)", current_host->id, snmp_oid)); status = snmp_sess_synch_response(current_host->snmp_session, pdu, &response); + SPINE_LOG_DEVDBG(("Device[%i] WARNING: snmp_sess_sync_response(%s) [complete]", current_host->id, snmp_oid)); /* add status to host structure */ current_host->snmp_status = status; @@ -367,8 +384,12 @@ snprint_value(temp_result, RESULTS_BUFFER, vars->name, vars->name_length, vars); snprint_asciistring(result_string, RESULTS_BUFFER, temp_result, strlen(temp_result)); + } else { + SPINE_LOG_HIGH(("ERROR: Failed to get oid '%s' for Device[%d]", snmp_oid, current_host->id)); } } + } else { + SPINE_LOG_HIGH(("ERROR: Failed to get oid '%s' for Device[%d]", snmp_oid, current_host->id)); } if (response) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spine-release-1.2.5/spine.c new/spine-release-1.2.6/spine.c --- old/spine-release-1.2.5/spine.c 2019-07-15 15:06:07.000000000 +0200 +++ new/spine-release-1.2.6/spine.c 2019-09-02 02:09:08.000000000 +0200 @@ -207,6 +207,7 @@ #endif /* HAVE_LCAP */ pthread_t* threads = NULL; + poller_thread_t** details = NULL; poller_thread_t* poller_details = NULL; pthread_attr_t attr; @@ -224,6 +225,9 @@ int total_items = 0; int change_host = TRUE; int current_thread; + int threads_final = 0; + int threads_missing = -1; + int threads_count; UNUSED_PARAMETER(argc); /* we operate strictly with argv */ @@ -315,8 +319,7 @@ if (opt) *opt++ = '\0'; - if (STRMATCH(arg, "-f") || - STRMATCH(arg, "--first")) { + if (STRMATCH(arg, "-f") || STRMATCH(arg, "--first")) { if (HOSTID_DEFINED(set.start_host_id)) { die("ERROR: %s can only be used once", arg); } @@ -328,8 +331,7 @@ } } - else if (STRMATCH(arg, "-l") || - STRIMATCH(arg, "--last")) { + else if (STRMATCH(arg, "-l") || STRIMATCH(arg, "--last")) { if (HOSTID_DEFINED(set.end_host_id)) { die("ERROR: %s can only be used once", arg); } @@ -341,38 +343,27 @@ } } - else if (STRMATCH(arg, "-p") || - STRIMATCH(arg, "--poller")) { + else if (STRMATCH(arg, "-p") || STRIMATCH(arg, "--poller")) { set.poller_id = atoi(getarg(opt, &argv)); } - else if (STRMATCH(arg, "-N") || - STRIMATCH(arg, "--mode")) { - + else if (STRMATCH(arg, "-N") || STRIMATCH(arg, "--mode")) { if (STRIMATCH(getarg(opt, &argv), "online")) { set.mode = REMOTE_ONLINE; - } - - else if (STRIMATCH(getarg(opt, &argv), "offline")) { + } else if (STRIMATCH(getarg(opt, &argv), "offline")) { set.mode = REMOTE_OFFLINE; - } - - else if (STRIMATCH(getarg(opt, &argv), "recovery")) { + } else if (STRIMATCH(getarg(opt, &argv), "recovery")) { set.mode = REMOTE_RECOVERY; - } - - else { + } else { die("ERROR: invalid polling mode '%s' specified", opt); } } - else if (STRMATCH(arg, "-H") || - STRIMATCH(arg, "--hostlist")) { + else if (STRMATCH(arg, "-H") || STRIMATCH(arg, "--hostlist")) { snprintf(set.host_id_list, BIG_BUFSIZE, "%s", getarg(opt, &argv)); } - else if (STRMATCH(arg, "-M") || - STRMATCH(arg, "--mibs")) { + else if (STRMATCH(arg, "-M") || STRMATCH(arg, "--mibs")) { set.mibs = 1; } @@ -388,10 +379,9 @@ exit(EXIT_SUCCESS); } - else if (STRMATCH(arg, "-O") || - STRIMATCH(arg, "--option")) { - char *setting = getarg(opt, &argv); - char *value = strchr(setting, ':'); + else if (STRMATCH(arg, "-O") || STRIMATCH(arg, "--option")) { + char *setting = getarg(opt, &argv); + char *value = strchr(setting, ':'); if (*value) { *value++ = '\0'; @@ -402,34 +392,27 @@ set_option(setting, value); } - else if (STRMATCH(arg, "-R") || - STRMATCH(arg, "--readonly") || - STRMATCH(arg, "--read-only")) { + else if (STRMATCH(arg, "-R") || STRMATCH(arg, "--readonly") || STRMATCH(arg, "--read-only")) { set.SQL_readonly = TRUE; } - else if (STRMATCH(arg, "-C") || - STRMATCH(arg, "--conf")) { + else if (STRMATCH(arg, "-C") || STRMATCH(arg, "--conf")) { conf_file = strdup(getarg(opt, &argv)); } - else if (STRMATCH(arg, "-S") || - STRMATCH(arg, "--stdout")) { + else if (STRMATCH(arg, "-S") || STRMATCH(arg, "--stdout")) { set_option("log_destination", "STDOUT"); } - else if (STRMATCH(arg, "-L") || - STRMATCH(arg, "--log")) { + else if (STRMATCH(arg, "-L") || STRMATCH(arg, "--log")) { set_option("log_destination", getarg(opt, &argv)); } - else if (STRMATCH(arg, "-V") || - STRMATCH(arg, "--verbosity")) { + else if (STRMATCH(arg, "-V") || STRMATCH(arg, "--verbosity")) { set_option("log_verbosity", getarg(opt, &argv)); } - else if (STRMATCH(arg, "--snmponly") || - STRMATCH(arg, "--snmp-only")) { + else if (STRMATCH(arg, "--snmponly") || STRMATCH(arg, "--snmp-only")) { set.snmponly = TRUE; } @@ -480,12 +463,12 @@ valid_conf_file = TRUE; } } else { - if (!(conf_file = calloc(CONFIG_PATHS, BUFSIZE))) { + if (!(conf_file = calloc(CONFIG_PATHS, DBL_BUFSIZE))) { die("ERROR: Fatal malloc error: spine.c conf_file!"); } for (i=0; i<CONFIG_PATHS; i++) { - snprintf(conf_file, BUFSIZE, "%s%s", config_paths[i], DEFAULT_CONF_FILE); + snprintf(conf_file, DBL_BUFSIZE, "%s%s", config_paths[i], DEFAULT_CONF_FILE); if (read_spine_config(conf_file) >= 0) { valid_conf_file = TRUE; @@ -493,7 +476,7 @@ } if (i == CONFIG_PATHS-1) { - snprintf(conf_file, BUFSIZE, "%s%s", config_paths[0], DEFAULT_CONF_FILE); + snprintf(conf_file, DBL_BUFSIZE, "%s%s", config_paths[0], DEFAULT_CONF_FILE); } } } @@ -622,16 +605,21 @@ qp += sprintf(qp, " ORDER BY polling_time DESC"); result = db_query(&mysql, LOCAL, querybuf); - if (set.poller_id == 0) { - num_rows = mysql_num_rows(result) + 1; /* add 1 for host = 0 */ + + if (set.poller_id == 1) { + num_rows = mysql_num_rows(result) + 1; /* pollerid 1 takes care of not host based data sources */ } else { - num_rows = mysql_num_rows(result); /* pollerid 0 takes care of not host based data sources */ + num_rows = mysql_num_rows(result); } if (!(threads = (pthread_t *)malloc(num_rows * sizeof(pthread_t)))) { die("ERROR: Fatal malloc error: spine.c threads!"); } + if (!(details = (poller_thread_t **)malloc(num_rows * sizeof(poller_thread_t*)))) { + die("ERROR: Fatal malloc error: spine.c details!"); + } + if (!(ids = (int *)malloc(num_rows * sizeof(int)))) { die("ERROR: Fatal malloc error: spine.c host id's!"); } @@ -674,7 +662,7 @@ current_thread = 0; /* poller 0 always polls host 0 */ - if (set.poller_id == 0) { + if (set.poller_id == 1) { host_id = 0; change_host = FALSE; } else { @@ -688,6 +676,10 @@ host_id = atoi(mysql_row[0]); device_threads = atoi(mysql_row[1]); current_thread = 1; + + if (device_threads < 1) { + device_threads = 1; + } } else { current_thread++; } @@ -717,12 +709,15 @@ db_free_result(tresult); if (host_time) free(host_time); + host_time = get_host_poll_time(); host_time_double = get_time_as_double(); } } else { - itemsPT = 0; + itemsPT = 0; + if (host_time) free(host_time); + host_time = get_host_poll_time(); host_time_double = get_time_as_double(); } @@ -739,6 +734,9 @@ poller_details->host_time = host_time; poller_details->host_time_double = host_time_double; poller_details->thread_init_sem = &thread_init_sem; + poller_details->complete = FALSE; + + details[device_counter] = poller_details; retry1: @@ -776,6 +774,15 @@ thread_mutex_unlock(LOCK_PEND); sem_post(&thread_init_sem); + SPINE_LOG_DEVDBG(("INFO: DTS: device = %d, host_id = %d, host_thread = %d," + " last_host_thread = %d, host_data_ids = %d, complete = %d", + device_counter-1, + poller_details->host_id, + poller_details->host_thread, + poller_details->last_host_thread, + poller_details->host_data_ids, + poller_details->complete)); + break; case EAGAIN: SPINE_LOG(("ERROR: The System Lacked the Resources to Create a Thread")); @@ -791,8 +798,9 @@ } /* Restore thread initialization semaphore if thread creation failed */ - if (thread_status) + if (thread_status) { sem_post(&thread_init_sem); + } } /* wait for all threads to 'complete' @@ -806,17 +814,53 @@ if (pending_threads == 0) { break; } else if (cur_time - begin_time > set.poller_interval) { - SPINE_LOG(("ERROR: Spine Timed Out While Waiting for Threads to End")); + SPINE_LOG(("ERROR: Spine Timed Out While Waiting for %d Threads to End", pending_threads)); break; } thread_mutex_unlock(LOCK_PEND); - sleep(1); + usleep(100000); } sem_getvalue(&active_threads, &a_threads_value); - SPINE_LOG_MEDIUM(("SPINE: The Final Value of Threads is %i", set.threads - a_threads_value)); + + threads_final = set.threads - a_threads_value; + + if (threads_final) { + SPINE_LOG_HIGH(("SPINE: The final count of Threads is %i", threads_final)); + + for (threads_count = 0; threads_count < num_rows; threads_count++) { + poller_thread_t* det = details[threads_count]; + + if (threads_missing == -1 && det == NULL) { + threads_missing = threads_count; + } + + if (det != NULL) { // && !det->complete) { + SPINE_LOG_HIGH(("INFO: Thread %scomplete for Device[%d] and %d to %d sources", + det->complete?"":"in", + det->host_id, + det->host_data_ids * (det->host_thread - 1), + det->host_data_ids * (det->host_thread))); + + SPINE_LOG_DEVDBG(("INFO: DTF: device = %d, host_id = %d, host_thread = %d," + " last_host_thread = %d, host_data_ids = %d, complete = %d", + threads_count, + det->host_id, + det->host_thread, + det->last_host_thread, + det->host_data_ids, + det->complete)); + } + } + + if (threads_missing > -1) { + SPINE_LOG_HIGH(("ERROR: There were %d threads which did not run", num_rows - threads_missing)); + } + } else { + SPINE_LOG_MEDIUM(("SPINE: The Final Value of Threads is %i", threads_final)); + } /* tell Spine that it is now parent */ set.parent_fork = SPINE_PARENT; @@ -854,6 +898,13 @@ SPINE_LOG_DEBUG(("DEBUG: PHP Script Server Pipes Closed")); /* free malloc'd variables */ + for (i = 0; i < num_rows; i++) { + if (details[i] != NULL) { + free(details[i]); + } + } + + free(details); free(threads); free(ids); free(conf_file); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spine-release-1.2.5/spine.h new/spine-release-1.2.6/spine.h --- old/spine-release-1.2.5/spine.h 2019-07-15 15:06:07.000000000 +0200 +++ new/spine-release-1.2.6/spine.h 2019-09-02 02:09:08.000000000 +0200 @@ -135,7 +135,7 @@ #define BIG_BUFSIZE 65535 #define MEGA_BUFSIZE 1024000 #define HUGE_BUFSIZE 2048000 -#define LOGSIZE 4096 +#define LOGSIZE 65535 #define BITSINBYTE 8 #define THIRTYTWO 4294967295ul #define SIXTYFOUR 18446744073709551615ul @@ -357,9 +357,9 @@ unsigned int db_port; int dbversion; /* path information */ - char path_logfile[SMALL_BUFSIZE]; - char path_php[SMALL_BUFSIZE]; - char path_php_server[SMALL_BUFSIZE]; + char path_logfile[BUFSIZE]; + char path_php[BUFSIZE]; + char path_php_server[BUFSIZE]; /* logging options */ int log_level; int log_destination; @@ -466,6 +466,7 @@ int host_thread; int last_host_thread; int host_data_ids; + int complete; char *host_time; double host_time_double; sem_t *thread_init_sem; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spine-release-1.2.5/sql.c new/spine-release-1.2.6/sql.c --- old/spine-release-1.2.5/sql.c 2019-07-15 15:06:07.000000000 +0200 +++ new/spine-release-1.2.6/sql.c 2019-09-02 02:09:08.000000000 +0200 @@ -187,6 +187,7 @@ int options_error; int success; int error; + bool reconnect; MYSQL *connect_error; char *hostname; char *socket = NULL; @@ -229,7 +230,7 @@ timeout = 5; rtimeout = 10; wtimeout = 20; - my_bool reconnect = 1; + reconnect = 1; mysql_init(mysql); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spine-release-1.2.5/util.c new/spine-release-1.2.6/util.c --- old/spine-release-1.2.5/util.c 2019-07-15 15:06:07.000000000 +0200 +++ new/spine-release-1.2.6/util.c 2019-09-02 02:09:08.000000000 +0200 @@ -446,18 +446,22 @@ SPINE_LOG_DEBUG(("DEBUG: The ping_retries variable is %i", set.ping_retries)); /* set ping_timeout */ - if ( (res = getsetting(&mysql, LOCAL, "ping_timeout")) != 0) { + if ((res = getsetting(&mysql, LOCAL, "ping_timeout")) != 0) { set.ping_timeout = atoi(res); free((char *)res); + } else { + set.ping_timeout = 400; } /* log the ping_timeout variable */ SPINE_LOG_DEBUG(("DEBUG: The ping_timeout variable is %i", set.ping_timeout)); /* set snmp_retries */ - if ( (res = getsetting(&mysql, LOCAL, "snmp_retries")) != 0) { + if ((res = getsetting(&mysql, LOCAL, "snmp_retries")) != 0) { set.snmp_retries = atoi(res); free((char *)res); + } else { + set.snmp_retries = 3; } /* log the snmp_retries variable */ @@ -1098,7 +1102,7 @@ } /* log message prefix */ - snprintf(logprefix, SMALL_BUFSIZE, "SPINE: Poller[%i] ", set.poller_id); + snprintf(logprefix, SMALL_BUFSIZE, "SPINE: Poller[%i] PID[%i] ", set.poller_id, getpid()); /* get time for poller_output table */ nowbin = time(&nowbin);
