truncate string

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
sudeep
Posts: 2
Joined: Thu Jul 09, 2009 2:37 am

truncate string

Post by sudeep »

Hi , I am quite new to cacti and currently I am trying to read the temperature value from a IBM RSA adapater. But the value which is returned is a string value like " 17.00 Centigrade". I want to trim the string and read only the integer. Can any one help me on this..., It is a single OID value and I am not using any data input methods.

If i click the verbose query , I am able to read this value

+ Running data query [10].
+ Found type = '3' [snmp query].
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/snmp_queries/cpu_temp.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2.3.51.1.2.1.5'
+ Index found at OID: 'enterprises.2.3.51.1.2.1.5.1.0' value: '17.00 Centigrade'
+ Located input field 'ambientTemp' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2.3.51.1.2.1.5'
+ Found item [ambientTemp='17.00 Centigrade'] index: 0 [from value]
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/snmp_queries/cpu_temp.xml'
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/snmp_queries/cpu_temp.xml'
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/snmp_queries/cpu_temp.xml'


from the bold letter I can see ambientTemp='17.00 Centigrade'

If I click create new graph for this, then
in Data Query Index value show is 17.00 Centigrade
I want to truncate the string before and after the interger.. is that any way to do it ..
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

You are using a data input method.

You will need to use a REGEX to so only the number is returned. But looking at the output of "+ Index found at OID: 'enterprises.2.3.51.1.2.1.5.1.0' value: '17.00 Centigrade' " is wrong. I highly doubt that is the real index value. Post an snmpwalk of 1.3.6.1.4.1.2.3.51.1.2.

Read over http://docs.cacti.net/manual:087:3a_adv ... alkthrough
sudeep
Posts: 2
Joined: Thu Jul 09, 2009 2:37 am

Post by sudeep »

I did a snmp walk to the OID .1.3.6.1.4.1.2.3.51.1.2 and got the output as, where I am only want to read systemAmbientTemp value

cpu1Temp.0 --> Not Readable!
cpu2Temp.0 --> Not Readable!
systemAmbientTemp.0 --> 16.00 Centigrade
plus5Volt.0 --> + 5.16 Volts
plus3Pt3Volt.0 --> + 3.34 Volts
plus12Volt.0 --> +12.28 Volts
fan1speed.0 --> 50% of maximum
fan2speed.0 --> 52% of maximum
fan3speed.0 --> 55% of maximum
fan4speed.0 --> 60% of maximum
fan5speed.0 --> 53% of maximum
fan6speed.0 --> 50% of maximum
fan7speed.0 --> 48% of maximum
fan8speed.0 --> 58% of maximum
fan9speed.0 --> 54% of maximum
fan10speed.0 --> 54% of maximum
systemHealthStat.0 --> normal(255)
generalTempThresholdEntryIndex.1 --> 1
generalTempThresholdEntryIndex.2 --> 2
generalTempThresholdEntryIndex.3 --> 3
generalTempThresholdEntryIndex.4 --> 4
generalTempThresholdEntryIndex.5 --> 5
generalTempThresholdEntryIndex.6 --> 6
generalTempThresholdEntryName.1 --> Planar
generalTempThresholdEntryName.2 --> ASM
generalTempThresholdEntryName.3 --> CPU Area
generalTempThresholdEntryName.4 --> I/O Area
generalTempThresholdEntryName.5 --> System Ambient
generalTempThresholdEntryName.6 --> Memory Area
generalTempThresholdEntryCurrentValue.1 --> Not Readable!
generalTempThresholdEntryCurrentValue.2 --> Not Readable!
generalTempThresholdEntryCurrentValue.3 --> Not Readable!
generalTempThresholdEntryCurrentValue.4 --> Not Readable!
generalTempThresholdEntryCurrentValue.5 --> 16.00 Centigrade
generalTempThresholdEntryCurrentValue.6 --> Not Readable!
generalTempThresholdEntryHardShutdownValue.1 --> Not Readable!
generalTempThresholdEntryHardShutdownValue.2 --> Not Readable!
generalTempThresholdEntryHardShutdownValue.3 --> Not Readable!
generalTempThresholdEntryHardShutdownValue.4 --> Not Readable!
generalTempThresholdEntryHardShutdownValue.5 --> Not Readable!
generalTempThresholdEntryHardShutdownValue.6 --> Not Readable!
generalTempThresholdEntrySoftShutdownValue.1 --> Not Readable!
generalTempThresholdEntrySoftShutdownValue.2 --> Not Readable!
generalTempThresholdEntrySoftShutdownValue.3 --> Not Readable!
generalTempThresholdEntrySoftShutdownValue.4 --> Not Readable!
generalTempThresholdEntrySoftShutdownValue.5 --> Not Readable!
generalTempThresholdEntrySoftShutdownValue.6 --> Not Readable!
generalTempThresholdEntryWarningValue.1 --> Not Readable!
generalTempThresholdEntryWarningValue.2 --> Not Readable!
generalTempThresholdEntryWarningValue.3 --> Not Readable!
generalTempThresholdEntryWarningValue.4 --> Not Readable!
generalTempThresholdEntryWarningValue.5 --> Not Readable!
generalTempThresholdEntryWarningValue.6 --> Not Readable!
generalTempThresholdEntryWarningResetValue.1 --> Not Readable!
generalTempThresholdEntryWarningResetValue.2 --> Not Readable!
generalTempThresholdEntryWarningResetValue.3 --> Not Readable!
generalTempThresholdEntryWarningResetValue.4 --> Not Readable!
generalTempThresholdEntryWarningResetValue.5 --> Not Readable!
generalTempThresholdEntryWarningResetValue.6 --> Not Readable!
cpuTempThresholdEntryIndex.1 --> 1
cpuTempThresholdEntryIndex.2 --> 2
cpuTempThresholdEntryIndex.3 --> 3
cpuTempThresholdEntryIndex.4 --> 4
cpuTempThresholdEntryIndex.5 --> 5
cpuTempThresholdEntryIndex.6 --> 6
cpuTempThresholdEntryIndex.7 --> 7
cpuTempThresholdEntryIndex.8 --> 8
cpuTempThresholdEntryName.1 --> CPU-1
cpuTempThresholdEntryName.2 --> CPU-2
cpuTempThresholdEntryName.3 --> CPU-3
cpuTempThresholdEntryName.4 --> CPU-4
cpuTempThresholdEntryName.5 --> CPU-5
cpuTempThresholdEntryName.6 --> CPU-6
cpuTempThresholdEntryName.7 --> CPU-7
cpuTempThresholdEntryName.8 --> CPU-8
cpuTempThresholdEntryCurrentValue.1 --> Not Readable!
cpuTempThresholdEntryCurrentValue.2 --> Not Readable!
cpuTempThresholdEntryCurrentValue.3 --> Not Readable!
cpuTempThresholdEntryCurrentValue.4 --> Not Readable!
cpuTempThresholdEntryCurrentValue.5 --> Not Readable!
cpuTempThresholdEntryCurrentValue.6 --> Not Readable!
cpuTempThresholdEntryCurrentValue.7 --> Not Readable!
cpuTempThresholdEntryCurrentValue.8 --> Not Readable!
cpuTempThresholdEntryHardShutdownValue.1 --> Not Readable!
cpuTempThresholdEntryHardShutdownValue.2 --> Not Readable!
cpuTempThresholdEntryHardShutdownValue.3 --> Not Readable!
cpuTempThresholdEntryHardShutdownValue.4 --> Not Readable!
cpuTempThresholdEntryHardShutdownValue.5 --> Not Readable!
cpuTempThresholdEntryHardShutdownValue.6 --> Not Readable!
cpuTempThresholdEntryHardShutdownValue.7 --> Not Readable!
cpuTempThresholdEntryHardShutdownValue.8 --> Not Readable!
cpuTempThresholdEntrySoftShutdownValue.1 --> Not Readable!
cpuTempThresholdEntrySoftShutdownValue.2 --> Not Readable!
cpuTempThresholdEntrySoftShutdownValue.3 --> Not Readable!
cpuTempThresholdEntrySoftShutdownValue.4 --> Not Readable!
cpuTempThresholdEntrySoftShutdownValue.5 --> Not Readable!
cpuTempThresholdEntrySoftShutdownValue.6 --> Not Readable!
cpuTempThresholdEntrySoftShutdownValue.7 --> Not Readable!
cpuTempThresholdEntrySoftShutdownValue.8 --> Not Readable!
cpuTempThresholdEntryWarningValue.1 --> Not Readable!
cpuTempThresholdEntryWarningValue.2 --> Not Readable!
cpuTempThresholdEntryWarningValue.3 --> Not Readable!
cpuTempThresholdEntryWarningValue.4 --> Not Readable!
cpuTempThresholdEntryWarningValue.5 --> Not Readable!
cpuTempThresholdEntryWarningValue.6 --> Not Readable!
cpuTempThresholdEntryWarningValue.7 --> Not Readable!
cpuTempThresholdEntryWarningValue.8 --> Not Readable!
cpuTempThresholdEntryWarningResetValue.1 --> Not Readable!
cpuTempThresholdEntryWarningResetValue.2 --> Not Readable!
cpuTempThresholdEntryWarningResetValue.3 --> Not Readable!
cpuTempThresholdEntryWarningResetValue.4 --> Not Readable!
cpuTempThresholdEntryWarningResetValue.5 --> Not Readable!
cpuTempThresholdEntryWarningResetValue.6 --> Not Readable!
cpuTempThresholdEntryWarningResetValue.7 --> Not Readable!
cpuTempThresholdEntryWarningResetValue.8 --> Not Readable!
dasdTempThresholdEntryIndex.1 --> 1
dasdTempThresholdEntryIndex.2 --> 2
dasdTempThresholdEntryIndex.3 --> 3
dasdTempThresholdEntryIndex.4 --> 4
dasdTempThresholdEntryName.1 --> DASD-1
dasdTempThresholdEntryName.2 --> DASD-2
dasdTempThresholdEntryName.3 --> DASD-3
dasdTempThresholdEntryName.4 --> DASD-4
dasdTempThresholdEntryCurrentValue.1 --> Not Readable!
dasdTempThresholdEntryCurrentValue.2 --> Not Readable!
dasdTempThresholdEntryCurrentValue.3 --> Not Readable!
dasdTempThresholdEntryCurrentValue.4 --> Not Readable!
dasdTempThresholdEntryHardShutdownValue.1 --> Not Readable!
dasdTempThresholdEntryHardShutdownValue.2 --> Not Readable!
dasdTempThresholdEntryHardShutdownValue.3 --> Not Readable!
dasdTempThresholdEntryHardShutdownValue.4 --> Not Readable!
dasdTempThresholdEntrySoftShutdownValue.1 --> Not Readable!
dasdTempThresholdEntrySoftShutdownValue.2 --> Not Readable!
dasdTempThresholdEntrySoftShutdownValue.3 --> Not Readable!
dasdTempThresholdEntrySoftShutdownValue.4 --> Not Readable!
dasdTempThresholdEntryWarningValue.1 --> Not Readable!
dasdTempThresholdEntryWarningValue.2 --> Not Readable!
dasdTempThresholdEntryWarningValue.3 --> Not Readable!
dasdTempThresholdEntryWarningValue.4 --> Not Readable!
dasdTempThresholdEntryWarningResetValue.1 --> Not Readable!
dasdTempThresholdEntryWarningResetValue.2 --> Not Readable!
dasdTempThresholdEntryWarningResetValue.3 --> Not Readable!
dasdTempThresholdEntryWarningResetValue.4 --> Not Readable!
voltageThresholdEntryIndex.1 --> 1
voltageThresholdEntryIndex.2 --> 2
voltageThresholdEntryIndex.3 --> 3
voltageThresholdEntryIndex.4 --> 4
voltageThresholdEntryIndex.5 --> 5
voltageThresholdEntryIndex.6 --> 6
voltageThresholdEntryIndex.7 --> 7
voltageThresholdEntryIndex.8 --> 8
voltageThresholdEntryName.1 --> +5v
voltageThresholdEntryName.2 --> +3.3v
voltageThresholdEntryName.3 --> +12v
voltageThresholdEntryName.4 --> -12v
voltageThresholdEntryName.5 --> -5v
voltageThresholdEntryName.6 --> +2.5v
voltageThresholdEntryName.7 --> +1.5v
voltageThresholdEntryName.8 --> +1.25v
voltageThresholdEntryCurrentValue.1 --> + 5.16 Volts
voltageThresholdEntryCurrentValue.2 --> + 3.34 Volts
voltageThresholdEntryCurrentValue.3 --> +12.28 Volts
voltageThresholdEntryCurrentValue.4 --> Not Readable!
voltageThresholdEntryCurrentValue.5 --> Not Readable!
voltageThresholdEntryCurrentValue.6 --> Not Readable!
voltageThresholdEntryCurrentValue.7 --> Not Readable!
voltageThresholdEntryCurrentValue.8 --> Not Readable!
voltageThresholdEntryHardShutdownHighValue.1 --> Not Readable!
voltageThresholdEntryHardShutdownHighValue.2 --> Not Readable!
voltageThresholdEntryHardShutdownHighValue.3 --> Not Readable!
voltageThresholdEntryHardShutdownHighValue.4 --> Not Readable!
voltageThresholdEntryHardShutdownHighValue.5 --> Not Readable!
voltageThresholdEntryHardShutdownHighValue.6 --> Not Readable!
voltageThresholdEntryHardShutdownHighValue.7 --> Not Readable!
voltageThresholdEntryHardShutdownHighValue.8 --> Not Readable!
voltageThresholdEntrySoftShutdownHighValue.1 --> + 5.61 Volts
voltageThresholdEntrySoftShutdownHighValue.2 --> + 3.55 Volts
voltageThresholdEntrySoftShutdownHighValue.3 --> +13.34 Volts
voltageThresholdEntrySoftShutdownHighValue.4 --> Not Readable!
voltageThresholdEntrySoftShutdownHighValue.5 --> Not Readable!
voltageThresholdEntrySoftShutdownHighValue.6 --> Not Readable!
voltageThresholdEntrySoftShutdownHighValue.7 --> Not Readable!
voltageThresholdEntrySoftShutdownHighValue.8 --> Not Readable!
voltageThresholdEntryWarningHighValue.1 --> Not Readable!
voltageThresholdEntryWarningHighValue.2 --> Not Readable!
voltageThresholdEntryWarningHighValue.3 --> Not Readable!
voltageThresholdEntryWarningHighValue.4 --> Not Readable!
voltageThresholdEntryWarningHighValue.5 --> Not Readable!
voltageThresholdEntryWarningHighValue.6 --> Not Readable!
voltageThresholdEntryWarningHighValue.7 --> Not Readable!
voltageThresholdEntryWarningHighValue.8 --> Not Readable!
voltageThresholdEntryWarningResetHighValue.1 --> Not Readable!
voltageThresholdEntryWarningResetHighValue.2 --> Not Readable!
voltageThresholdEntryWarningResetHighValue.3 --> Not Readable!
voltageThresholdEntryWarningResetHighValue.4 --> Not Readable!
voltageThresholdEntryWarningResetHighValue.5 --> Not Readable!
voltageThresholdEntryWarningResetHighValue.6 --> Not Readable!
voltageThresholdEntryWarningResetHighValue.7 --> Not Readable!
voltageThresholdEntryWarningResetHighValue.8 --> Not Readable!
voltageThresholdEntryHardShutdownLowValue.1 --> Not Readable!
voltageThresholdEntryHardShutdownLowValue.2 --> Not Readable!
voltageThresholdEntryHardShutdownLowValue.3 --> Not Readable!
voltageThresholdEntryHardShutdownLowValue.4 --> Not Readable!
voltageThresholdEntryHardShutdownLowValue.5 --> Not Readable!
voltageThresholdEntryHardShutdownLowValue.6 --> Not Readable!
voltageThresholdEntryHardShutdownLowValue.7 --> Not Readable!
voltageThresholdEntryHardShutdownLowValue.8 --> Not Readable!
voltageThresholdEntrySoftShutdownLowValue.1 --> + 4.38 Volts
voltageThresholdEntrySoftShutdownLowValue.2 --> + 3.02 Volts
voltageThresholdEntrySoftShutdownLowValue.3 --> +10.57 Volts
voltageThresholdEntrySoftShutdownLowValue.4 --> Not Readable!
voltageThresholdEntrySoftShutdownLowValue.5 --> Not Readable!
voltageThresholdEntrySoftShutdownLowValue.6 --> Not Readable!
voltageThresholdEntrySoftShutdownLowValue.7 --> Not Readable!
voltageThresholdEntrySoftShutdownLowValue.8 --> Not Readable!
voltageThresholdEntryWarningLowValue.1 --> Not Readable!
voltageThresholdEntryWarningLowValue.2 --> Not Readable!
voltageThresholdEntryWarningLowValue.3 --> Not Readable!
voltageThresholdEntryWarningLowValue.4 --> Not Readable!
voltageThresholdEntryWarningLowValue.5 --> Not Readable!
voltageThresholdEntryWarningLowValue.6 --> Not Readable!
voltageThresholdEntryWarningLowValue.7 --> Not Readable!
voltageThresholdEntryWarningLowValue.8 --> Not Readable!
voltageThresholdEntryWarningResetLowValue.1 --> Not Readable!
voltageThresholdEntryWarningResetLowValue.2 --> Not Readable!
voltageThresholdEntryWarningResetLowValue.3 --> Not Readable!
voltageThresholdEntryWarningResetLowValue.4 --> Not Readable!
voltageThresholdEntryWarningResetLowValue.5 --> Not Readable!
voltageThresholdEntryWarningResetLowValue.6 --> Not Readable!
voltageThresholdEntryWarningResetLowValue.7 --> Not Readable!
voltageThresholdEntryWarningResetLowValue.8 --> Not Readable!
biosVpdVersionNumber.0 --> 0
biosVpdBuildLevelName.0 --> POST/BIOS VPD build name unavailable
biosVpdBuildDate.0 --> POST/BIOS VPD build date unavailable
ismpRevisionNumber.0 --> 1.39
ismpBuildID.0 --> GGBT51A
ismpBuildDate.0 --> 11-21-07
asmVideoBios.0 -->
asmDeviceDriver.0 -->
machineLevelVpdMachineType.0 --> 7979
machineLevelVpdMachineModel.0 --> B9A
machineLevelSerialNumber.0 --> 99X1329
machineLevelUUID.0 --> 80D7 9E87 D260 B601 C1A6 001A 646A 3140
machineLevelMAC.0 --> 4d 41 43 20 31 3a 20 30 30 3a 38 34 3a 43 43 3a 34 43 3a 30 30 3a 30 30 0d 0a 4d 41 43 20 32 3a 20 36 31 3a 44 34 3a 30 30 3a 30 30 3a 30 30 3a 30 33 0d 0a
firmwareVpdIndex.1 --> 1
firmwareVpdIndex.2 --> 2
firmwareVpdIndex.3 --> 3
firmwareVpdName.1 --> Main Application
firmwareVpdName.2 --> Boot ROM
firmwareVpdName.3 --> Remote Control
firmwareVpdBuildId.1 --> GGEP36B
firmwareVpdBuildId.2 --> GGBP36B
firmwareVpdBuildId.3 --> Not Readable!
firmwareVpdRevisonNumber.1 --> 18
firmwareVpdRevisonNumber.2 --> 18
firmwareVpdRevisonNumber.3 --> Not Readable!
firmwareVpdFilename.1 --> PAETMNUS.PKT
firmwareVpdFilename.2 --> PAETBRUS.PKT
firmwareVpdFilename.3 --> Not Readable!
firmwareVpdBuildDate.1 --> 10-29-08
firmwareVpdBuildDate.2 --> 10-29-08
firmwareVpdBuildDate.3 --> Not Readable!
componentLevelVpdIndex.1 --> 1
componentLevelVpdIndex.2 --> 2
componentLevelVpdIndex.3 --> 3
componentLevelVpdIndex.4 --> 4
componentLevelVpdIndex.5 --> 5
componentLevelVpdFruNumber.1 --> 24R2733
componentLevelVpdFruNumber.2 --> 24R2731
componentLevelVpdFruNumber.3 --> 24R2731
componentLevelVpdFruNumber.4 --> 44W3110
componentLevelVpdFruNumber.5 --> 44E5081
componentLevelVpdSerialNumber.1 --> K13217CT07C
componentLevelVpdSerialNumber.2 --> K11217CN033
componentLevelVpdSerialNumber.3 --> K11217BH2BW
componentLevelVpdSerialNumber.4 --> K10B0 7BMA1K
componentLevelVpdSerialNumber.5 --> K10907CV0KE
componentLevelVpdManufacturingId.1 --> ARTE
componentLevelVpdManufacturingId.2 --> ARTE
componentLevelVpdManufacturingId.3 --> ARTE
componentLevelVpdManufacturingId.4 --> MOLX
componentLevelVpdManufacturingId.5 --> FOXC
componentLevelVpdSlotNumber.1 --> n/a
componentLevelVpdSlotNumber.2 --> 1
componentLevelVpdSlotNumber.3 --> 2
componentLevelVpdSlotNumber.4 --> n/a
componentLevelVpdSlotNumber.5 --> n/a
componentLevelVpdTrackingIndex.1 --> 1
componentLevelVpdTrackingIndex.2 --> 2
componentLevelVpdTrackingIndex.3 --> 3
componentLevelVpdTrackingIndex.4 --> 4
componentLevelVpdTrackingIndex.5 --> 5
componentLevelVpdTrackingFruNumber.1 --> 44E5081
componentLevelVpdTrackingFruNumber.2 --> 44W3110
componentLevelVpdTrackingFruNumber.3 --> 24R2731
componentLevelVpdTrackingFruNumber.4 --> 24R2731
componentLevelVpdTrackingFruNumber.5 --> 24R2733
componentLevelVpdTrackingSerialNumber.1 --> K10907CV0KE
componentLevelVpdTrackingSerialNumber.2 --> K10B0 7BMA1K
componentLevelVpdTrackingSerialNumber.3 --> K11217BH2BW
componentLevelVpdTrackingSerialNumber.4 --> K11217CN033
componentLevelVpdTrackingSerialNumber.5 --> K13217CT07C
componentLevelVpdTrackingManufacturingId.1 --> FOXC
componentLevelVpdTrackingManufacturingId.2 --> MOLX
componentLevelVpdTrackingManufacturingId.3 --> ARTE
componentLevelVpdTrackingManufacturingId.4 --> ARTE
componentLevelVpdTrackingManufacturingId.5 --> ARTE
componentLevelVpdTrackingSlotNumber.1 --> n/a
componentLevelVpdTrackingSlotNumber.2 --> n/a
componentLevelVpdTrackingSlotNumber.3 --> 2
componentLevelVpdTrackingSlotNumber.4 --> 1
componentLevelVpdTrackingSlotNumber.5 --> n/a
componentLevelVpdTrackingAction.1 --> Added
componentLevelVpdTrackingAction.2 --> Added
componentLevelVpdTrackingAction.3 --> Added
componentLevelVpdTrackingAction.4 --> Added
componentLevelVpdTrackingAction.5 --> Added
componentLevelVpdTrackingTimestamp.1 --> Time:17:43:12,Date:07/09/2009
componentLevelVpdTrackingTimestamp.2 --> Time:17:43:12,Date:07/09/2009
componentLevelVpdTrackingTimestamp.3 --> Time:17:43:11,Date:07/09/2009
componentLevelVpdTrackingTimestamp.4 --> Time:17:43:11,Date:07/09/2009
componentLevelVpdTrackingTimestamp.5 --> Time:17:43:10,Date:07/09/2009
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

If you ONLY EVER want systemAmbientTemp, then just use the snmp generic oid template.

The point of the snmp data query is to be able to easily view/poll all of those different environmental sensors in a dynamic manor. I'd personally create ones for the temperature, fans. and voltage.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests