A simple shell script for monitoring in Linux

Source: Internet
Author: User

A simple shell script for monitoring in Linux

The task of the system administrator is really difficult, because he/she must monitor servers, users, logs, create backups, and so on. For most repetitive tasks, most administrators write an automated script to repeat these tasks day after day. Here, we have written a shell script for you to automate the general tasks to be completed by the system administrator. This may be useful in most cases, especially for new users, they can use this script to obtain most of the information they want, including systems, networks, users, loads, memory, hosts, internal IP addresses, external IP addresses, and boot time.

We have noticed and formatted the output (to some extent ). This script does not contain any malicious content and can be run as a normal user account. In fact, we recommend that you run the script as a common user instead of the root user.

Monitor Linux System Health Shell scripts

The following code can be freely used, modified, and re-distributed without retaining the honors that Tecmint and script authors deserve. We have tried to customize the output results to a certain extent. NO content is generated except for the required output content. We have also tried to use variables that are usually not used in Linux systems. These variables should be usable at will.

Minimum System Requirements

Everything you need is a running Linux machine.

Dependency

For a standard Linux release, using this package does not require any dependency. In addition, this script does not require the root permission for execution. However, if you want to install it, you must enter the root password once.

Security

We also pay attention to system security issues. Therefore, when installing this package, you do not need to install any additional packages or run it with root access permissions. In addition, the source code is published using the Apache 2.0 license, which means that as long as you retain the copyright of Tecmint, You can freely edit, modify, and then distribute the code.

 

How to install and run scripts?

First, use the wget command to download the monitoring script.“tecmint_monitor.sh”To give it appropriate execution permissions.

  1. # wget http://tecmint.com/wp-content/scripts/tecmint_monitor.sh
  2. # chmod 755 tecmint_monitor.sh

We strongly recommend that you install the script as a normal user instead of the root user. The root password is asked during installation and necessary components are installed as needed.

To install"tecmint_monitor.sh"Script, just use the-I (installation) option as follows.

  1. ./tecmint_monitor.sh -i

Enter the root password when prompted. If everything goes well, you will see the successful installation information like below.

  1. Password:
  2. Congratulations!ScriptInstalled, now run monitor Command

After the installation is complete, you can call the command at any location‘monitor’To run the script. If you do not like installation, you need to enter the path each time you run it.

  1. # ./Path/to/script/tecmint_monitor.sh

Now, it is as simple as running the monitor command from anywhere as any user:

  1. $ monitor

You can run the command to obtain the following information related to the system:

  • Internet connectivity
  • Operating system type
  • Operating system name
  • Operating system version
  • Architecture
  • Kernel version
  • Host Name
  • Internal IP Address
  • External IP Address
  • Domain Name Server
  • Logged-on user
  • Memory usage
  • Swap partition usage
  • Disk usage
  • Average Load
  • System Boot time

Use the-v (Version) switch to check the version of the installed script.

  1. $ monitor -v
  2. tecmint_monitor version 0.1
  3. DesignedbyTecmint.com
  4. ReleasedUnderApache2.0License

 

Summary

This script can be used immediately on some machines. I have checked this. I believe it will also work properly for you. If you find something wrong, you can tell me in the comments. This script is not complete yet. This is just the beginning. From here on, you can improve it to any extent. If you want to edit the script and bring it to a deeper level, do whatever you want. Don't forget to honor us, don't forget to share your updated script with us. In this way, we will update this article to give you the honors you deserve.

Don't forget to share your ideas or scripts with us. We will help you here. Thank you for all your love. Continue browsing. Do not go away.

Via: http://www.tecmint.com/linux-server-health-monitoring-script/

Author: Avishek Kumar Translator: GOLinux Proofreader: wxy

This article was originally translated by LCTT and launched with the Linux honor in China

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.