SteScho / manubulon-snmp

Set of Icinga/Nagios plugins to check hosts and hardware with the SNMP protocol.
GNU General Public License v2.0
73 stars 71 forks source link

check_snmp_mem.pl plugin giving wrong results #65

Open vivuu1989 opened 5 years ago

vivuu1989 commented 5 years ago

We are using GItHub Enterprise as our source code management system and its installed as an appliance in Vmware Esxi. For monitoring purpose we are using Nagios over SNMP for getting the performance metrics.

Nagios over SNMP ( GHE provides the resource metric by default over SNMP) we enabled SNMPV3 from GHE appliance side

But its noticed that GHE will create a much cached memory which will result in unwanted alerts.

There is 4.6 G of cached memory, how to configure Nagios to alert the threshold for GHE (used-cached) memory instead of just used memory.

Current memory usage on the system is:

free -h

total used free shared buffers cached Mem: 15G 14G 909M 1.5M 375M 4.6G -/+ buffers/cache: 9.8G 5.9G Swap: 0B 0B 0B

But in Nagios side is there any way to exclude these linux consumed memory and monitor only the GHE consumed memory alone?

Current Behavior

check_snmp_mem.pl -H XXXXX --login=XXXXX --passwd=XXXXX --privpass=XXXXX --protocols=sha,aes -m -w 90,90 -c 95,95 -v

Alarm at 15
SNMPv3 AuthPriv login : XXXXX, sha, aes
Ram : 526920 / 16437176 : 97
Swap : 0 / 0 : 0
Ram : 97%, Swap : 0% : > 95, 95 ; CRITICAL

its again showing as 97 % , which is not correct( its again including the cache memory in the used memory)

free
total used free shared buff/cache available
Mem: 16437176 11679836 771992 5100 3985348 4413996
Swap: 0 0 0

Note:- I think, in your example also, its showing wrong details.

linux will treat cache memory as used memory and in order to get the application consumed memory:-

We have to get the value in way like

(used memory - available memory) ____ * 100

(Total memory)

But in your example also its not showing correct values.. Please read this.. https://www.linuxatemyram.com/

dnsmichi commented 5 years ago

Hi,

first off, fill in the issue template and show the exact results from the plugin call. Second, I don't use Nagios, if that's a specific requirement.

If you need help on specific SNMP monitoring tasks, either consult GitHub Enterprise support or pick the right community for your tool (Nagios, Icinga, etc.).

That being said, I don't consider this being a bug.

Cheers, Michael

vivuu1989 commented 5 years ago

@dns already updated the request with requested information. Here the problem is the check_snmp_mem.pl is not showing exact result while looking for the total consumed memory. its showing wrong result

for more details.

The below is the memory consumption information got by "free -h " command

              total        used        free      shared  buff/cache   available
Mem:   16051       11135        1037           5        3879        4581

checked both the ways:

1) with -m

/check_snmp_mem.pl -H xxxxx --login=xxxxxx --passwd=xxxxx --privpass=xxxxx --protocols=sha,aes -m -w 90,90 -c 95,95 -f

Ram : 93%, Swap : 0% : > 90, 90 ; WARNING | ram_used=15360688;14793458;15615317;0;16437176 swap_used=0;0;0;0;0

I think, here its calculating as

(used+ cache) __ * 100 Total

2) without -m

/check_snmp_mem.pl -H xxxxx --login=xxxxx --passwd=xxxxx --privpass=xxxxx --protocols=sha,aes -w 90,90 -c 95,95 -f

Ram : 75%, Swap : 0% : ; OK | ram_used=12260732;14793458;15615317;0;16437176 swap_used=0;0;0;0;0

Here its calculation is (used) ____ * 100 Total

But actually we need :

[ (used)-(cache)] ___ * 100 Total

vivuu1989 commented 5 years ago

any suggestion here ?

dnsmichi commented 5 years ago

You can look into the code and analyse its behaviour. I'm not actively maintaining these plugins anymore, but the Perl code should be fairly readable for adjustments and tests.

gplazagabriel commented 2 years ago

Hello @vivuu1989 and @dnsmichi . I'm new member here but I recently had the same problem and I solved it changing the check-snmp_mem.pl script. It works with just one output (-m flag is disable right now)

This is the code (you must to change the extension from txt to pl):

check_snmp_mem.txt

I hope it solv your problem. Regards.-

Gabriel Plaza