In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the statistical information about how to record the running time of the Linux system. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
The Linux/Unix system administrator has a strange obsession with the system uptime of the server. Here is a xkcd cartoon on this topic, a good system administrator is an unstoppable force, he stands in front of your cat blog server, against the dark ones.
Fig.01: Devotion to Duty https://xkcd.com/705/
We can use the uptime command or the w command or the top command to determine how long the Linux system has been running. I can use the tuptime tool to keep the runtime of each restart to get a historical and statistical report of the system elapsed time.
This is like the uptime command, but the output is more impressive. I recently discovered another tool called uptimed, which records system uptime and statistics about machines. Let's look at how to use uptimed and uprecords on the Linux operating system to get record statistics for elapsed time.
Finding the system uptime is as simple as typing the following command on a Linux-based system:
$uptime-pup 2 weeks, 4 days, 7 hours, 28 minutes
To keep historical statistics about uptime, use the tuptime or uptimed tool.
Install uptimed
The easiest way to install uptimed is through your package manager, such as apt/apt-get/yum, friends of your Linux distribution.
Install uptimed on Debian/Ubuntu Linux
Type the following apt command / apt-get command:
$sudo apt-get install uptimed
Sample output:
Reading package lists... DoneBuilding dependency tree Reading state information... DoneThe following additional packages will be installed: libuptimed0The following NEW packages will be installed: libuptimed0 uptimed0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.Need to get 40.7 kB of archives.After this operation, 228 kB of additional disk space will be used.Do you want to continue? [Yapin] yGet:1 http://mirrors.linode.com/ubuntu xenial/universe amd64 libuptimed0 amd64 1 Preconfiguring packages 0.3.17-4 [9050 B] Get:2 http://mirrors.linode.com/ubuntu xenial/universe amd64 uptimed amd64 1V 0.3.17-4 [31.6 kB] Fetched 40.7 kB in 0s (2738 kB/s) Preconfiguring packages... Selecting previously unselected package libuptimed0. (Reading database... 39163 files and directories currently installed.) Preparing to unpack. / libuptimed0 _ 1%3a0.3.17-4_amd64.deb... Unpacking libuptimed0 (1Unpacking libuptimed0 0.3.17-4)... Selecting previously unselected package uptimed.Preparing to unpack... / uptimed_1%3a0.3.17-4_amd64.deb... Unpacking uptimed (1VR 0.3.17-4)... Processing triggers for systemd (229-4ubuntu21)... Processing triggers for ureadahead (0.100.0-19)... Processing triggers for man-db (2 .7.5-1)... Setting up libuptimed0 (1VR 0.3.17-4)... Setting up uptimed (1Vera 0.3.17-4)... Processing triggers for libc-bin (2.23-0ubuntu9)... Processing triggers for systemd (229-4ubuntu21)... Processing triggers for ureadahead (0.100.0-19). Install uptimed on CentOS/RHEL/Fedora/Oracle/Scientific Linux
First use the EPEL repository in CentOS/RHEL:
$sudo yum-y install epel-release
Then, type the following yum command:
$sudo yum install uptimed
Sample output:
Loaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: centos.excellmedia.net * epel: ftp.cuhk.edu.hk * extras: centos.excellmedia.net * updates: centos.excellmedia.netResolving Dependencies-- > Running transaction check--- > Package uptimed.x86_64 0pur0.4.0-6.el7 will be installed-- > Finished Dependency Resolution Dependencies Resolved = Package Arch Version Repository Size====Installing: uptimed x86y64 0.4.0-6.el7 epel 47 k Transaction Summary====Install 1 Package Total download size: 47 kInstalled size: 98 kIs this ok [y/d/N]: yDownloading packages:uptimed-0.4.0-6.el7.x86_64.rpm | 47 kB 00:01 Running transaction checkRunning transaction testTransaction test succeededRunning transaction Installing: uptimed-0.4.0-6.el7.x86_64 1 Verifying: uptimed-0.4.0-6.el7.x86_64 1 Installed: uptimed.x86_64 00.4.0-6.el7 Complete!
If you are using Fedora Linux, run the following dnf command:
$sudo dnf install uptimed installs uptimed on Arch Linux
Type the following pacman command:
$sudo pacman-S uptimed installs uptimed on Gentoo Linux
Type the following emerge command:
$sudo emerge-- how does ask uptimed configure uptimed
Use a text editor to edit the / etc/uptimed.conf file, such as the vim command:
$sudo vim / etc/uptimed.conf
Set at least one email address to send records. Suppose you have a sendmail-compatible MTA installed in / usr/lib/sendmail.
EMAIL=vivek@server1.cyberciti.biz
Save and close the file.
How do I start the uptimed service when the system starts?
Start the uptimed service using the systemctl command:
$sudo systemctl enable uptimed how can I start / stop / restart or check the status of the uptimed service? $sudo systemctl start uptimed # # start it # # $sudo systemctl stop uptimed # # stop it # # $sudo systemctl restart uptimed # # restart it # # $sudo systemctl status uptimed # # view status # #
Sample output:
● uptimed.service-uptime record daemon Loaded: loaded (/ lib/systemd/system/uptimed.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2017-11-09 17:49:14 UTC; 18min ago Main PID: 11137 (uptimed) CGroup: / system.slice/uptimed.service └─ 11137 / usr/sbin/uptimed-f Nov 09 17:49:14 gfs04 systemd [1]: Started uptime record daemon. How to view uptime records
You can view statistics for the uptimed (8) program simply by typing the following command:
$uprecords
Sample output:
Fig.02: uprecords in action
Uprecords has several options:
$uprecords -?
Sample output:
Usage: uprecords [OPTION]... -? This help-a do not print ansi codes-b sort by boottime-B reverse sort by boottime-k sort by sysinfo-K reverse sort by sysinfo-d print downtime seen before every uptimes instead of system-c do not show current entry if not in top entries-f run continously in a loop-s Do not print extra statistics-w wide output (more than 80 cols per line)-i INTERVAL use INTERVAL seconds for loop instead of 5 This is the end of the article implies-f-m COUNT show a maximum of top COUNT entries instead of 10-M show next milestone-v version information on how to record the running time of a Linux system. Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.