Skip to content

Merging All Cacti 1.2.x changes to develop for future development purposes #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 64 commits into from

Conversation

TheWitness
Copy link
Member

@TheWitness TheWitness commented Oct 30, 2024

Porting all 1.2.x changes to develop.

netniV and others added 30 commits May 18, 2022 20:38
* Improve Script Server Timeout Logging
* Add SQL_NO_CACHE to Spine Queries
Odd Cacti log format issue when script server timeout happened
Probably a copy/paste error, it does not impact the functionality of the
script, just throws an error when it is run.

Co-authored-by: Erik Sejr <[email protected]>
On FreeBSD when configured with default settings, compilation of spine
will always fail:

```
/bin/sh ./libtool  --tag=CC    --mode=link cc  -I/usr/local/include/net-snmp -I/usr/local/include/net-snmp/.. -I/usr/local/include/mysql -g -O2   -L/usr/local/lib -L/usr/local/lib/mysql -o spine sql.o spine.o util.o  snmp.o locks.o poller.o  nft_popen.o php.o ping.o  keywords.o error.o  -lnetsnmp -lmysqlclient_r -lm -ldl -lmysqlclient -lm -ldl -lcrypto -lz -lpthread -ldl -lm -lpthread -lssl
libtool: link: cc -I/usr/local/include/net-snmp -I/usr/local/include/net-snmp/.. -I/usr/local/include/mysql -g -O2 -o spine sql.o spine.o util.o snmp.o locks.o poller.o nft_popen.o php.o ping.o keywords.o error.o  -L/usr/local/lib -L/usr/local/lib/mysql -lnetsnmp -lmysqlclient_r -lmysqlclient -lcrypto -lz -ldl -lm -lpthread -lssl
ld: error: undefined symbol: backtrace
>>> referenced by error.c:85
>>>               error.o:(spine_signal_handler)

ld: error: undefined symbol: backtrace_symbols
>>> referenced by error.c:86
>>>               error.o:(spine_signal_handler)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
```

When the configure script is run it correctly shows that backtraces are
not supported on this platform:

```
...
checking whether we are using traditional popen... no
checking whether to verify net-snmp library vs header versions... no
checking if we can support backtracing... no
checking if we can support mysql/mariadb retry count... no
checking if we can support mysql/mariadb ssl keys... yes
...
```

And yet in config/config.h we have HAVE_EXECINFO_H defined:

```
/* Do we have backtracing capabilities? */
#define HAVE_EXECINFO_H 1
```

This is because of an error in configure.ac where the value of
HAVE_EXECINFO_H is set twice, the first time by
AC_CHECK_HEADERS(execinfo.h) which returns true (The FreeBSD system does
have execinfo.h, it just does not support the function used here) and a
2nd time later on by a AC_LINK_IFELSE:

```
# See if we can support backtracing
AC_MSG_CHECKING([if we can support backtracing])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
    #include <stdlib.h>
    #include <execinfo.h>
  ]], [[
    void *array[10];
    size_t size;

    // get void*'s for all entries on the stack
    size = backtrace(array, 10);
    if (size) {
      exit(0);
    } else {
      exit(1);
    }
  ]])],[  AC_MSG_RESULT(yes)
     AC_DEFINE(HAVE_EXECINFO_H,1,[Do we have backtracing capabilities?])
  ],[AC_MSG_RESULT(no)
])
```
Even though the above AC_LANG_PROGRAM fails on FreeBSD, because of the
earlier AC_CHECK_HEADERS succeeding HAVE_EXECINFO_H is already defined
and remains that way leading to the compilation failure.

Since the AC_LANG_PROGRAM check here seems more thorough then the simple
header check and will fail anyway if execinfo.h does not exist I think
the correct course of action here is to remove the AC_CHECK_HEADERS
macro for this particular header completely.

Co-authored-by: Erik Sejr <[email protected]>
This relates to cacti/#5356
-feature:   Do not sort by snmp port if you only have snmp on one port
-feature:   Order Devices by their number of poller items and Device Threads
-issue: Remove legacy setting device_threads_exist
- Function strip_alpha() does not strip non-numeric leading characters
- GitHub merge created an issue with switch syntax.
The plus sign is redundant
Spine should see if script to be executed is executable
At least it'll work for a /usr/bin/ install path
Spine won't work with complex SNMP results #v2
WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.
Spine does not check a host with no poller items
Wrong number of devices in stats due to device 0 assumption
eriksejr and others added 22 commits December 8, 2023 17:02
I actually think this one should be an unsigned long int instead of just
a long int.

---------

Co-authored-by: Erik Sejr <[email protected]>
Co-authored-by: TheWitness <[email protected]>
While compiling sql.c clang 16 generates the following warning:

```
sql.c:407:27: warning: comparison of address of 'db_pool_local[id].mysql' not equal to a null pointer is always true [-Wtautological-pointer-compare]
                        if (&db_pool_local[id].mysql != NULL) {
                             ~~~~~~~~~~~~~~~~~~^~~~~    ~~~~
sql.c:428:28: warning: comparison of address of 'db_pool_remote[id].mysql' not equal to a null pointer is always true [-Wtautological-pointer-compare]
                        if (&db_pool_remote[id].mysql != NULL) {
                             ~~~~~~~~~~~~~~~~~~~^~~~~    ~~~~
```

If the conditional is always true then the fix is to remove the
conditional in this instance

Co-authored-by: Erik Sejr <[email protected]>
* TCP ping returns always Alive
* The Availability/Reachability setting of "Ping or SNMP Uptime" is not working in latest spine
* Update some logging functions to add the 'DEBUG' declaration.
Prepare for 1.2.28 release.
Update copyright
@TheWitness TheWitness changed the title Third attempt at a pull. Merging All Cacti 1.2.x changes to develop for future development purposes Oct 30, 2024
This reverts commit 72e7b32, reversing
changes made to 23497c8.
@TheWitness
Copy link
Member Author

Closing this due to a snafu on my part.

@TheWitness TheWitness closed this Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants