@@ -29,3 +29,24 @@ def initialize_signals_handler():
29
29
)
30
30
for one_signal in signals_to_catch :
31
31
signal .signal (one_signal , default_signal_handler )
32
+
33
+
34
+ # 1.3.6.1.2.1.2.2.1.4.1|Integer|16436|16436|True
35
+ # 1.3.6.1.2.1.1.6.0|DisplayString|San Francisco, California, United States|San Francisco, California, United States|True
36
+ # 1.3.6.1.2.1.2.2.1.6.2|OctetString|<null>ybù@|0x00127962f940|False
37
+ # 1.3.6.1.2.1.1.9.1.2.7|ObjectIdentity|1.3.6.1.2.1.50|SNMPv2-SMI::mib-2.50|False
38
+ # 1.3.6.1.2.1.6.13.1.4.195.218.254.105.51684.194.67.10.226.22|IpAddress|ÂCâ|194.67.10.226|False
39
+ # 1.3.6.1.2.1.25.3.2.1.6.1025|Counter32|0|0|True
40
+ # 1.3.6.1.2.1.31.1.1.1.15.2|Gauge32|100|100|True
41
+ # 1.3.6.1.2.1.1.3.0|TimeTicks|148271768|148271768|True
42
+ # 1.3.6.1.4.1.2021.10.1.6.1|Opaque|x>ë
|0x9f78043eeb851f|False
43
+ # 1.3.6.1.2.1.31.1.1.1.10.1|Counter64|453477588|453477588|True
44
+ #
45
+ # As you can see, for most types str(value) == value.prettyPrint(), however:
46
+ # - for Opaque, IpAddress, and OctetString we need to use prettyPrint(), otherwise the data is rubbish
47
+ # - any other type should use str() before sending data to MIB-server
48
+ def format_value_for_mib_server (value , value_type ):
49
+ if value_type in ("OctetString" , "IpAddress" , "Opaque" ):
50
+ return value .prettyPrint ()
51
+ else :
52
+ return str (value )
0 commit comments