check_snmp_mem.pl中的内存使用值是如何导出的?
How is memory used value derived in check_snmp_mem.pl?
我正在配置 icinga2 以使用位于 check_snmp_mem.pl 的脚本从一个 linux 客户端获取内存使用信息。知道这个脚本中使用的内存是如何导出的吗?
这里是免费的命令输出
# free
total used free shared buff/cache available
Mem: 500016 59160 89564 3036 351292 408972
Swap: 1048572 4092 1044480
icinga 仪表板中显示的性能数据是
Label Value Max Warning Critical
ram_used 137,700.00 500,016.00 470,015.00 490,016.00
swap_used 4,092.00 1,048,572.00 524,286.00 838,858.00
查看源代码,例如在这一行中提到了 ram_used
:
$n_output .= " | ram_used=" . ($$resultat{$nets_ram_total}-$$resultat{$nets_ram_free}-$$resultat{$nets_ram_cache}).";";
这强烈表明 ram_used
计算为总 RAM 和空闲 RAM 以及用于缓存的 RAM 的差值。这些值通过以下 SNMP id 检索:
my $nets_ram_free = "1.3.6.1.4.1.2021.4.6.0"; # Real memory free
my $nets_ram_total = "1.3.6.1.4.1.2021.4.5.0"; # Real memory total
my $nets_ram_cache = "1.3.6.1.4.1.2021.4.15.0"; # Real memory cached
我不知道它们与 free
的输出有何关联。 free
和 Icinga 报告的可用内存差异为 48136,因此也许您可以在某处找到该数字。
我正在配置 icinga2 以使用位于 check_snmp_mem.pl 的脚本从一个 linux 客户端获取内存使用信息。知道这个脚本中使用的内存是如何导出的吗?
这里是免费的命令输出
# free
total used free shared buff/cache available
Mem: 500016 59160 89564 3036 351292 408972
Swap: 1048572 4092 1044480
icinga 仪表板中显示的性能数据是
Label Value Max Warning Critical
ram_used 137,700.00 500,016.00 470,015.00 490,016.00
swap_used 4,092.00 1,048,572.00 524,286.00 838,858.00
查看源代码,例如在这一行中提到了 ram_used
:
$n_output .= " | ram_used=" . ($$resultat{$nets_ram_total}-$$resultat{$nets_ram_free}-$$resultat{$nets_ram_cache}).";";
这强烈表明 ram_used
计算为总 RAM 和空闲 RAM 以及用于缓存的 RAM 的差值。这些值通过以下 SNMP id 检索:
my $nets_ram_free = "1.3.6.1.4.1.2021.4.6.0"; # Real memory free
my $nets_ram_total = "1.3.6.1.4.1.2021.4.5.0"; # Real memory total
my $nets_ram_cache = "1.3.6.1.4.1.2021.4.15.0"; # Real memory cached
我不知道它们与 free
的输出有何关联。 free
和 Icinga 报告的可用内存差异为 48136,因此也许您可以在某处找到该数字。