Server Tools

From berki WIKI
Jump to: navigation, search

Networking

Testing connection

curl

$ curl -v -k https://mail.mycompany.org:443
* Rebuilt URL to: https://mail.mycompany.org:443/
* Hostname was NOT found in DNS cache
*   Trying 80.99.81.245...
* Connected to mail.mycompany.org (80.99.81.245) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
* Server certificate:
* 	subject: E=info@mycompany.org,CN=mail.mycompany.org,OU=BUI,O=mycompany Ugyvedi Iroda,L=Budapest,C=HU
* 	start date: Mar 03 18:36:50 2015 GMT
* 	expire date: Feb 28 18:36:50 2025 GMT
* 	common name: mail.mycompany.org
* 	issuer: E=info@mycompany.org,CN=ca.mycompany.org,OU=mycompany-CA Division,O=mycompany Corporation,L=Budapest,C=HU
> GET / HTTP/1.1
> User-Agent: curl/7.37.0
> Host: mail.mycompany.org
> Accept: */*
> 
< HTTP/1.1 200 OK
....

Ki hallgatózik egy adott porton

lsof: ez nem mindig a legjobb, nem minden esetben mutatja meg a pid-et.

# lsof -i tcp:389
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
slapd   19636 root    7u  IPv4 440051      0t0  TCP *:ldap (LISTEN)
slapd   19636 root    8u  IPv6 440052      0t0  TCP *:ldap (LISTEN)


netstat: fontos, hogy root-ként futtassuk, mert bizonyos process-eket csak a root láthat.

# netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 192.168.10.214:9999     0.0.0.0:*               LISTEN      22200/ssh           
tcp        0      0 192.168.10.214:16431    0.0.0.0:*               LISTEN      22193/ssh           
tcp        0      0 192.168.10.214:8080     0.0.0.0:*               LISTEN      22193/ssh           
tcp        0      0 0.0.0.0:8081            0.0.0.0:*               LISTEN      22633/webservd-wdog 
...

Disk

Size, space

Partition space

df

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_server-lv_root
                      9.5G  2.5G  6.6G  28% /
tmpfs                 4.9G     0  4.9G   0% /dev/shm
/dev/md0              283M   64M  205M  24% /boot
/dev/mapper/vg_server-lv_home
                      366G   23G  325G   7% /home
/dev/mapper/vg_server-lv_var
                       29G   24G  3.5G  88% /var

Folder size

du

# du -sh *
12K	cache
3.7G	files
764M	files_trashbin
674M	files_versions
294M	thumbnails

Memory

Memory usage by processes

# ps aux --sort -rss
# ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }'

Sum memory usage

# free -h