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

No performence data in external script #42

Open
ghost opened this issue Sep 21, 2018 · 1 comment
Open

No performence data in external script #42

ghost opened this issue Sep 21, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 21, 2018

My check look like:

@searches = (
  {
        tag => 'ConReset',
        type => 'virtual',
        logfile => '/var/log/nginx/error.log',
        #criticalpatterns => '.*(?:failed|timed out) \(1\d\d: Connection (?:reset by peer|timed out)\) while reading .*',
        criticalpatterns => '.*directory index of .*',
#       warningpatterns => ['.*error.*, '.*fatal.*'],
#       warningthreshold => '10',
        rotation => 'debian',
        script => 'send_mail',
        scriptparams => '$MY_MAIL$ $CL_SERVICEPERFDATA$',
        options => 'perfdatai,script'
  }
);

cat scripts/send_mail

#!/bin/bash
MAIL=$1
PERFDATA=$2
HOST=$(hostname -f)
var1=$(printf "%s: %d:%d Uhr status is %s\n" \
	$HOST \
	$CHECK_LOGFILES_DATE_HH \
	$CHECK_LOGFILES_DATE_MI \
	$CHECK_LOGFILES_SERVICESTATE)
var2=$(printf "I found something:\n")
var3=$(printf "%s\n\n" "$CHECK_LOGFILES_SERVICEOUTPUT")

echo "$PERFDATA" >> /tmp/foo

#echo -e $var1 "\n\n"$var2"\n"$var3 | mail -s "check_logfile $HOST" $MAIL

Debug Output:

tail -f /tmp/foo
$
$ <- when try to get $CL_SERVICEPERFDATA$
$
$
ConReset
ConReset
ConReset
CRITICAL
CRITICAL
CRITICAL
$
$
$

I cant get the Performencedata here.
I want to loop to send all error in one mail.

Best Regards

@lausser
Copy link
Owner

lausser commented Sep 21, 2018 via email

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

No branches or pull requests

1 participant