Category: sysadmin
-
Get network stats for RRD graphing
This snippet displays Active, Passive and Established connections reported by “netstat –statistics” for saving into RRD or other monitoring tools.
-
Apache versus lighttpd
Both run on the same server: Apache/2.0.59 (port 80) & lighttpd 1.4.19 (port 8080). 2 tests: dynamic & static files. To make things a little realistic, it’s from a EU client to a US server. Serving a dynamic file eu$ ab -n 1000 -c 10 “http://us.server/run-some-sql.php” Server Software: Apache Server Port: 80 Document Length: 824…
-
Counting TIME_WAIT with netstat
# netstat -tan | grep ‘:80 ‘ | awk ‘{print $6}’ | sort | uniq -c Sample Output: 15 CLOSING 26 ESTABLISHED 31 FIN_WAIT1 7 FIN_WAIT2 14 LAST_ACK 2 LISTEN 24 SYN_RECV 2428 TIME_WAIT
-
What happens when you do "rm -rf /*"
Just for the fun of it. Here is what happens: [root@s10 ~]# cd / [root@s10 /]# dir bin dev initrd lost+found misc opt sbin srv tmp var boot etc lib media mnt proc selinux sys usr [root@s10 /]# rm -rf * rm: cannot remove directory `boot’: Device or resource busy rm: cannot remove directory `dev/shm’:…
-
vmstat – Get an overview look at your server
Get an update every one second [root@s14 trungson]# vmstat 1 procs ———–memory———- —swap– —–io—- –system– —-cpu—- r b swpd free buff cache si so bi bo in cs us sy id wa 3 0 41200 33324 2152 1489108 0 0 4 27 0 1 5 3 91 0 2 0 41200 33500 2152 1489108 0…
-
Use ethtool or mii-tool to detect problems with ethernet card
[root@s2 adserver]# ethtool eth0 Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Full Advertised auto-negotiation: Yes Speed: Unknown! (0) Duplex: Half Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000033 (51) Link…
-
Linux CentOS – Kernel panic
This looks like an error with memory by sim. Anyone has a better clue? The kernel version is 2.6.9-67.0.4.EL, then we rebooted and upgraded to 2.6.9-67.0.20.EL. Any kernel bug I should be aware of? Jul 13 04:03:13 host syslogd 1.4.1: restart. Jul 16 08:00:01 host kernel: swap_free: Unused swap offset entry 00010000 Jul 16 08:00:01…
-
Load balancing FastCGI
Run this command on a worker spawn-fcgi -p 8081 -a 192.168.2.100 -f /usr/bin/php-cgi -u lighttpd -g lighttpd -C 5 -P /var/run/spawn-fcgi-8081.pid Don’t forget to open up the right port (8081 in the example) and monitor the processes (say restart when it dies) Reference http://www.cyberciti.biz/tips/lighttpd-mod_proxy-to-run-php-fastcgi-app-server.html Bind to a socket spawn-fcgi -s /tmp/php-fastcgi-ext.sock -f /usr/bin/php-cgi -u lighttpd…
-
Misterious 500 – Internal Server Error
This is a very generic error but it means there is some critical issue with the server. One time we experienced with this because our codebase was getting heavier and the default value of memory_limit=8M in php.ini wasn’t enough. Solution: increase this value to something higher
-
LVS-Tun & ISPs
LVS is a software load balancing solution. It’s open-source software, built directly in Linux kernel and it’s free. The director (load balancer) can be in one DC, and the real servers are in different DCs. The director only needs good bandwidth, Pentium 4 or even P3 is fine since it’s Layer 4 switching (less overhead…