netniV / cacti-netsnmp-memory

This script template is intended to overcome these shortcomings by fetching all of the available memory data from all known sources (including the standard HOST MIB), and then performing basic arithmetic to fill in any gaps in the data.
4 stars 2 forks source link

SNMP v3 Fields are incorrectly set to input, resulting in argument count mismatches #4

Closed chrcoluk closed 4 years ago

chrcoluk commented 5 years ago

The following shows in cacti error log. Cacti version 1.27 PHP 7.2

`

10/Nov/2019 04:45:02 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler())

10/Nov/2019 04:45:02 - ERROR PHP ERROR: Uncaught ArgumentCountError: Too few arguments to function ss_netsnmp_memory(), 5 passed in /usr/local/share/cacti/script_server.php on line 219 and exactly 11 expected in /usr/local/share/cacti/scripts/ss_netsnmp_memory.php:47 Stack trace: #0 /usr/local/share/cacti/script_server.php(219): ss_netsnmp_memory('127.0.0.1', '2', 'public', '161', '6000') #1 {main} thrown in file: /usr/local/share/cacti/scripts/ss_netsnmp_memory.php on line: 47

`

chrcoluk commented 5 years ago

If I run the command in cli is no errors and outputs as expected providing if I run like this.

php ss_netsnmp_memory.php ss_netsnmp_memory but if I run without the binary like this ./ss_netsnmp_memory.php ss_netsnmp_memory

I get the same as what cacti reports.

chrcoluk commented 5 years ago

Looks like one set of ''' is missing from the command.
Another error shows behind 3 mins after poller. One ''' is missing.

10/Nov/2019 05:18:56 - ERROR PHP ERROR: Uncaught ArgumentCountError: Too few arguments to function ss_netsnmp_memory(), 10 passed in /usr/local/share/cacti/scripts/ss_netsnmp_memory.php on line 39 and exactly 11 expected in /usr/local/share/cacti/scripts/ss_netsnmp_memory.php:47 Stack trace: #0 /usr/local/share/cacti/scripts/ss_netsnmp_memory.php(39): ss_netsnmp_memory('127.0.0.1', '2', 'public', '161', '500', '', '', '', '', '') #1 {main} thrown in file: /usr/local/share/cacti/scripts/ss_netsnmp_memory.php on line: 47

chrcoluk commented 5 years ago

Ok looked at https://github.com/netniV/cacti-netsnmp-memory/issues/1

I did the following.

I replaced all snmpv3 variables in data input with manual '' for each one, this fixed the issues reported in this bug report. For myself this is ok as I dont use snmpv3 but obviously its not a fix in general as others may need that.

After I had a new problem which I will make a second report for.

netniV commented 5 years ago

This may be because of your version of Cacti. The template itself hasn't been re-exported in two years so was probably for an early version of Cacti 1.x. I should probably import and then export a working version for 1.2.x so that the parameters work as they should.

netniV commented 4 years ago

So I believe that I have now resolved this with the latest version. The issue being that the SNMP v3 fields were incorrectly set as input not output. You will need to import the template again to correct it.