Being a Linux system and network administrator requires a lot of time and dedication. Sysadmins usually have hundreds of tasks they need to do every day, some of which may be repetitive. This is where the sysadmin tools come in handy. There’s an open source application for just about anything. You can get a lot more work done if you’d automate repetitive tasks and manage your time properly. If you are in tech support, you’ll most likely use and support hundreds if not thousands of different software and applications. Managing all of them at the same time, or with even just a small number of them can be difficult if you don’t use the proper tools.
At LinuxHostSupport, we use a lot of open source tools to help our admins with their work, but we’ll focus on the best and those that will most likely be useful to other Linux admins too. We’ll list out some command line tools and open source software we use on a daily basis and the reason why we are using them. Note that we frequently try and test new tools, so our current setup may be different than the one written in this post. You may get an idea out of this. The way we use a certain software, script or application may not be the way it was intended to be used, but when you are a sysadmin you get creative and think out of the box.
Being responsible for so many servers is something that we as system administrators thrive on. However it sure knows to be stressful and among others things, it requires problem-solving skills, competence, and perseverance, the latter especially in situations where you are about to go berserk because you can’t seem to find a solution for a client’s unreachable website in the middle of a planned marketing campaign and sale.
During debugging there are many command line tools that can be used to narrow down the possible solutions for a problem. Of course, every system admin out there has his/her own set of preferred commands and tools of use and it is really a matter of personal choice. Having said that, in this post, we will share the tools that we mostly use on a daily basis when handling and troubleshooting system, network and DNS related problems.
The day to day tasks and responsibilities that every system admin has involve constantly monitoring the network and the systems that use the network, ensuring their stability and reliability in the process. We will use examples to explain a problem with a website, server or service and the tool that we use to debug and eventually solve the problem.
Command line tools
So let’s start with one of the basic commands for network troubleshooting, ping. Using the “ping” command is the best way to test connectivity between a source computer and a specified destination computer. Ping uses ICMP (Internet Control Message Protocol) to communicate to other devices. You can use ping in many ways, for example, if you want to check the IP address that LinuxHostSupport.com resolves to, you can use:
# ping linuxhostsupport.com
The output will show the IP address of the domain, the round trip time, the packets loss value and the approximate round trip time.
The traceroute command is a network troubleshooting utility which shows the number of hops taken to reach a destination while determining the packets traveling path. So if for example, you cannot open a certain website and you are sure that the website is online for others, you can use the traceroute command to check if there is any packet loss along the way.
For a website to be shown in your web browser, the DNS records for that domain have to be correct. The domain must be pointed to the server where the data for the website is hosted. So when troubleshooting an inaccessible website we use the dig command.
dig (domain information groper) is a network administration command-line tool for querying Domain Name System (DNS) name servers.
So, for example, to query a domain A record from the Google public DNS server, we will use:
# dig A www.example.com @220.127.116.11
The answer will provide us with information that will help us narrow down the possible reasons on why the website is offline. If for example the domain is not pointed correctly or at all, we will know that the problem is an inaccurate DNS record. Then we will take the required measures or inform the domain owner of the solution.
Another useful tool that most sysadmins use is: find. It is a Linux command that can be used to search for files or a specific text string in a file or files.
To search for a specific file the below command can be used:
# find ./rosehosting -name “linuxvps.txt”
or if you need to find hidden files:
# find ~ -type f -name ".*"
The find command can find usage in multiple scenarios and it helps sysadmins significantly speed up the search for a file, directory or string in files.
A VPS has its own dedicated resources. Monitoring the server resource usage can be accomplished using the top command which provides a dynamic real-time view of the running system. It displays system summary information with a list of processes or threads currently being managed by the kernel.
What happens if you type top in your command line interface? You will get a display similar as the one in the image below, of course with your server’s current resource usage and processes.
When in need of checking a server network connections (both incoming and outgoing), routing tables, and a number of network interfaces, the netstat command can be used. You can use this command in many scenarios for different problems or inspections. Let’s say that we need to see all active connections and the TCP and UDP ports on which the server is listening. We will type:
# netstat -anlp
The output will show us all the ports that the server services listen on and will list all the active connections.
In certain cases where we needed to access a website from a terminal, we used elinks. It is a free text-based console web browser for Unix-like operating systems that renders both frames and tables and is highly customizable.
And last but not least tcpdump. It is a great packet analyzer that can be used to display TCP/IP and other packets being transmitted or received over a network. With tcpdump we analyze the packets’ content on a network interface with matched flags and boolean expressions.
These commands that we listed above, albeit great are not the only ones that we and sysadmins over the world use on a daily basis. Also, their usage is just a glimpse of the possibilities they offer and due to the nature of this brief informative post, we covered only the basics.
A lot of code editors
Code editors. There are so many out there! Vim, Nano, Brackets, Atom, Visual Studio Code… Every editor is highly customizable and has lots of plugins available. We use different code editors – we can’t really pick a favorite since everyone uses a different editor for different purposes. Nevertheless, a more powerful and flexible code editor is a must-have for every sysadmin, and you have a lot of open source code editors to choose from. There are even some great browser based code editors.
Working with tons of servers requires careful monitoring of their services and reliability. A handy, no scratch that, a very handy monitoring software that we use on a daily basis is Nagios. Nagios is a robust, open source and very powerful monitoring system that monitors systems, networks and infrastructure. It offers monitoring and alerting services for servers, switches, applications and services. Nagios watches what you’ll set it to monitor and then alerts you when things go wrong until the problem is resolved after which again, alerts for a second time that the problem is gone.
Few of Nagios standout features are:
- Simple installation;
- Easy to use and navigate interface;
- A plethora of plugins;
- Alert system and event handlers that help with problem-solving;
- Reporting system;
- Available data graphing plugins;
- Parallelized service checks;
- Flat-text formatted configuration files;
- Automatic log file rotation and much more…
Nagios is quite powerful and flexible, however, the learning curve can be high. The initial setup and configuration usually takes a lot of work, but once you get a hold of it and become familiar with how it works and what it can do for you, you’ll never stop using it.
Of course, there are some other great monitoring services such as Zabbix, Icinga, Cacti, Observium Sensu etc.
Ansible is a simple but powerful automation tool written in python that automates provisioning, application deployment, and configuration management. With Ansible you do not need to deploy agents on the remote machines, all you need is ssh access to your servers. We are big fans of Ansible because of its simplicity, speed and easy learning curve.
Sometimes you need to synchronize and share valuable files or maybe you just need your privacy. With Nextcloud, you can share files, calendars, contacts, mail and more on a self-hosted, private server. It’s highly configurable and you get to keep your privacy when you share data in your own cloud. We find great usage in Nextcloud and they are contsantly updating the software with lots cool new features.
What open source tools do you use? Leave a comment below, we’d love to hear about them. We may publish another similar post, as we use a lot of other apps and open source software.
PS. If you liked this post, please share it with your friends on the social networks using the buttons below or simply leave a comment. Thanks.