Last active
December 16, 2015 06:19
-
-
Save Aricg/5390537 to your computer and use it in GitHub Desktop.
tails a log and if certain stings are found it prints all but the first four parts of the line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| from sh import tail | |
| import string | |
| for line in tail("-fn0", "/tmp/alert", _iter=True): | |
| if ("PASSIVE" and "OK") in line: | |
| nagios_alerts = line.split(" ") | |
| print repr(nagios_alerts[4:]) | |
| print(len(nagios_alerts[4:])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment