Looking for a working template for DOM on Cisco Switch

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
Rno
Cacti Pro User
Posts: 704
Joined: Wed Dec 07, 2011 9:19 am

Looking for a working template for DOM on Cisco Switch

Post by Rno »

Does anyone have a working template for mesuring the DOM of SFP devices ?
Because the one I find by netniv, is not wokring as expected.

Actually I can't get this call to work:
$sensor_name = (cacti_snmp_get($hostname, $snmp_community, preg_replace('/.*\.[0-9]+\.[0-9]+\.([0-9]+)$/', '.1.3.6.1.2.1.47.1.1.1.1.2.\\1', $var[$i]["oid"]), $snmp_version,
$snmp_auth_username, $snmp_auth_password, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids, SNMP_POLLER));

the $sensor_name is empty!
And I can't find what is wrong with this query.
If I just drop the parameters send to snmp_get, it's:
10.0.2.26, , .1.3.6.1.2.1.47.1.1.1.1.2.1094, 3, <user>, <password>, SHA, <password>, AES128, , 161, 500, 4, 10


So should be ok, and doing a snmp_get on cli is correct:
snmpwalk -v3 -asha -A<password> -u<user> -lauthPriv -xaes -X <password> 10.0.2.26 .1.3.6.1.2.1.47.1.1.1.1.2.2121
SNMPv2-SMI::mib-2.47.1.1.1.1.2.2121 = STRING: "TenGigabitEthernet2/0/16 Transmit Power Sensor"

And the query for other cacti value are correct, so device is reachable
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Looking for a working template for DOM on Cisco Switch

Post by macan »

show full script, please
Let the Cacti grow!
Rno
Cacti Pro User
Posts: 704
Joined: Wed Dec 07, 2011 9:19 am

Re: Looking for a working template for DOM on Cisco Switch

Post by Rno »

more easy that's the one:
https://github.com/netniV/cisco-sfp

But I think it's the format of the cacti_snmp_get that has change since a while.

the netniV script use this one:
cacti_snmp_get($hostname, $snmp_community, '.1.3.6.1.4.1.9.9.91.1.1.1.1.5.' . $matches[1], $snmp_version, $snmp_auth_username, $snmp_auth_password,
$snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_port, $snmp_timeout, $ping_retries, $max_oids, SNMP_POLLER);

and lib/snmp.php hase this resquest:
function cacti_snmp_get($hostname, $community, $oid, $version, $auth_user = '', $auth_pass = '',
$auth_proto = '', $priv_pass = '', $priv_proto = '', $context = '',
$port = 161, $timeout_ms = 500, $retries = 0, $environ = 'SNMP',
$engineid = '', $value_output_format = SNMP_STRING_OUTPUT_GUESS) {


The $max_oid is at the place of $environ and SNMP_POLLER is at the place of $engineid

but even removing those to variables doesn't fix the issue.
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Looking for a working template for DOM on Cisco Switch

Post by macan »

Posting code from my last template:
cacti_snmp_get($host['hostname'],
$host['snmp_community'],
$oid,
$host['snmp_version'],
$host['snmp_username'],
$host['snmp_password'],
$host['snmp_auth_protocol'],
$host['snmp_priv_passphrase'],
$host['snmp_priv_protocol'],
$host['snmp_context'],
$host['snmp_port'],
$host['snmp_timeout'],
$host['ping_retries'],
SNMP_POLLER,
$host['snmp_engine_id']);
Let the Cacti grow!
Rno
Cacti Pro User
Posts: 704
Joined: Wed Dec 07, 2011 9:19 am

Re: Looking for a working template for DOM on Cisco Switch

Post by Rno »

Hey I correct the snmp query.
but Now I got an error when I do a query:
20/12/2024 11:04:04 - REINDEX ERROR: Re-Indexing failed due to a NULL sort field for Device[sre-core] and DQ[Cisco - Catalyst - SFP statistics]. Can not continue with Re-Index.

But when I do a a verbose query on the data query on my device I got this:

So it's look like the Index does exist, and it can fill all the request, but somehow it' still generate an error. And I can't figure out why (at least in a time not to long)

Anyway thanks for your help
Attachments
verbose data queries 3.png
verbose data queries 3.png (27.37 KiB) Viewed 182 times
verbose data queries 2.png
verbose data queries 2.png (55.74 KiB) Viewed 182 times
verbose data queries 1.png
verbose data queries 1.png (45.67 KiB) Viewed 182 times
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests