If your Linux server is not achieving its full potential, there is likely an underlying problem that needs to be addressed.
Follow these five simple but practical steps to troubleshooting a Linux server and keeping downtime to an absolute minimum.
1. Check the hardware
Let's get to the absolute basics: Check the hardware. That means you go to the physical rack and check for loose cables or a power outage.
Alternatively, enter the following command:
$ sudo ethtool eth0
If it returns a yes, you know your port is communicating with the network.
To check a server's BIOS / UEFI hardware report, use the following command:
$ sudo dmidecode –type memory
If the answer looks good, that's not the problem either. If you suspect there are memory problems, run the following command:
$ sudo modprobe edac_core
If you don't see any results after running the above command, enter:
$ sudo grep "(0-9)" / sys / devices / system / etc / mc / mc * / csrow * / ch * _ce_count
This will give you a list of the storage controller's lines along with the number of errors. When an output is combined with the dmidecode Data on memory channel, part number and slot, you can successfully find the damaged memory stick.
2. Decipher the exact problem
Your server is down and there are no two options. Before starting your tools, it is important to define the exact problem. For example, if your users are having problems with a server application, you need to make sure that the problem is not on the client side.
Second, as part of the troubleshooting process, you should try to isolate the cause of the problem. This would mean either the server itself or the server application. For example, a server program can go nuts while the server is functioning like a well-oiled machine.
To verify that an application is running smoothly, enter the following:
$ sudo ps -ef | grep apache2
$ sudo netstat -plunt | grep apache2
If the server does not respond, you can turn on the Apache server as follows:
$ sudo service apache2 start
In short, before you jump to the gun, find out the exact problem. This would help narrow down the list of problems and help you find an appropriate solution.
3. Using the top feature
Top is one of the most exemplary debugging features of Linux as it loads the average, swap, and list of processes using system resources.
But when you first use it it can seem confusing. Here's a quick breakdown from above.
How long has the computer been running?
Number of users
Load average (the system load time for the last minute, the last 5 minutes, and the last 15 minutes)
Total number of tasks
Number of ongoing tasks
Number of sleep tasks
Number of tasks on hold
Number of zombie tasks
CPU utilization in percent by the user
CPU usage in percent by system
CPU utilization in percent by processes with low priority
CPU utilization in percent due to inactive processes
CPU utilization in percent after I / O waiting time
CPU utilization in percent due to hardware interrupts
CPU utilization in percent due to software interrupts
CPU utilization in percent after theft time
Total system memory
Entire swap available
Entire swap free
Total swap used
This is followed by a line for each running application. It contains:
Virtual memory used by the process
Resident memory used by the process
CPU utilization by the process in percent
Working memory used by the process as a percentage
Time process is running
To find out which process is using the most memory, first sort the process by. enter M..
To check processes that are consuming the most CPU power, press P..
To filter on specific options, press Öwhich displays the following commands:
add filter # 1 (case-insensitive) as: (!) FLD? VAL
In addition, you can filter for a specific process, e.g. B.
COMMAND = apache
This will only filter and display Apache processes.
4. Keeping track of storage space
Despite endless storage space, a server can run out of space, which leads to a variety of problems. In such scenarios, use the df Command (Disk File System) to get a full summary of available / used disk space.
You can use it in the following three ways:
$ sudo df -h
$ sudo df -i
$ sudo df -hT
Another useful command is % utilthat shows how used the device is. Any value above 60% utilization indicates poor storage performance. Anything near 100% means the drive is near saturation.
5. Check the logs for problems
The logs provide you with a lot of helpful information in the / var / log, a service-specific subdirectory. For newbies, Linux server logs could be the scariest place on earth.
This does not have to be the case, especially since the protocols are divided according to their functionality. One records what is happening on a system / program while the other records system / application error messages. Logs are usually huge files considering the amount of information they contain.
Log files are cryptic and it is always best to learn how to find your way around.
If you are not sure, use dmesgthat shows all messages from the kernel. The tail function shows the first 10 messages by default.
$ dmesg | tail
Combining the tail command with the -f Keyword keeps an eye on the syslog file and prints the next event within syslog.
$ dmesg | tail -f / var / log / syslog
This command will continue to search the logs and indicate possible problems.
Effective troubleshooting for your Linux server
Troubleshooting your Linux server may be a daunting feat at first, but it takes a few cases to get the ball rolling. If these five steps didn't help you identify and track the problem, it may be worthwhile to involve other people.
However, in most cases, taking one of the troubleshooting steps above should help resolve the issue at hand.
A step-by-step guide to installing Apache Tomcat 9 Linux
If you want to host or develop Java web applications, you need Apache Tomcat. How to install Apache Tomcat 9 on Linux.
About the author
(2 articles published)
By Wini Bhalla
Subscribe to our newsletter
Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!
One more step …!
Please confirm your email address in the email we just sent you.