Nagios Exchange Nagios Exchange
  • Home
  • Directory
  • Library
  • Support
  • About
  • Submit Feedback

Advanced Search

Build precise queries to find exactly what you need

Search Logic

Select compatible versions

Press ESC to close

Sign In Sign Up

Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More

  • Home
  • Directory
  • Library
  • Support
  • About
  • Submit Feedback
Plugins4407Themes and Skins13Add-ons762Graphics and Logos36View All Categories
LinuxSecuritySNMPFile SystemCloud
New Listings Recently Updated Listings Most Favored Listings Most Popular Listings Most Rated Listings Most Reviewed Listings
Random Project
Other Tutorials And HOWTOs Track Cisco BGP Peers Using Nagios
0.0 (0)
72.6K
RSS Feed
Newest Listings Updated Listings
Top Contributors
deskwork_itunes142 (4)Chad Columbus (3)Marcin Bednarski (3)Davide Lemma (3)Gary T. GIesen (2)
See More
Newest Contributors
pawal (1)matthewducey (1)Linuxfabrik (1)signalgrid (1)Sanna Glue (2)
See More

Copyright © 2009-2026 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks
Home > Brandon Martin
BM

Brandon Martin

@martinb

User Stats

Member Since: March 25, 2015

Favorites0

Views

Projects0

No Projects Found
Check_Memory.py

Simple and effective

I modified this slightly to report on free space and not used space. I also added a 3rd argument for Swap. import commands import sys def checkmem(): mem = "Mem" memprint = "Memory" if(len(sys.argv) > 3): if(sys.argv[3] == "s"): mem = "Swap" memprint = "Swap" a = commands.getstatusoutput("free -m | grep " + mem) b = a[1] c = b.split() t = c[1] u = c[2] f = c[3] if (len(sys.argv) > 2): if( int(sys.argv[2]) >= int(f) ): print "CRITICAL -- Total " + memprint, t+"MB", "Current "+memprint+" Usage is", u+"MB", "Free " + memprint, f+"MB" sys.exit(2) elif( int(sys.argv[1]) >= int(f) ): print "WARNING -- Total " + memprint, t+"MB", "Current "+memprint+" Usage is", u+"MB", "Free " + memprint, f+"MB" sys.exit(1) else: print "OK -- Total "+memprint, t+"MB", "Current "+memprint+" Usage is", u+"MB", "Free " + memprint, f+"MB" sys.exit(0) def checkargv(): if (len(sys.argv) == 1 ): print "" print "Enter Warning Limit & Critical Limit" print "Use --help For Help" print "" else: check() def check(): if ((sys.argv[1]) == "--help"): print "" print "This Script checks Your Unix Memory Utilization & Returns Output" print "Use Command Line Arguments in MB [Megabytes]" print "Use script as ./memory.py 'Warning Limit' 'Critical Limit'" print "Use script as ./memory.py 600 500 (s)" print "Where Argument 600 is Memory Warning Limit in MB [Megabytes] & Argument 500 is Memory Critical Limit in MB [Megabytes]" print "And optional s argument is Swap reporting" else: checkmem() def main(): checkargv() if __name__ == '__main__': main()

Reviewed 11 years ago

No Favorites Found

Copyright © 2009-2026 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks
Home Browse Submit Profile