Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache reported as negative #17

Open
abchk1234 opened this issue Sep 14, 2017 · 0 comments
Open

Cache reported as negative #17

abchk1234 opened this issue Sep 14, 2017 · 0 comments

Comments

@abchk1234
Copy link

abchk1234 commented Sep 14, 2017

Hi!

For some time, I was facing issue that check_mem was reporting high memory usage, while free reported that memory usage was ok. On closer inspection, I found that the cache reported by check_mem was negative:

# /usr/local/nagios/libexec/check_mem -u -C -w 90 -c 95
WARNING - 92.9% (11695180 kB) used!|TOTAL=12582912KB;;;; USED=11695180KB;11324620;11953766;; FREE=887732KB;;;; CACHES=-2709560KB;;;;

The negative cache value is what causes the issue; if I choose to ignore cache dont get the warning:

# /usr/local/nagios/libexec/check_mem -u -w 90 -c 95
OK - 71.5% (8997588 kB) used.|TOTAL=12582912KB;;;; USED=8997588KB;11324620;11953766;; FREE=3585324KB;;;; CACHES=-2692876KB;;;;

Its a linux system, details are as follows:

# cat /proc/meminfo
MemTotal:       12582912 kB
MemFree:         3591364 kB
Cached:           518712 kB
Buffers:               0 kB
Active:          4081284 kB
Inactive:        1503948 kB
Active(anon):    3923484 kB
Inactive(anon):  1143036 kB
Active(file):     157800 kB
Inactive(file):   360912 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:               248 kB
Writeback:             0 kB
AnonPages:       5066520 kB
Shmem:           3292220 kB
Slab:             114076 kB
SReclaimable:      61008 kB
SUnreclaim:        53068 kB
# uname -sr
Linux 2.6.32-042stab120.16

=========================

Tried it on a different system with a more modern kernel, output is as follows:

# cat /proc/meminfo 
MemTotal:        8171680 kB
MemFree:          282784 kB
MemAvailable:    7199936 kB
Buffers:          640576 kB
Cached:          5530204 kB
SwapCached:          236 kB
Active:          4675496 kB
Inactive:        2069064 kB
Active(anon):     267576 kB
Inactive(anon):   443140 kB
Active(file):    4407920 kB
Inactive(file):  1625924 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:        524284 kB
SwapFree:         510304 kB
Dirty:              8688 kB
Writeback:             0 kB
AnonPages:        573612 kB
Mapped:           153592 kB
Shmem:            136924 kB
Slab:            1034884 kB
SReclaimable:     986028 kB
SUnreclaim:        48856 kB
KernelStack:        5856 kB
PageTables:        32552 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     4610124 kB
Committed_AS:    1730916 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
DirectMap4k:       14200 kB
DirectMap2M:     2082816 kB
DirectMap1G:     8388608 kB
# uname -sr
Linux 4.9.15-x86_64

Looks to be an issue with the Shmem usage in the code:
https://github.com/justintime/nagios-plugins/blob/master/check_mem/check_mem.pl#L159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant