check_logfiles icon indicating copy to clipboard operation
check_logfiles copied to clipboard

No performence data in external script

Open ghost opened this issue 7 years ago • 1 comments

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

ghost avatar Sep 21 '18 13:09 ghost

perfdatai? Gesendet von meinem Windows 10-Gerät. Von: mailto:[email protected] basti12203 Gesendet: Freitag, 21. September 2018 15:15 An: mailto:[email protected] lausser/check_logfiles Cc: mailto:[email protected] Subscribed Betreff: [lausser/check_logfiles] No performence data in external script (#42)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

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/lausser/check_logfiles/issues/42

lausser avatar Sep 21 '18 16:09 lausser