Problem with script ( custom mib )
Moderators: Developers, Moderators
Problem with script ( custom mib )
I'm having some trouble with creating script to graph an UPS with custom mib, i'm trying with this script:
# cat /usr/local/share/cacti/scripts/nobreakcp.sh
#!/usr/local/bin/bash
result=$(snmpwalk -m /usr/local/nobreakcp/mibcp.my -v 1 -c ******* X.X.X.X cpUpsInputCurrent | awk '{ print $4*0.1 }')
printf "$result"
When i run it manually, the result was:
# /usr/local/share/cacti/scripts/nobreakcp.sh
14.9
But running from cacti:
12/29/2014 10:55:04 AM - CMDPHP: Poller[0] Host[0] DS[5562] CMD: /usr/local/share/cacti/scripts/nobreakcp.sh, output: U
12/29/2014 10:59:01 AM - CMDPHP: Poller[0] Host[0] DS[5562] CMD: /usr/local/share/cacti/scripts/nobreakcp.sh, output: U
If i run a random script, using perl, it return an value
Any ideas?
Thanks!
# cat /usr/local/share/cacti/scripts/nobreakcp.sh
#!/usr/local/bin/bash
result=$(snmpwalk -m /usr/local/nobreakcp/mibcp.my -v 1 -c ******* X.X.X.X cpUpsInputCurrent | awk '{ print $4*0.1 }')
printf "$result"
When i run it manually, the result was:
# /usr/local/share/cacti/scripts/nobreakcp.sh
14.9
But running from cacti:
12/29/2014 10:55:04 AM - CMDPHP: Poller[0] Host[0] DS[5562] CMD: /usr/local/share/cacti/scripts/nobreakcp.sh, output: U
12/29/2014 10:59:01 AM - CMDPHP: Poller[0] Host[0] DS[5562] CMD: /usr/local/share/cacti/scripts/nobreakcp.sh, output: U
If i run a random script, using perl, it return an value
Any ideas?
Thanks!
Re: Problem with script ( custom mib )
I'd strongly recommend you make a copy of the 'SNMP - Generic OID Template' data template and use the numeric OID. What you're doing will not scale well at all.
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Re: Problem with script ( custom mib )
I´ve tryed to use only snmp , but failed again:
01/05/2015 11:15:47 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/nobreak_a_snmp_oid_5563.rrd --template snmp_oid 1420463746:U
01/05/2015 11:15:47 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/nobreak_a_snmp_oid_5564.rrd --template snmp_oid 1420463746:U
01/05/2015 11:15:47 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/nobreak_a_snmp_oid_5563.rrd --template snmp_oid 1420463746:U
01/05/2015 11:15:47 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/nobreak_a_snmp_oid_5564.rrd --template snmp_oid 1420463746:U
Re: Problem with script ( custom mib )
Post an snmpwalk of the numeric OID from the cacti server to the device in question.
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Re: Problem with script ( custom mib )
(root@stats)# snmpwalk -v 1 -c t3mp0r4r14 10.0.10.41 1.3.6.1.4.1.3778.1.2.3.0
SNMPv2-SMI::enterprises.3778.1.2.3.0 = INTEGER: 15
(root@stats)# snmpwalk -v 1 -c t3mp0r4r14 10.0.10.41 .1.3.6.1.4.1.3778.1.3.5.1.2
SNMPv2-SMI::enterprises.3778.1.3.5.1.2.1 = INTEGER: 2007
(root@stats)# snmpwalk -m /usr/local/nobreakcp/mibcp.my -v 1 -c t3mp0r4r14 10.0.10.41 1.3.6.1.4.1.3778.1.2.3.0
CP-UPS-MIB::cpUpsEstimatedMinutesRemaining.0 = INTEGER: 15 minutes
(root@stats)# snmpwalk -m /usr/local/nobreakcp/mibcp.my -v 1 -c t3mp0r4r14 10.0.10.41 .1.3.6.1.4.1.3778.1.3.5.1.2
CP-UPS-MIB::cpUpsInputVoltage.1 = INTEGER: 1995 0.1 RMS Volts
SNMPv2-SMI::enterprises.3778.1.2.3.0 = INTEGER: 15
(root@stats)# snmpwalk -v 1 -c t3mp0r4r14 10.0.10.41 .1.3.6.1.4.1.3778.1.3.5.1.2
SNMPv2-SMI::enterprises.3778.1.3.5.1.2.1 = INTEGER: 2007
(root@stats)# snmpwalk -m /usr/local/nobreakcp/mibcp.my -v 1 -c t3mp0r4r14 10.0.10.41 1.3.6.1.4.1.3778.1.2.3.0
CP-UPS-MIB::cpUpsEstimatedMinutesRemaining.0 = INTEGER: 15 minutes
(root@stats)# snmpwalk -m /usr/local/nobreakcp/mibcp.my -v 1 -c t3mp0r4r14 10.0.10.41 .1.3.6.1.4.1.3778.1.3.5.1.2
CP-UPS-MIB::cpUpsInputVoltage.1 = INTEGER: 1995 0.1 RMS Volts
Re: Problem with script ( custom mib )
What OID did you use in the 'SNMP - Generic OID Template'? Do you see that in the poller cache for that device? What about in cacti.log once you increase the logging level?
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Re: Problem with script ( custom mib )
I used the oid .1.3.6.1.4.1.3778.1.3.5.1.3 , tryed others like .1.3.6.1.4.1.3778.1.3.5.1.2 and .1.3.6.1.4.1.3778.1.3.5.1.0, but no success
The error:
01/07/2015 08:19:28 AM - CMDPHP: Poller[0] Host[439] DS[5563] WARNING: Result from SNMP not valid. Partial Result: U
01/07/2015 08:19:28 AM - CMDPHP: Poller[0] Host[439] DS[5563] SNMP: v1: 10.0.10.41, dsname: snmp_oid, oid: .1.3.6.1.4.1.3778.1.3.5.1.3, output: U
01/07/2015 08:19:28 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/nobreak_a_snmp_oid_5563.rrd --template snmp_oid 1420625968:U
(root@stats)# snmpwalk -v 1 -c t3mp0r4r14 10.0.10.41 .1.3.6.1.4.1.3778.1.3.5.1.3
SNMPv2-SMI::enterprises.3778.1.3.5.1.3.1 = INTEGER: 187
Any idea?
The error:
01/07/2015 08:19:28 AM - CMDPHP: Poller[0] Host[439] DS[5563] WARNING: Result from SNMP not valid. Partial Result: U
01/07/2015 08:19:28 AM - CMDPHP: Poller[0] Host[439] DS[5563] SNMP: v1: 10.0.10.41, dsname: snmp_oid, oid: .1.3.6.1.4.1.3778.1.3.5.1.3, output: U
01/07/2015 08:19:28 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/nobreak_a_snmp_oid_5563.rrd --template snmp_oid 1420625968:U
(root@stats)# snmpwalk -v 1 -c t3mp0r4r14 10.0.10.41 .1.3.6.1.4.1.3778.1.3.5.1.3
SNMPv2-SMI::enterprises.3778.1.3.5.1.3.1 = INTEGER: 187
Any idea?
Re: Problem with script ( custom mib )
You're not specifying a valid OID. Pay close attention to the OID returned by the snmpwalk vs what you're using -- they dont match.
Try the following in cacti: .1.3.6.1.4.1.3778.1.3.5.1.3.1
Try the following in cacti: .1.3.6.1.4.1.3778.1.3.5.1.3.1
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Re: Problem with script ( custom mib )
BSOD2600, thanks for your help
The snmp is working perfectly now.
The snmp is working perfectly now.
Who is online
Users browsing this forum: No registered users and 3 guests