<commit_before>#!/bin/bash
# Script to fetch postfix statuses for tribily monitoring systems 
# Initial Author: Zabbix Community
# Improvements, Features, Testing: <EMAIL>
# License: GPLv2

# Set Variables
MAILLOG=<%= maillog %>
MYLOG=<%= zabbixagentlog %>/zabbix-postfix.log
DAT1=~/zabbix-postfix-offset.dat
DAT2=$(mktemp)
PFLOGSUMM=<%= pflogsumm %>
ZABBIX_CONF=<%= zabbixconf %>

function zsend { 
  <%= zabbixsender %> -c $ZABBIX_CONF -k $1 -o $2
}

<%= logtail %> -f$MAILLOG -o$DAT1 | $PFLOGSUMM -h 0 -u 0 --no_no_msg_size <%= pflogsumm_params %> > $DAT2 

zsend pfreceived `grep -m 1 received $DAT2|cut -f1 -d"r"`
zsend pfdelivered `grep -m 1 delivered $DAT2|cut -f1 -d"d"`
zsend pfforwarded `grep -m 1 forwarded $DAT2|cut -f1 -d"f"`
zsend pfdeferred `grep -m 1 deferred $DAT2|cut -f1 -d"d"`
zsend pfbounced `grep -m 1 bounced $DAT2|cut -f1 -d"b"`
zsend pfrejected `grep -m 1 rejected $DAT2|cut -f1 -d"r"`
zsend pfrejectwarnings `grep -m 1 "reject warnings" $DAT2|cut -f1 -d"r"`
zsend pfheld `grep -m 1 held $DAT2|cut -f1 -d"h"`
zsend pfdiscarded `grep -m 1 discarded $DAT2|cut -f1 -d"d"`
zsend pfbytesreceived `grep -m 1 "bytes received" $DAT2|cut -f1 -d"b"|cut -f1 -d"k"`
zsend pfbytesdelivered `grep -m 1 "bytes delivered" $DAT2|cut -f1 -d"b"|cut -f1 -d"k"`

rm $DAT2<commit_msg>Try different syntax for function define<commit_after>#!/bin/bash
# Script to fetch postfix statuses for tribily monitoring systems 
# Initial Author: Zabbix Community
# Improvements, Features, Testing: <EMAIL>
# License: GPLv2

# Set Variables
MAILLOG=<%= maillog %>
MYLOG=<%= zabbixagentlog %>/zabbix-postfix.log
DAT1=~/zabbix-postfix-offset.dat
DAT2=$(mktemp)
PFLOGSUMM=<%= pflogsumm %>
ZABBIX_CONF=<%= zabbixconf %>

zsend() { 
  <%= zabbixsender %> -c $ZABBIX_CONF -k $1 -o $2
}

<%= logtail %> -f$MAILLOG -o$DAT1 | $PFLOGSUMM -h 0 -u 0 --no_no_msg_size <%= pflogsumm_params %> > $DAT2 

zsend pfreceived `grep -m 1 received $DAT2|cut -f1 -d"r"`
zsend pfdelivered `grep -m 1 delivered $DAT2|cut -f1 -d"d"`
zsend pfforwarded `grep -m 1 forwarded $DAT2|cut -f1 -d"f"`
zsend pfdeferred `grep -m 1 deferred $DAT2|cut -f1 -d"d"`
zsend pfbounced `grep -m 1 bounced $DAT2|cut -f1 -d"b"`
zsend pfrejected `grep -m 1 rejected $DAT2|cut -f1 -d"r"`
zsend pfrejectwarnings `grep -m 1 "reject warnings" $DAT2|cut -f1 -d"r"`
zsend pfheld `grep -m 1 held $DAT2|cut -f1 -d"h"`
zsend pfdiscarded `grep -m 1 discarded $DAT2|cut -f1 -d"d"`
zsend pfbytesreceived `grep -m 1 "bytes received" $DAT2|cut -f1 -d"b"|cut -f1 -d"k"`
zsend pfbytesdelivered `grep -m 1 "bytes delivered" $DAT2|cut -f1 -d"b"|cut -f1 -d"k"`

rm $DAT2
{'fraction_non_alphanumeric': 0.16037008481110254, 'fraction_numerical': 0.03469545104086353, 'mean_word_length': 4.285132382892057, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7544275', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1129, 'n_words': 325}