Мониторинг памяти linux snmp

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Check memory and swap usage on Windows or Linux Server using SNMP queries

License

ynlamy/check_snmp_memory

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.txt

This plugin can check memory and swap usage on Windows or Linux Server using SNMP v1 queries. check_snmp_memory is written in Bash and is distributed under the GPLv2 license. This plugin have been created by Yoann LAMY. Usage: ./check_snmp_memory -H xxx.xxx.xxx.xxx -C public -w 80 -c 90 -H ADDRESS Name or IP address of host (default: 127.0.0.1) -C STRING Community name for the host's SNMP agent (default: public) -w INTEGER Warning level for memory in percent (default: 0) -c INTEGER Critical level for memory in percent (default: 0) -h Print this help screen -V Print version and license information This plugin uses 'snmpget' and 'snmpwalk' commands included with the NET-SNMP package. This plugin support performance data output. If the percentage of the warning and critical levels are set to 0, then the script returns a OK state. This nagios plugins comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of the plugins under the terms of the GNU General Public License v2.

About

Check memory and swap usage on Windows or Linux Server using SNMP queries

Читайте также:  Linux driver for logitech

Источник

Monitoring System Parameters like Memory, CPU and Disks on Linux Systems via SNMP

monitoring system parameters like memory cpu and disks on linux systems via snmp

Originally published on August 15, 2006 by Dirk Paessler
Last updated on March 03, 2022 • 2 minute read

Every other day users of our monitoring products PRTG Traffic Grapher and IPCheck Server Monitor ask us how they can monitor system parameters like CPU load, memory load, swap file size or disk usage on Linux and Unix systems. Today we have published a new step-by-step article in our knowledgebase that explains how to set up system parameter monitoring for Linux systems.

There are two steps that need to be taken: First you must install the NET-SNMP daemon on the Linux server — which is the more complicated step. After this is done you can easily use a built-in feature of PRTG and IPCheck to find all available sensors on the systems and create sensors for them for monitoring. Creating new sensors will now only be a matter of a few mouse clicks. Probably the most interesting parameters that you can monitor this way are:

  • mem avail swap: Available Swap Space on the host.
  • mem avail real: Available Real/Physical Memory Space on the host.
  • cpu raw user: User CPU time in ticks per second, as reported by the kernel. Total ticks is 100xNumber of Processors. For single processor machine numbers will appear to be percentages as the kernel will tally ticks at 100 per second.
  • cpu raw idle: Idle CPU time in ticks per second, as reported by the kernel.
  • ss raw contexts: Number of context switches
  • dsk percent: Percentage of space used on disk
Читайте также:  Temp command in linux

Источник

Linux SNMP OID’ы для CPU, Memory

Для мониторинга системы используя snmp, удобно собираться статистики по потреблению различные ресурсов, например памяти и процессора.

Использовать данные OID можно в командой строке или применить для своих шаблонов, к примеру для системы мониторинга Cacti.

В командной строке используется следующим образом:

# snmpwalk -v 2c -c public host OID

— версия snmp;
public — коммьюнити, в вашем случае может быть другое;
host — IP иди DNS name;
OID из списка ниже.

CPU статистика:

Средняя загрузка системы (Load Average):

1 minute Load: .1.3.6.1.4.1.2021.10.1.3.1
5 minute Load: .1.3.6.1.4.1.2021.10.1.3.2
15 minute Load: .1.3.6.1.4.1.2021.10.1.3.3

percentage of user CPU time: .1.3.6.1.4.1.2021.11.9.0
raw user cpu time: .1.3.6.1.4.1.2021.11.50.0
percentages of system CPU time: .1.3.6.1.4.1.2021.11.10.0
raw system cpu time: .1.3.6.1.4.1.2021.11.52.0
percentages of idle CPU time: .1.3.6.1.4.1.2021.11.11.0
raw idle cpu time: .1.3.6.1.4.1.2021.11.53.0
raw nice cpu time: .1.3.6.1.4.1.2021.11.51.0

Статистика по ресурсам памяти:

Total Swap Size: .1.3.6.1.4.1.2021.4.3.0
Available Swap Space: .1.3.6.1.4.1.2021.4.4.0
Total RAM in machine: .1.3.6.1.4.1.2021.4.5.0
Total RAM used: .1.3.6.1.4.1.2021.4.6.0
Total RAM Free: .1.3.6.1.4.1.2021.4.11.0
Total RAM Shared: .1.3.6.1.4.1.2021.4.13.0
Total RAM Buffered: .1.3.6.1.4.1.2021.4.14.0
Total Cached Memory: .1.3.6.1.4.1.2021.4.15.0

Источник

monitor real memory usage in linux using perl and snmp

I need to get the real free memory in an stripped Linux appliance. I want to get real free memory.
Getting the free memory does not take into account the buffers/cache so I seems to be out of ram while I still have plenty left for applications. I am using snmp to get this value from a Perl script, and I have these oid at my disposal:

> HOST-RESOURCES-MIB::hrStorageDescr.1 = STRING: Physical memory > HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: Virtual memory > HOST-RESOURCES-MIB::hrStorageDescr.6 = STRING: Memory buffers > HOST-RESOURCES-MIB::hrStorageDescr.7 = STRING: Cached memory > HOST-RESOURCES-MIB::hrStorageDescr.10 = STRING: Swap space > HOST-RESOURCES-MIB::hrStorageDescr.31 = STRING: / > HOST-RESOURCES-MIB::hrStorageDescr.32 = STRING: /boot > HOST-RESOURCES-MIB::hrStorageDescr.33 = STRING: /var/log > HOST-RESOURCES-MIB::hrStorageAllocationUnits.1 = INTEGER: 1024 Bytes > HOST-RESOURCES-MIB::hrStorageAllocationUnits.3 = INTEGER: 1024 Bytes > HOST-RESOURCES-MIB::hrStorageAllocationUnits.6 = INTEGER: 1024 Bytes > HOST-RESOURCES-MIB::hrStorageAllocationUnits.7 = INTEGER: 1024 Bytes > HOST-RESOURCES-MIB::hrStorageAllocationUnits.10 = INTEGER: 1024 Bytes > HOST-RESOURCES-MIB::hrStorageAllocationUnits.31 = INTEGER: 4096 Bytes > HOST-RESOURCES-MIB::hrStorageAllocationUnits.32 = INTEGER: 1024 Bytes > HOST-RESOURCES-MIB::hrStorageAllocationUnits.33 = INTEGER: 4096 Bytes > HOST-RESOURCES-MIB::hrStorageSize.1 = INTEGER: 8240104 > HOST-RESOURCES-MIB::hrStorageSize.3 = INTEGER: 16626024 > HOST-RESOURCES-MIB::hrStorageSize.6 = INTEGER: 8240104 > HOST-RESOURCES-MIB::hrStorageSize.7 = INTEGER: 4697308 > HOST-RESOURCES-MIB::hrStorageSize.10 = INTEGER: 8385920 > HOST-RESOURCES-MIB::hrStorageSize.31 = INTEGER: 4062954 > HOST-RESOURCES-MIB::hrStorageSize.32 = INTEGER: 295561 > HOST-RESOURCES-MIB::hrStorageSize.33 = INTEGER: 33011530 > HOST-RESOURCES-MIB::hrStorageUsed.1 = INTEGER: 5610512 > HOST-RESOURCES-MIB::hrStorageUsed.3 = INTEGER: 5610512 > HOST-RESOURCES-MIB::hrStorageUsed.6 = INTEGER: 326360 > HOST-RESOURCES-MIB::hrStorageUsed.7 = INTEGER: 4697308 > HOST-RESOURCES-MIB::hrStorageUsed.10 = INTEGER: 0 > HOST-RESOURCES-MIB::hrStorageUsed.31 = INTEGER: 1673253 > HOST-RESOURCES-MIB::hrStorageUsed.32 = INTEGER: 24061 > HOST-RESOURCES-MIB::hrStorageUsed.33 = INTEGER: 19467049 

I do not manage to get what is my exact RAM usage in Linux I have to add the the physical free memory what is stored in the cache and buffers?
What is the best way to do it in Perl? Is the hrStorage the best or is best to use de UCD-SNMP_MIB (.1.3.6.1.4.1.2021.4)? edit: I created the following scriptlet that would based on comments here calculate the real used memory percent. Do you think is the best I can do or is there anything else I should do?

my $memRealTotalOID = '.1.3.6.1.4.1.2021.4.5.0'; my $memRealFreeOID = '.1.3.6.1.4.1.2021.4.6.0'; my $memRealCachedOID = '.1.3.6.1.4.1.2021.4.15.0'; my $memRealBuffersOID = '.1.3.6.1.4.1.2021.4.14.0'; my ($session, $error) = Net::SNMP->session( -hostname => $np->opts->host, -community => $np->opts->community, ); if (!defined $session) < $np->nagios_exit (WARNING, $error) #printf "ERROR: %s.\n", $error; > my $memRealFree = $session->get_request(-varbindlist => [ $memRealFreeOID],); my $memRealTotal = $session->get_request(-varbindlist => [ $memRealTotalOID],); my $memRealCached = $session->get_request(-varbindlist => [ $memRealCachedOID],); my $memRealBuffers = $session->get_request(-varbindlist => [ $memRealBuffersOID],); $session->close(); my $buffers = $memRealBuffers->; my $cache = $memRealCached->; my $total= $memRealTotal->; my $free = $memRealFree->; my $memRealUsed = $total - $free; my $memRealUsedMB = round ($memRealUsed / 1024); my $totalMB = round($total / 1024); my $realTPercent = (($memRealUsed - $buffers - $cache)/ $total) * 100; my $realPercent = sprintf "%.2f", $realTPercent; 

Источник

Оцените статью
Adblock
detector