Η μνήμη της κύριας διεργασίας (gwd) παρακολουθείται από το vc_process_monitor, γεγονός που εξασφαλίζει ότι δεν θα καταναλώνει ποτέ περισσότερο από το 75% της διαθέσιμης μνήμης. Ως αποτέλεσμα, η παρακολούθηση για τη συνολική μνήμη του συστήματος γίνεται με όριο προειδοποίησης το 80% και κρίσιμο όριο το 90%.
Μπορείτε να παρακολουθείτε μια πύλη με όρια που παρέχουν προειδοποιητικές ή κρίσιμες καταστάσεις που υποδεικνύουν πιθανά ζητήματα πριν από την επίδραση των υπηρεσιών. Ο παρακάτω πίνακας παραθέτει τις οριακές τιμές και τις προτεινόμενες ενέργειες.
Κατάσταση ορίου | Οριακή τιμή | Συνιστώμενη διορθωτική ενέργεια |
---|---|---|
Προειδοποίηση | 80% | Εάν η μνήμη υπερβεί το όριο προειδοποίησης:
Συνεχίστε να παρακολουθείτε ενεργά και ελέγξτε για αυξανόμενη χρήση. |
Κρίσιμο | 90% | Εάν η μνήμη υπερβεί το κρίσιμο όριο:
Εάν το ζήτημα παρατηρηθεί ξανά:
Σημείωση: Πριν από την επανεξισορρόπηση της πύλης, επιβεβαιώστε ότι οι μετρήσεις χωρητικότητας βρίσκονται εντός του συνιστώμενου ορίου. Για περισσότερες πληροφορίες σχετικά με τις μετρήσεις χωρητικότητας, δείτε
Χωρητικότητα στοιχείων πύλης.
|
Ακολουθεί ένα παράδειγμα δέσμης ενεργειών Python για την παρακολούθηση της χρήσης της μνήμης:
Σημείωση: Μπορείτε επίσης να χρησιμοποιήσετε το Telegraf για να παρακολουθείτε τη χρήση της μνήμης. Για περισσότερες πληροφορίες, δείτε
Παρακολούθηση πυλών με χρήση του Telegraf.
#!/usr/bin/env python from optparse import OptionParser import sys # Parse commandline options: parser = OptionParser(usage="%prog -w <warning threshold>% -c <critical threshold>% [ -h ]") parser.add_option("-w", "--warning", action="store", type="string", dest="warn_threshold", help="Warning threshold in absolute(MB) or percentage") parser.add_option("-c", "--critical", action="store", type="string", dest="crit_threshold", help="Critical threshold in ansolute(MB) or percentage") (options, args) = parser.parse_args() def read_meminfo(): meminfo = {} for line in open('/proc/meminfo'): if not line: continue (name, value) = line.split()[0:2] meminfo[name.strip().rstrip(':')] = int(value) return meminfo if __name__ == '__main__': if not options.crit_threshold: print "UNKNOWN: Missing critical threshold value." sys.exit(3) if not options.warn_threshold: print "UNKNOWN: Missing warning threshold value." sys.exit(3) is_warn_pct = options.warn_threshold.endswith('%') if is_warn_pct: warn_threshold = int(options.warn_threshold[0:-1]) else: warn_threshold = int(options.warn_threshold) is_crit_pct = options.crit_threshold.endswith('%') if is_crit_pct: crit_threshold = int(options.crit_threshold[0:-1]) else: crit_threshold = int(options.crit_threshold) if crit_threshold >= warn_threshold: print "UNKNOWN: Critical percentage can't be equal to or bigger than warning percentage." sys.exit(3) meminfo = read_meminfo() memTotal = meminfo["MemTotal"] memFree = meminfo["MemFree"] + meminfo["Buffers"] + meminfo["Cached"] memFreePct = 100.0*memFree/memTotal if (is_crit_pct and memFreePct <= crit_threshold) or (not is_crit_pct and memFree/1024<=crit_threshold): print "CRITICAL: Free memory is at %2.0f %% ( %d MB free our of %d MB total)" % (memFreePct, memFree/1024, memTotal/1024) sys.exit(2) if (is_warn_pct and memFreePct <= warn_threshold) or (not is_warn_pct and memFree/1024<=warn_threshold): print "WARNING: Free memory is at %2.0f %% ( %d MB free our of %d MB total)" % (memFreePct, memFree/1024, memTotal/1024) sys.exit(1) else: print "OK: Free memory is at %2.0f %% ( %d MB free our of %d MB total)" % (memFreePct, memFree/1024, memTotal/1024) sys.exit(0)