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

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

  • Home
  • Directory
  • Library
  • Support
  • About
Plugins4401Themes and Skins13Add-ons756Graphics 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
Nagios Core Tutorials Monitoring IPCop Routers with NRPE -IPCop
0.0 (0)
25.8K
RSS Feed
Newest Listings Updated Listings
Top Contributors
Yoann LAMY (7)Julien DESMAREST (6)Davide Lemma (4)deskwork_itunes142 (4)Chad Columbus (3)
See More
Newest Contributors
signalgrid (1)Sanna Glue (2)fisherrs (1)smolinux (1)juanfertor (1)
See More

Copyright © 2009-2026 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 9 years ago

No Favorites Found

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

Privacy PolicyTerms of UseTrademarks
Home Browse Submit Profile