check_drupal icon indicating copy to clipboard operation
check_drupal copied to clipboard

Let check_drupal_log read from stdin

Open waoki opened this issue 9 years ago • 2 comments

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 -

waoki avatar Dec 29 '16 22:12 waoki

@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 avatar Dec 30 '16 12:12 cytopia

'-' 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.

waoki avatar Feb 02 '17 23:02 waoki