Archive for the ‘Freebsd’ Category

SnamTrap and Zabbix

Centos 6

  • edit /etc/snmp/snmptrapd.conf

disableAuthorization yes

traphandle default /usr/sbin/snmptt

snmpTrapdAddr udp:

doNotLogTraps yes

  • /etc/snmp/snmptt.ini

snmptt_conf_files = <<END

  • Add MIB in /etc/snmp/snmptt.conf

EVENT linkDown . “Status Events” Normal
FORMAT ZBXTRAP $aA Link down on interface $1. Admin state: $2. Operational state: $4
EXEC /usr/lib/zabbix/externalscripts/ $aA $1 $4

EVENT linkUp . “Status Events” Normal
FORMAT ZBXTRAP $aA Link up on interface $1. Admin state: $2. Operational state: $4
EXEC /usr/lib/zabbix/externalscripts/ $aA $1 $4


FreeBSD run problem after upgrade

FreeBSD upgrade from 7.4->8.1 or 8.1->8.2
Freebds freeze on boot.

Boot on single user mode and ADD to /boot/device.hints


FFserver, which has been removed :(

APIchanges: FFserver, which has been removed from FFmpeg 🙁

multimedia/ffmpeg: update to 4.0

– FFSERVER support was removed upstream
– libressl now uses libtls backend instead of patching openssl one

fail2ban openfire

#vim filter.d/openfire.conf

before = common.conf


failregex = ^ WARN.*org.jivesoftware.admin.LoginLimitManager – Failed admin console login attempt by admin from $

ignoreregex =

datepattern = ^%%Y.%%m.%%d %%H:%%M:%%S

vim jail.conf

enabled = true
filter = openfire
action = iptables-allports[]
logpath = /opt/openfire/logs/all.log

Upgrade php5-5.4 to php56

#portmaster -o lang/php56 php5-5.4.35
#portmaster -y -D -o devel/oniguruma5 oniguruma4

#pkg info | grep php | grep 5.4 | awk ‘{print $1}’ |awk -F ‘-5.4’ ‘{print “whereis “$1}’ |sh |awk -F ‘: /usr/ports/’ ‘{print “portmaster -y -D -o “$2” “$1}’ | sed -e “s@/php5-@/php56-@” -e ‘s@$@-5.4.35@’ | sh


Шукаємо старі директорії і архівуємо.

find ./ -name . -prune -o -type d -mtime +90  -exec tar czvpf {}.tgz ./{} \;  -exec rm -rf {}  \;

mass find and replace

find / -name php.ini | xargs sed -i 's/expose_php = On/expose_php = Off/g'
find / -name php.ini | xargs perl -pi -e 's/expose_php = On/expose_php = Off/i'

shell compare string

Потрібно було знайти присутність/входження строки в іншій, в шелл скрипті. …

bb=$(echo ${aa} | grep -i "String")

if [ ${#bb} -gt 0 ];
echo "Exists"
echo "Not exists"

Zabbix не бачить процесси

Zabbix-agent не бичить процесси, але вони запущені.

/usr/local/bin/zabbix_get -s -p 10050 -k “proc.num[sshd].last(0)”

# ps -ax| grep sshd
637 ?? Is 0:13.32 /usr/sbin/sshd

Проблема в цьому….
sysctl -a | grep security.bsd.see_other

Trixbox, not working export statistics to cvs…

export trixbox statistics to cvs.

Ищем в файле cdr.php
(строка 828)

foreach($this->getrowsfromdbihatelongfunctionnames($this->input->post(‘startdate’), $this->input->post(‘enddate’), $this->input->post(‘source’), $this->input->post(‘srctype’), $this->input->post(‘destination’), $this->input->post(‘desttype’), $this->input->post(‘channel’), $this->input->post(‘duration’), $this->input->post(‘durationend’), $this->input->post(‘durstarttype’), $this->input->post(‘durendtype’), 0, 0, $this->input->post(‘datasort’), $this->input->post(‘datadir’)) as $row) {

Меняем 0 на 999999

foreach($this->getrowsfromdbihatelongfunctionnames($this->input->post(‘startdate’), $this->input->post(‘enddate’), $this->input->post(‘source’), $this->input->post(‘srctype’), $this->input->post(‘destination’), $this->input->post(‘desttype’), $this->input->post(‘channel’), $this->input->post(‘duration’), $this->input->post(‘durationend’), $this->input->post(‘durstarttype’), $this->input->post(‘durendtype’), 0, 999999, $this->input->post(‘datasort’), $this->input->post(‘datadir’)) as $row) {