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

Advanced Search

Build precise queries to find exactly what you need

Search Logic

Select compatible versions

Press ESC to close

Sign In Sign Up
  • Home
  • Directory
  • Library
  • Support
  • About
Plugins4391Themes and Skins11Add-ons741Documentation283Graphics 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 Nagios and iPhone Push Notifications
0.0 (0)
87.4K
RSS Feed
Newest Listings Updated Listings
Top Contributors
Julien DESMAREST (6)Yoann LAMY (6)Davide Lemma (4)deskwork_itunes142 (4)Claudio Kuenzler (2)
See More
Newest Contributors
sowoii (1)Nitatemic (1)cjdepaul (1)ixs (1)messefreeze (2)
See More

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

Privacy PolicyTerms of UseTrademarks
Home > Preston Cole
PC

Preston Cole

@prestonc

User Stats

Member Since: July 2, 2017

Favorites0

Views

Projects0

No Projects Found
check_in_logfiles.py

Slight mod

Hi, Hope you don't mind. I modified the code a bit. Seemed that when everything was OK, Nagios failed display data. #!/usr/bin/env python # Check_log_files.py # Author: Imran Ahmed # Description: Nagios plugin that searches log files for a patterns loaded from a pattern file. # Usage check_in_logfiles.py : # First argument PATTERNFILE is a text file containing lines of the form: # SEVERITY:PATTERN # where *SEVERITY* is one of `IGNORE`, `WARNING`, `CRITICAL` and *PATTERN* is a # regular expression. # Second (and later) argument LOGFILE is the path to one (or more) log files. # if a line is found that matches a *PATTERN* with *SEVERITY* `CRITICAL`, # exit with CRITICAL status # if a line is found that matches a *PATTERN* with *SEVERITY* `WARNING`, # exit with WARNING status import sys, re def popLists(file): with open(file, 'r') as myPatFile: lines = myPatFile.readlines() critical = [] warning = [] ok = [] for line in lines: line = line.strip() words = line.split(":") if (words[0] =='CRITICAL'): critical.append(words[1]) elif (words[0] =='WARNING'): warning.append(words[1]) elif (words[0] =='OK'): ok.append(words[1]) else: print "Everything is cool!" return critical, warning, ok def main(): argc = len(sys.argv) if argc main()

Reviewed 8 years ago

No Favorites Found

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

Privacy PolicyTerms of UseTrademarks
Home Browse Submit Profile