Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let check_drupal_log read from stdin #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

waoki
Copy link

@waoki waoki commented Dec 29, 2016

I found myself in an awkward situation where I couldn't run NRPE or use check_by_ssh on the system hosting a Drupal instance I needed to monitor, hence this patch which allows check_drupal_log to read from stdin.

The expected use of this feature is that on the web server, a cron job will run check_drupal_log -l /var/www/foo/cdl.txt to dump plugin output to a text file. On the monitoring server, Nagios (or Icinga or...) picks up the content of the file and parses it by running curl https://my.site.example.com/foo/cdl.txt | check_drupal_log -f -

@cytopia
Copy link
Owner

cytopia commented Dec 30, 2016

@waoki this is a nice feature.
Is - a standard way to make sure input is coming from stdin?
Also what would happen (in the rare case) if there is a file called -?

Could you also please add this information to print_usage and print_help.

@cytopia cytopia self-assigned this Dec 31, 2016
@waoki
Copy link
Author

waoki commented Feb 2, 2017

'-' is probably the second-most common way to read from stdin (the most common being to assume stdin if no input file is specified). In this case, it makes it impossible to have check_drupal_log read from a file called '-'; some programs use fancy syntax to let you read a file called '-', but my experience is that most which support this syntax just can't read from such a file.

I've updated print_usage and print_help to mention this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants