Exim relay daily stats – bash

#!/bin/bash
ESEND=$(egrep "(=>|->)" /var/log/exim4/mainlog.1 -c)
YDATE=$(date -d "1 day ago" '+%Y-%m-%d')
echo
echo -== Report for $YDATE ==-
echo
echo Total emails send by SMTP relay on $HOSTNAME:
echo
egrep "(=>|->)" /var/log/exim4/mainlog.1 | gawk '{ print $5 }'| sort | uniq -c | sort -nr
echo
echo Total: $ESEND
echo

output:

/root/exim-stats.sh

-== Report for 2016-02-28 ==-

Total emails send by SMTP relay on some.hostname:

20 someone@example.com
10 someone_else@email.com
1 sales@domain.com

Total: 31


Enabling SNMP on an ASUS RT-N66U

via telnet execute:

ipkg update
ipkg install net-snmp
app_set_enabled.sh net-snmp yes

full original post: http://daniel.abbatt.net/2014/11/enabling-snmp-on-asus-rt-n66u.html


Raspberry pi monitoring with Munin

Original post:  http://www.aymerick.com/2013/12/25/munin_client_on_raspberrypi.html

Add this line:

[pisense_*]
user root

to

/etc/munin/plugin-conf.d/munin-node
cd /usr/share/munin/plugins

sudo wget -O pisense_ https://raw.github.com/perception101/pisense/master/pisense_
sudo chmod a+x pisense_
sudo ln -s /usr/share/munin/plugins/pisense_ /etc/munin/plugins/pisense_temp
sudo ln -s /usr/share/munin/plugins/pisense_ /etc/munin/plugins/pisense_clock

Example output:
pisense_temp-day


Denyhosts – bash script

#!/bin/bash
# Author(s): Chris Trombley </code>

LIST=""
LIST=$(cat /var/log/auth.log | grep "authentication failure" | awk '{print$14}' | grep -v tty=ssh |sed -e 's/rhost=//g' -e 's/ /_/g' | uniq)
excludeList=( "10.10.6.1" "10.10.9.207" "static-xxx-xxx-xxx-xxx.isp.domain.net" )

function chkExcludeList()
{
for j in "${excludeList[@]}"; do
if [[ "$1" == $j ]]; then
return 10
fi
done
return 11
}

for i in $LIST; do
chkExcludeList "$i"
if [ $? != "10" ]; then
if [ "$(grep $i /etc/hosts.deny)" = "" ]; then
echo "ALL: $i : DENY" >> /etc/hosts.deny
fi
fi
done


How to delete files older than …

find PATH TO FILES GOES HERE* -mtime +5 -exec COMMAND GOES HERE {} \;


How to update munin-node plugins.

After installation of new service on server is nice to update Munin plug-ins.

munin-node-configure
/usr/sbin/munin-node-configure --suggest
/usr/sbin/munin-node-configure --shell | sh
/etc/init.d/munin-node restart

Plug-in list is up-to-date.


OpenElec Raspberry PI – tweaks

Increase video buffering:

Create a file advancedsettings.xml here /Storage/.xbmc/userdata

<advancedsettings>
  <network>
    <cachemembuffersize>30242880</cachemembuffersize>
  </network>
  <fanartheight>560</fanartheight>
  <thumbsize>256</thumbsize>
  <gui>
    <algorithmdirtyregions>3</algorithmdirtyregions>
    <nofliptimeout>0</nofliptimeout>
  </gui>
  <bginfoloadermaxthreads>2</bginfoloadermaxthreads>
</advancedsettings>

more settings here: http://mrpfister.com/journal/setting-up-openelec-on-the-raspberry-pi/#comment-31801

Overclocking:
(Be careful those setting will void your warranty)

/system/config.txt

arm_freq=850
core_freq=250
sdram_freq=400
force_turbo=1
initial_turbo=30
disable_overscan=1
hdmi_force_hotplug=1


Follow

Get every new post delivered to your Inbox.