コンテンツにスキップ

CRM テーブル

概要

Critical Resource Monitoring (CRM) は ASIC の HW リソース使用率 (route / nexthop / FDB / ACL / NAT / MPLS / SRv6 / DASH) をポーリング監視し、閾値超過時に THRESHOLD_EXCEEDED / THRESHOLD_CLEAR アラートを生成する機能。設定は CRM|Config の単一エントリに集約される1orchagentCrmOrchCONFIG_DB を購読し、COUNTERS_DBCRM 統計を更新する。

データフロー (自動生成)

flowchart LR
  CDB[("CONFIG_DB<br/>CRM")]
  DM["CrmOrch"]
  CDB --> DM
  SAI["SAI<br/>sai_switch_api"]
  DM --> SAI

凡例

CONFIG_DB から SAI までの典型経路を docs/reference/config-db-orch-map.md から機械生成したミニ図。詳細・例外は本ページ本文と対応表を参照。

key 構造

CRM|Config

(list ではなく単一 container)

主要フィールド

各リソースに対し <resource>_threshold_type / <resource>_high_threshold / <resource>_low_threshold の三つ組が並ぶ。

系統 リソース key prefix
ACL acl_table, acl_group, acl_entry, acl_counter
FIB ipv4_route, ipv6_route, ipv4_nexthop, ipv6_nexthop, ipv4_neighbor, ipv6_neighbor
ECMP nexthop_group, nexthop_group_member
L2 fdb_entry
NAT dnat_entry, snat_entry
多目的 ipmc_entry, mpls_inseg, mpls_nexthop
SRv6 srv6_my_sid_entry, srv6_nexthop
DASH dash_vnet, dash_eni, dash_eni_ether_address_map, dash_ipv4_inbound_routing, dash_ipv6_inbound_routing, dash_ipv4_outbound_routing, dash_ipv6_outbound_routing, dash_ipv4_pa_validation, dash_ipv6_pa_validation, dash_ipv4_outbound_ca_to_pa, dash_ipv6_outbound_ca_to_pa, dash_ipv4_acl_group, dash_ipv6_acl_group, dash_ipv4_acl_rule, dash_ipv6_acl_rule

<resource>_threshold_typecrm_threshold_type (PERCENTAGE / USED / FREE) を取る。PERCENTAGE のときは high/low ともに 0..100 でなければならない。

加えてグローバル設定:

フィールド 説明
polling_interval uint16 リソース使用量ポーリング間隔 [秒]

制約

  • すべての three-tuple について high_threshold > low_thresholdmust で強制
  • DASH 系列は DEVICE_METADATA.localhost.switch_type = 'dpu' のときのみ有効 (when)

例外条件・特殊挙動

  • percentage 閾値が 100 超 → runtime_error → エラーログ + return: threshold_type = percentage のとき low_threshold > 100 または high_threshold > 100 の場合 runtime_error("CRM percentage threshold value must be <= 100%%") が発生し、catch → SWSS_LOG_ERROR + return。残りフィールドも適用されない。
  • low >= high → runtime_error: low_threshold >= high_threshold の場合も同様に runtime_error("CRM low threshold must be less then high threshold") → エラーログ + return。
  • DEL コマンド → 非対応エラーログのみ: op == DEL_COMMAND が来ると SWSS_LOG_ERROR("Unsupported operation type") を出力するが閾値は変更されない。CRM 設定の削除は未サポート。
  • 不明属性フィールド → エラーログ + return (残フィールドも適用されない): polling_interval / 各 threshold_type / threshold_low / threshold_high 以外のフィールドが来ると SWSS_LOG_ERROR("Failed to parse CRM ... Unknown attribute %s.") して return
  • 未対応 SAI リソース → ignore: タイマー処理で取得できないリソースは // ignore unsupported resources としてスキップ。

値依存挙動マトリクス

フィールド 挙動
<resource>_threshold_type percentage(既定) 閾値を使用率 % として解釈。high_threshold > 100 または low_threshold > 100 の場合 runtime_error を発生させ処理を中断(crmorch.cpp:428-431)。アラートは used/total * 100 >= high_threshold で発火。
<resource>_threshold_type used 閾値を「使用中エントリ数」の絶対値として解釈。ASIC の total 数に依存せず細かく制御可能。100 超でもエラーにならない。
<resource>_threshold_type free 閾値を「空きエントリ数」として解釈。アラートの超過/クリアの向きが percentage/used と逆(残り少なくなると EXCEEDED)。
dash_*_threshold_type 任意 DEVICE_METADATA.switch_type = 'dpu' のときのみ有効(YANG when 制約)。通常スイッチでは YANG validator が拒否。

購読者

  • orchagentCrmOrch: ポーリング、SAI から使用量取得、COUNTERS_DB 更新、syslog アラート

関連 CONFIG_DB / YANG / CLI

  • 関連 CONFIG_DB: DEVICE_METADATA
  • 関連 CLI: crm config thresholds ...crm show resources/thresholds
  • 関連 YANG: sonic-crm

関連リファレンス

引用元

関連 Topics

運用ヒント

典型値

  • key 形式: CRM|Config
  • acl_table_threshold_type: percentage / used / free
  • *_high_threshold / *_low_threshold: 70 / 60 など。
  • polling_interval: 300(秒)。

よくある誤設定

  • 閾値を 100% に近く設定すると alert が遅れ、ACL 追加で SAI エラーが先に起きる。70%/80% 程度で運用するのが定石。

確認コマンド

sonic-db-cli CONFIG_DB hgetall 'CRM|Config'
crm show summary
crm show resources all