Monthly Archives: December 2014

Enable kdump

rpm -qa | grep `uname -r`
yum –enablerepo=debug install kexec-tools crash kernel-debug kernel-debuginfo-`uname -r`

vi /boot/grub/grub.conf
you should add new kernel parameter like: crashkernel=128M

chkconfig kdump on
service kdump start

Check if kdump is active: cat /sys/kernel/kexec_crash_loaded

Test kernel panic:

echo 1 > /proc/sys/kernel/sysrq
echo c > /proc/sysrq-trigger

Check log in: /var/crash

crash /usr/lib/debug/lib/modules/`uname -r`/vmlinux /var/crash/127.0.0.1-2014-12-14-16\:40\:21/vmcore

phpci

PHPCI is a free and open source continuous integration tool specifically designed for PHP. Built with simplicity in mind and featuring integrations with all of your favourite testing tools, we’ve created the very best platform for testing your PHP projects.

ansible if then task


tasks:
- shell: if [[ -f "/etc/passwd" ]]; then /bin/true; else /bin/false; fi
register: result
ignore_errors: True

- command: /bin/something
when: result|failed

- command: /bin/something_else
when: result|success

- command: /bin/still/something_else
when: result|skipped

Zabbix monitor DISK I/O

Zabbix disk i/o template:
zbx_linux_disk_io_template.xml.tar

Auto discovery script for zabbix agents written in perl:

#!/usr/bin/perl
use strict;
use warnings;

# Options
my $_proc = “/proc/diskstats”;

# Validate options
if ( ! -e $_proc)
{
die “File $_proc not found!”;
}

# Keep count
my $_first = 1;

# Present the data in JSON format
print “{\n”;
print “\t\”data\”:[\n\n”;

# Fetch the data and put it in an array
my @_data = `cat $_proc | awk ‘{ print \$3 }’`;
chomp @_data;

# Read the array and print the wanted data
foreach my $_disk (@_data)
{
# Print the data in JSON
print “\t,\n” if not $_first;
$_first = 0;

print “\t{\n”;
print “\t\t\”{#DISK}\”:\”$_disk\”\n”;
print “\n\t}\n”;
}

print “\n\t]\n”;
print “}\n”;

Zabbix userparameter_linux_disks.conf:

# See https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats
#
# reads completed successfully
UserParameter=custom.vfs.dev.read.ops[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$4}’
# sectors read
UserParameter=custom.vfs.dev.read.sectors[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$6}’
# time spent reading (ms)
UserParameter=custom.vfs.dev.read.ms[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$7}’
# writes completed
UserParameter=custom.vfs.dev.write.ops[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$8}’
# sectors written
UserParameter=custom.vfs.dev.write.sectors[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$10}’
# time spent writing (ms)
UserParameter=custom.vfs.dev.write.ms[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$11}’
# I/Os currently in progress
UserParameter=custom.vfs.dev.io.active[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$12}’
# time spent doing I/Os (ms)
UserParameter=custom.vfs.dev.io.ms[*],cat /proc/diskstats | egrep $1 | head -1 | awk ‘{print $$13}’

Full article there:

http://www.denniskanbier.nl/blog/monitoring/monitoring-disk-io-using-zabbix/

Xming X Server

Xming is the leading X Window System Server for Microsoft Windows 8/7/Vista/XP (+ server 2012/2008/2003). It is fully featured, small and fast, simple to install and because it is standalone native Microsoft Windows, easily made portable.

XDMCP on Centos OS

yum install tigervnc-server xorg-x11-fonts-Type1 xinetd
vi /etc/gdm/custom.conf
[security]
AllowRemoteRoot=true
DisallowTCP=false

[xdmcp]
Enable=true
MaxSessions=30

vi /etc/xinetd.d/vncserver
service vncserver
{
disable = no
socket_type = stream
protocol = tcp
group = tty
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = -inetd -query localhost -geometry 1024×768 -depth 16 -once -fp /usr/share/X11/fonts/misc -securitytypes=none
}

vi /etc/services
vncserver 5900/tcp # VNC and GDM

systemctl restart xinetd.service

firewall-cmd –permanent –zone=public –add-port=5900/tcp
firewall-cmd –reload

Connect using some VNC client:
your_server_IP:5900