Author | Forum: PowerSNMP for .NET Topic: OctetString Data Type DateTime Syntax Formatting Issue |
espc From: USA Posts: 14 Member Since: 06/10/15 |
posted July 13, 2016 10:23 AM Hello, There is a formatting issue with datetime fields. Please check below output. First column is the OID and between equal sign and colon is the formatted data (returned result from variable class FormatValue method) and the last column is the data type (retrieved from variable class definition field). Do you have any suggestions how to fix the formatting issue ? The data format should be something like : 2014-10-29,1:14:34.0,+1:0 Here is the MIB definition of the OID : jnxOperatingRestartTime OBJECT-TYPE SYNTAX DateAndTime MAX-ACCESS read-only STATUS current DESCRIPTION "The time at which this entity last restarted." ::= { jnxOperatingEntry 19 } jnxOperatingRestartTime.1.1.0.0 = ß - + : OctetString (SIZE (8 | 11)) jnxOperatingRestartTime.2.1.0.0 = ß %$ + : OctetString (SIZE (8 | 11)) jnxOperatingRestartTime.2.2.0.0 = ß %$ + : OctetString (SIZE (8 | 11)) jnxOperatingRestartTime.2.3.0.0 = ß %$ + : OctetString (SIZE (8 | 11)) jnxOperatingRestartTime.2.4.0.0 = ß %$ + : OctetString (SIZE (8 | 11)) Thank you. |
espc From: USA Posts: 14 Member Since: 06/10/15 |
posted July 15, 2016 9:02 AM I have manually parsed the variable raw data (byte array data from variable.Value.ToArray()) if syntax is DateAndTime. But this is a bug (although SNMPv2-TC exists in MibNodes class, it can't get the syntax info and format it based on the DISPLAY-HINT) and needs to be fixed. DateAndTime syntax is imported from SNMPv2-TC and below is the syntax description : And the reason why it can't get the MIB definition could be this issue (http://support.dart.com/postings?topicid=8680#35403) which is another bug , i created a while ago but bug is not fixed with the new version. Library still can't handle multi index OIDs. You can test it by querying a multi index OID and check the VariableList result, its definition property will be null which normally should have MIB definitions. DateAndTime ::= TEXTUAL-CONVENTION DISPLAY-HINT "2d-1d-1d,1d:1d:1d.1d,1a1d:1d" STATUS current DESCRIPTION "A date-time specification. field octets contents range ----- ------ -------- ----- 1 1-2 year* 0..65536 2 3 month 1..12 3 4 day 1..31 4 5 hour 0..23 5 6 minutes 0..59 6 7 seconds 0..60 (use 60 for leap-second) 7 8 deci-seconds 0..9 8 9 direction from UTC '+' / '-' 9 10 hours from UTC* 0..13 10 11 minutes from UTC 0..59 * Notes: - the value of year is in network-byte order - daylight saving time in New Zealand is +13 For example, Tuesday May 26, 1992 at 1:30:15 PM EDT would be displayed as: 1992-5-26,13:30:15.0,-4:0 Note that if only local time is known, then timezone information (fields 8-10) is not present." SYNTAX OCTET STRING (SIZE (8 | 11)) |
Reply | PowerSNMP for .NET Topics | Forums |
This site is powered by
![]() |