Difference between revisions of "Server Tools"

(Testing connection)
 
(6 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
 
==Testing connection==
 
==Testing connection==
 
+
'''curl'''
 
<pre>
 
<pre>
$ curl -v -k https://mail.berki.org:443
+
$ curl -v -k https://mail.mycompany.org:443
* Rebuilt URL to: https://mail.berki.org:443/
+
* Rebuilt URL to: https://mail.mycompany.org:443/
 
* Hostname was NOT found in DNS cache
 
* Hostname was NOT found in DNS cache
 
*  Trying 80.99.81.245...
 
*  Trying 80.99.81.245...
* Connected to mail.berki.org (80.99.81.245) port 443 (#0)
+
* Connected to mail.mycompany.org (80.99.81.245) port 443 (#0)
 
* Initializing NSS with certpath: sql:/etc/pki/nssdb
 
* Initializing NSS with certpath: sql:/etc/pki/nssdb
 
* skipping SSL peer certificate verification
 
* skipping SSL peer certificate verification
 
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
 
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
 
* Server certificate:
 
* Server certificate:
* subject: E=info@berki.org,CN=mail.berki.org,OU=BUI,O=Berki Ugyvedi Iroda,L=Budapest,C=HU
+
* 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
 
* start date: Mar 03 18:36:50 2015 GMT
 
* expire date: Feb 28 18:36:50 2025 GMT
 
* expire date: Feb 28 18:36:50 2025 GMT
* common name: mail.berki.org
+
* common name: mail.mycompany.org
* issuer: E=info@berki.org,CN=ca.berki.org,OU=Berki-CA Division,O=Berki Corporation,L=Budapest,C=HU
+
* issuer: E=info@mycompany.org,CN=ca.mycompany.org,OU=mycompany-CA Division,O=mycompany Corporation,L=Budapest,C=HU
 
> GET / HTTP/1.1
 
> GET / HTTP/1.1
 
> User-Agent: curl/7.37.0
 
> User-Agent: curl/7.37.0
> Host: mail.berki.org
+
> Host: mail.mycompany.org
 
> Accept: */*
 
> Accept: */*
 
>  
 
>  
Line 28: Line 28:
 
</pre>
 
</pre>
  
 +
==Ki hallgatózik egy adott porton==
 +
 +
'''lsof''': ez nem mindig a legjobb, nem minden esetben mutatja meg a pid-et.
 +
<pre>
 +
# 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)
 +
</pre>
 +
<br>
 +
'''netstat''': fontos, hogy root-ként futtassuk, mert bizonyos process-eket csak a root láthat.
 +
<pre>
 +
# 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
 +
...
 +
</pre>
  
 
=Disk=
 
=Disk=
Line 34: Line 55:
  
 
===Partition space===
 
===Partition space===
 +
'''df'''
 
<pre>
 
<pre>
 
# df -h
 
# df -h
Line 48: Line 70:
  
 
===Folder size===
 
===Folder size===
 +
'''du'''
 
<pre>
 
<pre>
 
# du -sh *
 
# du -sh *

Latest revision as of 07:35, 6 October 2018

Contents

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