Skip to content
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

When running add_graphs.php, cannot retrieve list of valid snmp values #2453

Closed
dumporama opened this issue Feb 25, 2019 · 3 comments
Closed
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@dumporama
Copy link

Describe the bug
When running add_graphs.php with the --list-snmp-values option, I get an error returned that I don't think should be erroring.

To Reproduce

$ php -q add_graphs.php --host-id=4 --snmp-field=ifDescr --list-snmp-values
ERROR: You must supply a --snmp-value or --snmp-value-regex option with --snmp-field

Expected behavior
Should return a list of available SNMP values for the specified ifDescr value

Screenshots
none

Desktop (please complete the following information):
cygwin on windows

Smartphone (please complete the following information):
none

Additional context

CACTI VERSION 1.2.1

Showing hosts works okay:

$ php -q add_graphs.php --list-hosts
Known Devices: (id, hostname, template, description)
1 localhost 5 Local Windows Machine
5 192.168.1.1 1 HostDescriptionHere

Get graph templates

$ php -q add_graphs.php --list-graph-templates
Known Graph Templates: (id, name)
1 Cisco - CPU Usage
2 Interface - Traffic (bits/sec)
3 Interface - Errors/Discards
4 Interface - Unicast Packets
5 Interface - Non-Unicast Packets
6 Interface - Traffic (bytes/sec)
7 Interface - Traffic (bits/sec, 95th Percentile)
8 Interface - Traffic (bits/sec, Total Bandwidth)
9 Interface - Traffic (bytes/sec, Total Bandwidth)
10 Interface - Multicast Packets (Legacy)
11 Interface - Broadcast Packets (Legacy)
12 Unix - Ping Latency
13 SNMP - Generic OID Template
14 Unix - Processes
15 Unix - Load Average
16 Unix - Logged in Users
17 Linux - Memory Usage
18 Unix - Available Disk Space
19 Net-SNMP - Load Average
20 Net-SNMP - Memory Usage
21 Host MIB - Logged in Users
22 Host MIB - Processes
23 Net-SNMP - CPU Utilization
24 Net-SNMP - Interrupts
25 Net-SNMP - Context Switches
26 Net-SNMP - Combined SCSI Disk I/O
27 Net-SNMP - Combined SCSI Disk Bytes
28 Net-SNMP - Available Disk Space
29 Host MIB - Available Disk Space
30 Host MIB - CPU Utilization
31 Net-SNMP - Device I/O - Bytes Read/Written
32 Net-SNMP - Device I/O - Load Averages
33 Net-SNMP - Device I/O - Reads/Writes

SNMP fields working okay

$ php -q add_graphs.php --host-id=5 --list-snmp-fields
Known SNMP Fields for host-id 4: (name)
ifAlias
ifDescr
ifHighSpeed
ifHwAddr
ifIndex
ifIP
ifName
ifOperStatus
ifSpeed
ifType

But then getting a list of the available SNMP values for the above fields, returns an error:

$ php -q add_graphs.php --host-id=4 --snmp-field=ifDescr --list-snmp-values
ERROR: You must supply a --snmp-value or --snmp-value-regex option with --snmp-field

displaySNMPValues() on line 482 of add_graphs.php is where it should be reaching but it gets caught up on line 407 if that if/elseif/else block, and then hits the exit(1);

Here's what happens on older cacti version 0.8.8h:

c:\Apache24\htdocs\cacti\cli>php -q add_graphs.php --host-id=1078 --snmp-field=i
fDescr --list-snmp-values
Known values for ifDescr for host 1078: (name)
Cellular0
Cellular1
Dialer0
FastEthernet0
FastEthernet1
FastEthernet2
FastEthernet3
GigabitEthernet0
Loopback0
Null0
Serial0
Tunnel2
Tunnel3
Vlan1
Vlan21
VoIP-Null0

Thank you

@dumporama
Copy link
Author

Please excuse the changing host id 4/5 in some of the pastes, i was using different hosts at different times to check it wasn't just happening to one host

@cigamit
Copy link
Member

cigamit commented Feb 26, 2019

@dumporama, this may have been a code change to put some walls around the various snmp query id's as you could get values that were not relevant for your query.

cigamit added a commit that referenced this issue Feb 26, 2019
Cannot retrieve list of snmp values via CLI
@cigamit
Copy link
Member

cigamit commented Feb 26, 2019

Never mind, reproduced and fixed.

@cigamit cigamit added bug Undesired behaviour resolved A fixed issue labels Feb 26, 2019
@cigamit cigamit added this to the v1.2.3 milestone Feb 28, 2019
@cigamit cigamit closed this as completed Mar 3, 2019
@netniV netniV changed the title Cannot retrieve list of snmp values via CLI When running add_graphs.php, cannot retrieve list of valid snmp values Mar 30, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

2 participants