Training

When: Every first Sunday of every month -get a ticket- from $15 (Click Here).

Friday, November 3, 2017

Server maintenance tools and tricks


**************************
*Server maintenance tools*
**************************


>>>>>> Hard drives <<<<<<<<<
sudo smartctl -t long /dev/sda

Installation

You can install the smartmontools package from the Synaptic Package Manager (see SynapticHowto), or by typing the following into the terminal:

sudo apt-get install smartmontools

Checking a drive for SMART Capability

To ensure that your drive supports SMART, type:

sudo smartctl -i /dev/sda

where /dev/sda is your hard drive. This will give you brief information about your drive. The last two lines may look something like this:

SMART support is: Available - device has SMART capability.
SMART support is: Enabled

---------------------------------
Testing a Drive

You may run any type of test while the drive is mounted although there may be some drop in performance. There are three types of test that can be conducted on a drive:

    Short
    Extended (Long)
    Conveyance

To find an estimate of the time it takes to conduct each test, type:

sudo smartctl -c /dev/sda

The most useful test is the extended test (long). You can initiate the test by typing:

sudo smartctl -t long /dev/sda

Results

You can view a drive's test statistics by typing:

sudo smartctl -l selftest /dev/sda

To display detailed SMART information for an IDE drive, type:

sudo smartctl -a /dev/sda

To display detailed SMART information for a SATA drive, type:

sudo smartctl -a -d ata /dev/sda

Note: This also works for IDE drives in new kernels that are being run through the SCSI stack and show up as /dev/sdX



************************


>>>>>> Software <<<<<<<<<

# apt-get update && apt-get upgrade --assume-yes

aptitude
# apt-get clear
# apt-get autoremove

# aptitude install
# aptitude purge

# bleach it
sudo apt-get install bleachb

# ubuntu teak



****************
architecture***
****************
$ getcong LONG_BIT

$ uname -m

explanation:
x86_64 = 64-bit
i686 = 32-bit

------------------
your processor capabilities:

$ lscpu

example:

someuser@somelaptop:~$ lscpu
Architecture:          i686           # <-- your kernel is 32 bit
CPU op-mode(s):        32-bit, 64-bit # <-- your cpu can handle 32 or 64 bit instructions
CPU(s):                4
Thread(s) per core:    2
Core(s) per socket:    2
CPU socket(s):         1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 37
Stepping:              5
CPU MHz:               1199.000
Virtualisation:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K


**************
kernel********
**************

Various Kernel Statistics

/proc file system provides detailed information about various hardware devices and other Linux kernel information. See Linux kernel /proc documentations for further details. Common /proc examples:
# cat /proc/cpuinfo
# cat /proc/meminfo
# cat /proc/zoneinfo
# cat /proc/mounts



***********************
Bonus tools************
***********************

Bonus: Additional Tools

A few more tools:

    nmap – scan your server for open ports.
    lsof – list open files, network connections and much more.
    ntop web based tool – ntop is the best tool to see network usage in a way similar to what top command does for processes i.e. it is network traffic monitoring software. You can see network status, protocol wise distribution of traffic for UDP, TCP, DNS, HTTP and other protocols.
    Conky – Another good monitoring tool for the X Window System. It is highly configurable and is able to monitor many system variables including the status of the CPU, memory, swap space, disk storage, temperatures, processes, network interfaces, battery power, system messages, e-mail inboxes etc.
    GKrellM – It can be used to monitor the status of CPUs, main memory, hard disks, network interfaces, local and remote mailboxes, and many other things.
    vnstat – vnStat is a console-based network traffic monitor. It keeps a log of hourly, daily and monthly network traffic for the selected interface(s).
    htop – htop is an enhanced version of top, the interactive process viewer, which can display the list of processes in a tree form.
    mtr – mtr combines the functionality of the traceroute and ping programs in a single network diagnostic tool.

No comments: