Month: August 2013

Centos What files are open to that PID

Find out what files are open by that pid file.       1. Find the pid for you service ps aux | grep httpd apache   24179  0.0  0.0 251316 15528 ?        S    08:58   0:00 /usr/sbin/httpd Here this pid is 8582 now list all files open by that pid. 2. List files beloning to… Read more →

Mysql Commands to Remember

This is an reminder for mw some mysql commands that i use often and my mind not always bring with me.   Optimize table When i table that has many writes and delets get fregmant this will speed up the database. optimize table Sys   Creating users CREATE USER ‘dbuser’@’localhost’ IDENTIFIED BY ‘some_pass’; GRANT ALL PRIVILEGES ON *.* TO ‘dbuser’@’localhost’… Read more →

Kernel updated don´t update grub on Centos 6.4

So you have updated the kernel on you centos but you server is still running on the old kernel. Whenan kernel is updated yum updates the file /etc/grub.conf and that is an synlink to /boot/grub/grub.conf but if the link is broken then you will have two grub.conf. One /etc/grub.conf and one /boot/grub/grub.conf and then when you update en kernel the… Read more →

Remove old kernel in Centos

So you try to update you server and it says that you /boot pertision is full and cant update kernel. Will this is how you remove some old kernels so you can keep your system up to date.   1. First what kernel is running now (We dont want to remove that kernel) uname -a Linux install 2.6.32-279.19.1.el6.x86_64 #1 SMP… Read more →

Python ConfigParser using you own config files in python

Storing settings in config files and then let python read the configfiles and to good stuff .   Read the file #Reading config file config = ConfigParser.ConfigParser()‘setting.cfg’) print all items and values in an section for name, value in config.items(“monitor”): print ‘ %s = %s’ % (name, value) Print all items in configfile for section_name in parser.sections(): print ‘Section:’,… Read more →

How the HELL is oncall ? (the oncall reminder script)

When you have oncall often sometimes is easy to forget hows oncall and when you are not. So for the last time wonder how is oncall and ask some python for some help,   The script #!/usr/bin/env python # # Mattias Hemmingsson # # # Script for reminder friend when to bet # Uses and csv file and send… Read more →

restrict sms in nagios / icinga

Im using nagios as primary monitoring tool. And to get alerts we use an sms gateway. The problem is that sometimes when we work we bring down and server and we get so many sms from icinga that you trow away you phone. So for bringing the sms cost down and to have not so many sms to you phone… Read more →

NTP Server and client setup

Time is critical when having many server and using different clusters. So i made this guide to save all my notes when working with time. Setting local time I make an link to /etc/timezone ln -sf /usr/share/zoneinfo/Etc/GMT /etc/timezone To check if i use the correct time zone date Install ntpd   Ubuntu apt-get install ntp Centos yum install ntp  … Read more →

LVS cluster for Centos

An other cluster solution for Linux is LVS. I im testing to use LVS cluster for some cloud server. My cloudserver has one external ip and i want all traffic to come to that ip and after that be redirected to my web nodes. Witch LVS i will redirect all traffic to that ip and load balance it between my… Read more →

%d bloggers like this: