gpt4 book ai didi

linux - check_snmp_mem.pl 中的内存使用值是如何得出的?

转载 作者:太空宇宙 更新时间:2023-11-04 05:47:27 25 4
gpt4 key购买 nike

我正在配置 icinga2 以使用 check_snmp_mem 处的脚本从一个 Linux 客户端获取内存使用信息。 .pl。知道这个脚本中使用的内存是如何导出的吗?

这是免费的命令输出

# 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,因此也许您可以在某处找到该数字。

关于linux - check_snmp_mem.pl 中的内存使用值是如何得出的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53077200/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com