check for logs in a log file
Project description
Logs monitoring plugin
Checks an url raise an alert if some problem is found. Uses curl with all its power, so you can extend your check with all curl options.
Install
Linux:
sudo pip3 install logs_plugin --upgrade
Also is possible to use:
sudo python3 -m pip install logs_plugin --upgrade
On windows with python3.5:
pip install logs_plugin --upgrade
For proxies add:
--proxy='http://user:passw@server:port'
Usage
Use the command line:
> logs_plugin --help usage: logs_plugin [-h] [-fl [Fileocation]] [-wd [Word to Check]] [-e [EXTRA_ARGS]] optional arguments: -h, --help show this help message and exit -fl [Fileocation], --filelocation [Fileocation] file to check -wd [Word_to_check], --wordtocheck [Word to Check] word to check -e [EXTRA_ARGS], --extra_args [EXTRA_ARGS] extra args to add to curl, see curl manpage
Example usage
Example basic usage:
> logs_plugin --fl '{filelocation}' --wd '{word_to_check}'
Nagios config
Example command:
define command{ command_name logs_plugin command_line /usr/local/bin/logs_plugin --fl '$ARG1$' --wd $ARG2$ $ARG3$ }
With proxy defined
# use logs_plugin with proxy
- define command {
command_name logs_plugin command_line https_proxy=http://user:pass@PROXYIP:PORT /usr/local/bin/logs_plugin –fl ‘$ARG1$’ –wd $ARG2$ $ARG5$}
Example service:
define service { host_name SERVERX service_description service_name check_command logs_plugin!c:\logs\log.txt!wordtocheck use generic-service notes some useful notes }
With proxy defined:
- define service {
host_name SERVERX service_description service_name check_command logs_plugin!c:logslog.txt!wordtocheck use generic-service notes some useful notes}
You can use ansible role that already has the installation and command: https://github.com/CoffeeITWorks/ansible_nagios4_server_plugins
TODO
Use hash passwords
Add Unit tests?
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file logs_check_plugin-1.1.0.tar.gz
.
File metadata
- Download URL: logs_check_plugin-1.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99bff49bd20ce24a1562595c7e441ac4c0477c03db53342851808ac11f82b69b |
|
MD5 | f41eca87e1dd0bd23ae80cb81533d308 |
|
BLAKE2b-256 | c1583a27a978ba3365c3dd480135d03f2aa1a16a171a3c25caee7a7093dbf91b |