技術メモ

神奈川在住のITエンジニアの備忘録。おもにプログラミングやネットワーク技術について、学んだことを自分の中で整理するためにゆるゆると書いています。ちゃんと検証できていない部分もあるのでご参考程度となりますが、誰かのお役に立てれば幸いです。

SNMPのCounterBasedGauge64型について

以前、https://akrad.hatenablog.com/entry/2019/08/21/232701 の記事を書いた後、ネット上で、CounterBasedGauge64 という型があるという情報を見つけた。

SNMPに Counter64型以外で64bitの範囲の値を表現できる型があるのかな?」と思ったが、さらに調べたところ、これは Counter64 型の Textual Convention (別名のようなもの) だった。つまり、SNMPに Counter64型以外で64bitの範囲の値を表現できる型があるわけではない。

ちなみに、RFCでの説明は以下になっている。

3.1. CounterBasedGauge64
This textual convention defines a 64-bit gauge, but defined with
Counter64 syntax, since no Gauge64 or Unsigned64 base type is
available in SMIv2.

This TC is used for storing the difference between two Counter64
values, or simply storing a snapshot of a Counter64 value at a given
moment in time.

・・・

 

4. Definitions

CounterBasedGauge64 ::= TEXTUAL-CONVENTION 

STATUS current

DESCRIPTION
"The CounterBasedGauge64 type represents a non-negative
integer, which may increase or decrease, but shall never
exceed a maximum value, nor fall below a minimum value. The
maximum value can not be greater than 2^64-1
(18446744073709551615 decimal), and the minimum value can
not be smaller than 0. The value of a CounterBasedGauge64
has its maximum value whenever the information being modeled
is greater than or equal to its maximum value, and has its
minimum value whenever the information being modeled is
smaller than or equal to its minimum value. If the
information being modeled subsequently decreases below
(increases above) the maximum (minimum) value, the
CounterBasedGauge64 also decreases (increases).

★Note that this TC is not strictly supported in SMIv2,
because the 'always increasing' and 'counter wrap' semantics
associated with the Counter64 base type are not preserved.
It is possible that management applications which rely
solely upon the (Counter64) ASN.1 tag to determine object
semantics will mistakenly operate upon objects of this type
as they would for Counter64 objects.

★This textual convention represents a limited and short-term
solution, and may be deprecated as a long term solution is
defined and deployed to replace it."


SYNTAX Counter64

 https://tools.ietf.org/html/rfc2856

 

上記の★の辺りを読むと、SMIv2 で厳密にサポートされているわけではなく、使われなくなるかもしれないという記載もあるので、今後もあまり目にする機会はなさそうな気がする。