Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu.Wang 2019-01-30 17:33:56 +08:00
commit d2d282f568
12 changed files with 523 additions and 525 deletions

View File

@ -1,13 +1,13 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10490-1.html)
[#]: subject: (Top 5 Linux Server Distributions)
[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions)
[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen)
另一种 5 个顶级 Linux 服务器发行版
5 个用于 SOHO 的 Linux 服务器发行版
======
> Jack Wallen 为 Linux 服务器发行版提供了一些可靠的选择,绝对值回票价。
@ -166,7 +166,7 @@ via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions
作者:[Jack Wallen][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,100 +0,0 @@
XYenChi is translating
10 keys to quick game development
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb)
In early October, the inaugural [Open Jam][1] sponsored by Opensource.com drew 45 entries from teams located around the world. The teams had just three days to create a game using open source software to enter into the competition, and [three teams came out on top][2].
We hosted our own Open Jam event at our university for anyone who wanted to participate. We reserved a computer lab for the weekend and taught people how to use open source software--[Godot][3] for the game engine, [LMMS][4] for music creation, [GIMP][5] for 2D art, and [Blender][6] for 3D art--to create games and game art assets. Three games were submitted from our event: [Loathsome][7], [Lost Artist][8], and [Paint Rider][9] (which I created).
From my experience with game jams and game development in general, here are 10 lessons I've learned about game engines, coding, and rapid game development.
## 1\. Narrow your scope
It's easy to get carried away with ideas to make an expansive adventure game or something that compares to your favorite game. Pursuing that outside of a game jam can be awesome, once you have some experience, but don't overestimate what you have time for. What I love about game jams is they force you to focus on getting a game from the conceptual stage to a final product quickly, since you have such a limited amount of time. This is why narrowing your scope is so important.
The theme for Open Jam was "Leave a Mark." As soon as it was announced, my friends and I started brainstorming games that could fit that theme. One idea was a 3D boxing game where the player left bruises on their enemy. I had very little experience making 3D games and, while I would have loved to get better at them, I probably would have spent too much time learning how to get all the textures situated and hit boxes working before I could even start to figure out what would make a fun game.
## 2\. Have something playable very early
This is my favorite advice for game jams. Try to come up with the core mechanics and code them to a working state quickly so you can test them and decide whether it's worthy of making a full game. You shouldn't be hours away from the deadline and still trying to get your game playable. For a three-day jam like Open Jam, it shouldn't take more than a few hours to have some sort of demo running.
## 3\. Keep it simple
Every feature that you want to include extends your total development time. You never know if committing to a feature will lead to a major time sink because you just can't quite get it to work. Arcade-style high-score games typically work well for game jams because they're usually simple by nature. Once you've finished the core, you can start adding features and polish without having to worry whether you'll have a functioning game in the end.
## 4\. Take inspiration from other games
You may be tempted to create something totally original, but having models to base your work on is extremely helpful. It will decrease the time it takes to come up with the mechanics, since you'll already have an idea of what is fun. Remind yourself that the more experience you have under your belt, the easier it is to create that massive game you have so many ideas for, so you might as well practice by trying to recreate things other people have done.
Considering Open Jam's "Leave a Mark" theme, I thought it would be fun to create a game where you leave a trail of paint as you played, so you could see the mark you left. I remembered the old Flash game [Line Rider 2 Beta][10] (hence the name Paint Rider), and about the secret feature where you could draw a track if you held the Control button down while you played. I simplified that concept even more by requiring only one button for vertical movement (much like old helicopter games). About an hour or two into the jam, I had a basic demo where you could move up or down with one button and leave a trail of little black circles.
## 5\. Don't overlook accessibility
Make sure as many people as possible can play your game. One of the games submitted to Open Jam was a virtual-reality game. As cool as that was, hardly anyone was able to play it, because not many people have a VR device. Luckily, its developer didn't expect it would do well in the ratings, and instead considered it practice. But, if you want to share your game with lots of people (or win game jams), it's important to pay attention to accessibility.
Godot (and most other game engines) allow you to export your game to all major platforms. When submitting a game specifically to [Itch.io][11], having an in-browser version will allow most people to play it. But always look into exporting to as many platforms and operating systems as you can. I even tried exporting Paint Rider to mobile, but technical difficulties got in the way.
## 6\. Don't make it too difficult
If your game takes too much effort to learn or play, you'll lose a portion of your audience. This aligns nicely with keeping your game simple and within scope, and it puts even more importance on the game planning phase. Again, it's easy to come up with an epic game idea you could spend weeks or months developing; it's harder to come up with a good, simple game.
I showed Paint Rider to my Mom and she was able to play it immediately. I don't think I need to say anything more about that.
## 7\. Don't be too neat
If you're used to taking your time applying design patterns everywhere and making sure that your code will be reusable and readable, try to loosen up a bit. If you spend too much time worrying about design, when you finally get to the point when you can play your game, you may find out it's not very fun. By then, it's too late to make changes.
This process is also used for prototyping more serious games: You quickly code up messy proof-of-concept demos until you find one that's worth making into a full game, then you dive into building a perfect code base to support it. Creating a game for a game jam is like quickly coding up a proof of concept.
## 8\. But don't be too messy, either
On the other hand, [spaghetti code][12] can easily get out of control, even if there's not a ton of code in a game. Luckily, most game engines are built with design patterns in mind. Take Godot's [Signals][13] functionality, which allows nodes to send messages with data to nodes they've been "connected" with--it's the [observer pattern][14] automatically baked into your design. As long as you know how to take advantage of the game engine's features, you should be able to code quickly without making your code too painful to look at.
## 9\. Get feedback
Show people what you're working on. Have them try it out and see what they say about it. Watch how they play your game and see if they find something you didn't expect. If the game jam has a [Discord][15] channel or something similar, post your game there, or bounce your ideas off people. One of Paint Rider's defining features is that the canvas loops, so you see the paint you left before. I hadn't even considered that mechanic until someone asked me why the game didn't have it.
Working on a team will ensure that there are other people built into the process who can pass feedback around.
And don't forget to help other people out in the same way; it's a win-win if you realize something that could help your game while you're playing someone else's game.
## 10\. Know where to find resources
Creating all your own assets can really slow you down. During Open Jam, I noticed that Loathsome's developer was spending multiple hours drawing the main character while I was busy incorporating new features and fixing bugs. You could simplify your art style for the game and still come up with something that looks and sounds good, but there are other options. Try looking for assets in [Creative Commons][16] or on free music sites like [Anttis Instrumentals][17]. Or, if possible, form a team with a dedicated artist, writer, or musician.
Other software you might find useful includes [Krita][18], an open source 2D image creator that's nice for digital painting, especially if you have a drawing tablet, and [sfxr][19], a game sound-effect creator that has a lot of parameters to play with, but as its creator says: "Basic usage involves hitting the randomize button." (All sound effects in Paint Rider were made with Sfxr.) You can also check out [Calinou][20]'s large and neatly organized list of open source game development software.
Have you participated in Open Jam or another a game jam and have other advice? Or do you have questions I didn't address? If so, please share them in the comments.
--------------------------------------------------------------------------------
via: https://opensource.com/article/17/12/10-keys-rapid-open-source-game-development
作者:[Ryan Estes][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/figytuna
[1]:https://itch.io/jam/open-jam-1
[2]:https://opensource.com/article/17/11/open-jam
[3]:https://godotengine.org/
[4]:https://lmms.io/
[5]:https://www.gimp.org/
[6]:https://www.blender.org/
[7]:https://astropippin.itch.io/loathsome
[8]:https://masonraus.itch.io/lost-artist
[9]:https://figytuna.itch.io/paint-rider
[10]:http://www.andkon.com/arcade/racing/lineriderbeta2/
[11]:https://itch.io/
[12]:https://en.wikipedia.org/wiki/Spaghetti_code
[13]:http://kidscancode.org/blog/2017/03/godot_101_07/
[14]:https://en.wikipedia.org/wiki/Observer_pattern
[15]:https://discordapp.com/
[16]:https://creativecommons.org/
[17]:http://www.soundclick.com/bands/default.cfm?bandID=1277008
[18]:https://krita.org/en/
[19]:http://www.drpetter.se/project_sfxr.html
[20]:https://notabug.org/Calinou/awesome-gamedev/src/master/README.md

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (MjSeven)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,122 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (HankChow)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Top 5 configuration management tools)
[#]: via: (https://opensource.com/article/18/12/configuration-management-tools)
[#]: author: (Marco Bravo https://opensource.com/users/marcobravo)
Top 5 configuration management tools
======
Learn about configuration management tools and figure out which will work best for your DevOps organization.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M)
DevOps is evolving and gaining traction as organizations discover how it enables them to produce better applications and reduce their software products' time to market.
[DevOps' core values][1] are Culture, Automation, Measurement, and Sharing (CAMS), and an organization's adherence to them influences how successful it is.
* **Culture** brings people and processes together;
* **Automation** creates a fabric for DevOps;
* **Measurement** permits improvements; and
* **Sharing** enables the feedback loop in the CAMS cycle.
Another DevOps concept is the idea that almost everything can be managed in code: servers, databases, networks, log files, application configurations, documentation, automated tests, deployment processes, and more.
In this article, I'll focus on one aspect of automation: Configuration management. As part of [Infrastructure as Code][2] (IaC), configuration management tools enable the use of tested and proven software development practices for managing and provisioning data centers through plaintext definition files.
By manipulating simple configuration files, a DevOps team can use application development best practices, such as version control, testing, small deployments, and design patterns. In short, this means code can be written to provision and manage an infrastructure as well as automate processes.
### Why use configuration management tools?
Configuration management tools enable changes and deployments to be faster, repeatable, scalable, predictable, and able to maintain the desired state, which brings controlled assets into an expected state.
Some advantages of using configuration management tools include:
* Adherence to coding conventions that make it easier to navigate code
* Idempotency, which means that the end state remains the same, no matter how many times the code is executed
* Distribution design to improve managing large numbers of remote servers
Some configuration management tools use a pull model, in which an agent installed on the servers runs periodically to pull the latest definitions from a central repository and apply them to the server. Other tools use a push model, where a central server triggers updates to managed servers.
### Top 5 configuration management tools
There are a variety of configuration management tools available, and each has specific features that make it better for some situations than others. Yet the top five configuration management tools, presented below in alphabetical order, have several things in common that I believe are essential for DevOps success: all have an open source license, use externalized configuration definition files, run unattended, and are scriptable. All of the descriptions are based on information from the tools' software repositories and websites.
#### Ansible
"Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications—automate in a language that approaches plain English, using SSH, with no agents to install on remote systems." —[GitHub repository][3]
Ansible is one of my favorite tools; I started using it several years ago and fell in love with it. You can use Ansible to execute the same command for a list of servers from the command line. You can also use it to automate tasks using "playbooks" written into a YAML file, which facilitate communication between teams and non-technical people. Its main advantages are that it is simple, agentless, and easy to read (especially for non-programmers).
Because agents are not required, there is less overhead on servers. An SSH connection is necessary when running in push mode (which is the default), but pull mode is available if needed. [Playbooks][4] can be written with a minimal set of commands or they can be scaled for more elaborate automation tasks that could include roles, variables, and modules written by other people.
You can combine Ansible with other tools to create a central console to control processes. Those tools include Ansible Works (AWX), Jenkins, RunDeck, and [ARA][5], which offers [traceability when running playbooks][6].
### CFEngine
"CFEngine 3 is a popular open source configuration management system. Its primary function is to provide automated configuration and maintenance of large-scale computer systems." —[GitHub repository][7]
CFEngine was introduced by Mark Burgess in 1993 as a scientific approach to automated configuration management. The goal was to deal with the entropy in computer systems' configuration and resolve it with end-state "convergence." Convergence means a desired end-state and elaborates on idempotence as a capacity to reach the desired end-state. Burgess' research evolved in 2004 when he proposed the [Promise theory][8] as a model of voluntary cooperation between agents.
The current version of CFEngine incorporates Promise theory and uses agents running on each server that pull the configuration from a central repository. It requires some expert knowledge to deal with configurations, so it's best suited for technical people.
### Chef
"A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure." —[GitHub repository][9]
Chef uses "recipes" written in Ruby to keep your infrastructure running up-to-date and compliant. The recipes describe a series of resources that should be in a particular state. Chef can run in client/server mode or in a standalone configuration named [chef-solo][10]. It has good integration with the major cloud providers to automatically provision and configure new machines.
Chef has a solid user base and provides a full toolset to allow people with different technical backgrounds and skills to interact around the recipes. But, at its base, it is more technically oriented tool.
### Puppet
"Puppet, an automated administrative engine for your Linux, Unix, and Windows systems, performs administrative tasks (such as adding users, installing packages, and updating server configurations) based on a centralized specification." —[GitHub repository][11]
Conceived as a tool oriented toward operations and sysadmins, Puppet has consolidated as a configuration management tool. It usually works in a client-server architecture, and an agent communicates with the server to fetch configuration instructions.
Puppet uses a declarative language or Ruby to describe the system configuration. It is organized in modules, and manifest files contain the desired-state goals to keep everything as required. Puppet uses the push model by default, and the pull model can be configured.
### Salt
"Software to automate the management and configuration of any infrastructure or application at scale." — [GitHub repository][12]
Salt was created for high-speed data collection and scale beyond tens of thousands of servers. It uses Python modules to handle configuration details and specific actions. These modules manage all of Salt's remote execution and state management behavior. Some level of technical skills are required to configure the modules.
Salt uses a client-server topology (with the Salt master as server and Salt minions as clients). Configurations are kept in Salt state files, which describe everything required to keep a system in the desired state.
### Conclusion
The landscape of DevOps tools is evolving all the time, and it is important to keep an eye on the changes. I hope this article will encourage you to explore these concepts and tools further. If so, the Cloud Native Computing Foundation (CNCF) maintains a good reference in the [Cloud Native Landscape Project][13].
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/12/configuration-management-tools
作者:[Marco Bravo][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/marcobravo
[b]: https://github.com/lujun9972
[1]: https://www.oreilly.com/learning/why-use-terraform
[2]: https://www.oreilly.com/library/view/infrastructure-as-code/9781491924334/ch04.html
[3]: https://github.com/ansible/ansible
[4]: https://opensource.com/article/18/8/ansible-playbooks-you-should-try
[5]: https://github.com/openstack/ara
[6]: https://opensource.com/article/18/5/analyzing-ansible-runs-using-ara
[7]: https://github.com/cfengine/core
[8]: https://en.wikipedia.org/wiki/Promise_theory
[9]: https://github.com/chef/chef
[10]: https://docs.chef.io/chef_solo.html
[11]: https://github.com/puppetlabs/puppet
[12]: https://github.com/saltstack/salt
[13]: https://github.com/cncf/landscape

View File

@ -1,139 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Hegemon A Modular System And Hardware Monitoring Tool For Linux)
[#]: via: (https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/)
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
Hegemon A Modular System And Hardware Monitoring Tool For Linux
======
I know that everybody is preferring for **[TOP Command][1]** to monitor system utilization.
Its one of the best and native command which used by vast of Linux administrators.
In Linux there is an alternative for everything respective of packages.
There are many utilities are available for this purpose in Linux and i prefer **[HTOP Command][2]**.
If you want to know about other alternatives, i would suggest you to navigate to the each link to know more about it.
Those are htop, CorFreq, glances, atop, Dstat, Gtop, Linux Dash, Netdata, Monit, etc.
All these tools only allow us to monitor system utilization and not for the system hardwares.
But Hegemon is allow us to monitor both in the single dashboard.
If you are looking for system hardware monitoring then i would suggest you to check **[lm_sensors][3]** and **[s-tui Stress Terminal UI][4]** utilities.
### Whats Hegemon?
Hegemon is a work-in-progress modular system monitor written in safe Rust.
It allow users to monitor both utilization in a single dashboard. Its system utilization and hardware temperatures.
### Currently Available Features in Hegemon
* Monitor CPU and memory usage, temperatures, and fan speeds
* Expand any data stream to reveal a more detailed graph and additional information
* Adjustable update interval
* Clean MVC architecture with good code quality
* Unit tests
### Planned Features include
* macOS and BSD support (only Linux is supported at the moment)
* Monitor disk and network I/O, GPU usage (maybe), and more
* Select and reorder data streams
* Mouse control
### How to Install Hegemon in Linux?
Hegemon is requires Rust 1.26 or later and the development files for libsensors. So, make sure these packages were installed before your perform Hegemon installation.
libsensors library package is available in most of the distribution official repository so, use the following command to install it.
For **`Debian/Ubuntu`** systems, use **[APT-GET Command][5]** or **[APT Command][6]** to install libsensors on your systems.
```
# apt install lm_sensors-devel
```
For **`Fedora`** system, use **[DNF Package Manager][7]** to install libsensors on your system.
```
# dnf install libsensors4-dev
```
Run the following command to install Rust programming language and follow the instruction. Navigate to the following URL if you want handy tutorials for **[Rust installation][8]**.
```
$ curl https://sh.rustup.rs -sSf | sh
```
If you have successfully installed Rust. Run the following command to install Hegemon.
```
$ cargo install hegemon
```
### How to Lunch Hegemon in Linux?
Once you successfully install Hegemon package. Run run the below command to launch it.
```
$ hegemon
```
![][10]
I was facing an issue when i was launching the “Hegemon” application due to libsensors.so.4 libraries issue.
```
$ hegemon
error while loading shared libraries: libsensors.so.4: cannot open shared object file: No such file or directory manjaro
```
Im using Manjaro 18.04. It has the libsensors.so & libsensors.so.5 shared libraries and not for libsensors.so.4. So, i just created the following symlink to fix the issue.
```
$ sudo ln -s /usr/lib/libsensors.so /usr/lib/libsensors.so.4
```
Here is the sample gif file which was taken from my Lenovo-Y700 laptop.
![][11]
By default it shows only overall summary and if you would like to see the detailed output then you need to expand the each section. See the expanded output with Hegemon.
![][12]
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/
作者:[Magesh Maruthamuthu][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.2daygeek.com/author/magesh/
[b]: https://github.com/lujun9972
[1]: https://www.2daygeek.com/top-command-examples-to-monitor-server-performance/
[2]: https://www.2daygeek.com/linux-htop-command-linux-system-performance-resource-monitoring-tool/
[3]: https://www.2daygeek.com/view-check-cpu-hard-disk-temperature-linux/
[4]: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/
[5]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
[6]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
[7]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
[8]: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/
[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-1.png
[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-2a.gif
[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-3.png

View File

@ -1,156 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Commands to help you monitor activity on your Linux server)
[#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html)
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
Commands to help you monitor activity on your Linux server
======
The watch, top, and ac commands provide some effective ways to oversee what is happening on your Linux servers.
![](https://images.idgesg.net/images/article/2019/01/owl-face-100785829-large.jpg)
Linux systems provide a number of commands that make it easy to report on system activity. In this post, we're going to look at several commands that are especially helpful.
### The watch command
The **watch** command is one that makes it easy to repeatedly examine a variety of data on your system — user activities, running processes, logins, memory usage, etc. All the command really does is run the command that you specify repeatedly, each time overwriting the previously displayed output, but this lends itself to a very convenient way of monitoring what's happening on your system.
To start with a very basic and not particularly useful command, you could run **watch -n 5 date** and see a display with the current date and time that updates every 5 seconds. As you likely have guessed, the **-n 5** option specifies the number of seconds to wait between each run of the command. The default is 2 seconds. The command will run and update a display like this until you stop it with a ^c.
```
Every 5.0s: date butterfly: Wed Jan 23 15:59:14 2019
Wed Jan 23 15:59:14 EST 2019
```
As a more interesting command example, you can watch an updated list of whoever is logging into the server. As written, this command will update every 10 seconds. Users who log out will disappear from the current display and those who log in will come into view. If no one is logging in or out, the display will remain the same except for the time displayed.
```
$ watch -n 10 who
Every 10.0s: who butterfly: Tue Jan 23 16:02:03 2019
shs :0 2019-01-23 09:45 (:0)
dory pts/0 2019-01-23 15:50 (192.168.0.5)
nemo pts/1 2019-01-23 16:01 (192.168.0.15)
shark pts/3 2019-01-23 11:11 (192.168.0.27)
```
If you just want to see how many users are logged in, you can get a user count along with load averages showing you how hard the system is working by having watch call the **uptime** command.
```
$ watch uptime
Every 2.0s: uptime butterfly: Tue Jan 23 16:25:48 2019
16:25:48 up 22 days, 4:38, 3 users, load average: 1.15, 0.89, 1.02
```
If you want to use watch to repeat a command that includes a pipe, you need to put the command between quote marks like this command that every 5 seconds shows you how many processes are running:
```
$ watch -n 5 'ps -ef | wc -l'
Every 5.0s: ps -ef | wc -l butterfly: Tue Jan 23 16:11:54 2019
245
```
To watch memory usage, you might try a command like this one:
```
$ watch -n 5 free -m
Every 5.0s: free -m butterfly: Tue Jan 23 16:34:09 2019
total used free shared buff/cache available
Mem: 5959 776 3276 12 1906 4878
Swap: 2047 0 2047
```
You could watch processes being run by one particular user with **watch,** but the **top** command provides a much better option.
### The top command
If you want to watch one particular user's processes, top has an ideal option for you — the -u option:
```
$ top -u nemo
top - 16:14:33 up 2 days, 4:27, 3 users, load average: 0.00, 0.01, 0.02
Tasks: 199 total, 1 running, 198 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 5959.4 total, 3277.3 free, 776.4 used, 1905.8 buff/cache
MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4878.4 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23026 nemo 20 0 46340 7820 6504 S 0.0 0.1 0:00.05 systemd
23033 nemo 20 0 149660 3140 72 S 0.0 0.1 0:00.00 (sd-pam)
23125 nemo 20 0 63396 5100 4092 S 0.0 0.1 0:00.00 sshd
23128 nemo 20 0 16836 5636 4284 S 0.0 0.1 0:00.03 zsh
```
You not only see what processes the user is running, but the resources (CPU time and memory) that the process is consuming and how hard the system is working overall.
### The ac command
If you'd like to see how much time each of your users is spending logged in, you can make use of the **ac** command. This requires installation of the **acct** (Debian) or **psacct** (RHEL, Centos, etc.) package.
The **ac** command has a number of options, but it pulls its data from the current **wtmp** file. Here's an example showing the total number of hours users were logged in recently:
```
$ ac
total 1261.72
```
This command shows total hours by user:
```
$ ac -p
shark 5.24
nemo 5.52
shs 1251.00
total 1261.76
```
This ac command shows daily counts of how many hours users were logged in:
```
$ ac -d | tail -10
Jan 11 total 0.05
Jan 12 total 1.36
Jan 13 total 16.39
Jan 15 total 55.33
Jan 16 total 38.02
Jan 17 total 28.51
Jan 19 total 48.66
Jan 20 total 1.37
Jan 22 total 23.48
Today total 9.83
```
### Wrap-up
There are many commands for examining system activity. The **watch** command allows you to run just about any command in a repetitive way and watch how the output changes. The **top** command is a better option for focusing on user processes and also loops in a way that allows you to see the changes as they happen, while the **ac** command examines user connect time.
Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind.
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html
作者:[Sandra Henry-Stocker][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
[b]: https://github.com/lujun9972
[1]: https://www.facebook.com/NetworkWorld/
[2]: https://www.linkedin.com/company/network-world

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (HankChow)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,99 @@
快速开发游戏的十个关键
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb)
十月早些时候Opensource.com赞助的 [Open Jam][1] 入职仪式为处于世界各地的团队设立了45个入口。这些队伍只有三天时间用开源软件制作出一个游戏来参与角逐并 [取前三][2]。
我们在大学为每一位愿意参与的人举办了我们自己的 Open Jam 活动。周末预留了计算机实验室教大家使用开源软件——游戏引擎:[Godot][3],音乐:[LMMS][4] 2D画面 [GIMP][5] 和3D画面 [Blender][6] ——来创作游戏和相关组件。活动产出了三个游戏: [Loathsome][7] [Lost Artist][8], 和 [Paint Rider][9] (我做的)。
总的说来,我从游戏创作和游戏开发中,学到了十课关于游戏引擎、代码和快速游戏开发。
## 1\. 限定规模
很容易想要去做一个规模宏大的冒险游戏或者比拟你最喜欢的游戏的东西。追求高于游戏创作之外的东西可能很酷,如果你有体会,但不要高估自己拥有的时间。我欣赏游戏创作的一点是强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要。
Open Jam 的主题是“留下痕迹”题目一出来我和朋友就开始讨论什么样的游戏合题意。有个想法就是做玩家能在敌人身上留下伤痕的3D拳击游戏。我几乎没有做3D游戏的经验我想做好的话在我甚至还没发掘出可玩性之前就得花太多时间在学习如何让痕迹合理和打击有效。
## 2\. 尽早可玩
对游戏创作我最中肯的建议就是这。试着做出核心部件,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,才让你的游戏可玩。像 Open Jam 这样的三天创作,最好少花时间在实现概念上。
## 3\. 保持简单
你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏创作中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能强大。
## 4\. 从其他游戏获取灵感
可能你想做出完全原创的作品,但作品的原型极其有用。原型将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,自然你也能从再创作其他人的作品中很好地练习。
考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得这款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。大概一两个小时的创作,我有了基本模型,用一个按钮上下移动和留下小黑圈的痕迹。
## 5\. 不要忽视可得性
确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷但几乎没有人可以玩因为拥有VR设备的人不多。所幸它的开发者并不期望取得好名次只是想练手。但如果你想和人们分享你的游戏或者赢得游戏创作注意可得性是很重要的。
Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有浏览器版本将支持大多数人玩。但尽你所能去发布在更多的平台和开放系统上。我甚至试着在移动端发布 Paint Rider ,但技术有限。
## 6\. 不要做得太难
如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。这照应了保持简单和限定规模,在游戏计划阶段非常重要。再次重申,想做一个宏大的游戏花上十天半个月开发很容易;难的是做出好玩、简单的游戏。
给妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。
## 7\. 不用太整洁
如果你习惯于花时间在设计每处图案和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。
这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型直到找出值得做成完整游戏的,然后你潜心建立完美的代码基础来支持它。游戏创作的开发游戏就像快速码出可验证的理念。
## 8\. 但也不要太随意
另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎用脑中的设计图建成。就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点——这是你的设计自动成型的[观测图][14]。 只要你知道如何利用游戏引擎的特性,就可以快速写代码,你的代码也不会特别难读。
## 9\. 取得反馈
向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你期望之外的事。如果游戏创作有[争论][15] 频道或者类似的,把你的游戏放上去,人们会反馈你的想法。 Paint Rider 的定义功能之一是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个设置。
团队协作的话,确保有其他可以传递周围反馈的人参与这个开发。
而且不要忘了用相同的方式帮助其他人;如果你在玩其他人游戏的时候发现了有助于你游戏的东西,这就是双赢。
## 10\. 哪里找资源
做出所有你自己的组件真的会拖你后腿。 Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色上,你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,这里有其他选择。试着在 [Creative Commons][16] 上寻找组件或者免费音乐站点,比如 [Anttis Instrumentals][17] 。或者,可行的话,组一个有专门艺术家、作家或者音乐家的团队。
其他你可能觉得有用的软件有 [Krita][18] ,一款适合数字绘画的开源 2D 图像生成软件,特别是如果你有一块绘图板,还有 [sfxr][19] ,一款游戏音效生成软件,很多参数可以调,但正如它的开发者所说:“基本用法包括了按下随机按钮。”( Paint Rider 的所有音效都是用 Sfxr 做的。)你也可以试试 [Calinou][20] 的众多但有序的开源游戏开发软件列表。
你参加 Open Jam 或者其他游戏创作并有别的建议吗?对我未提及的有问题吗?有的话,请在评论中分享。
--------------------------------------------------------------------------------
via: https://opensource.com/article/17/12/10-keys-rapid-open-source-game-development
作者:[Ryan Estes][a]
译者:[XYenChi](https://github.com/XYenChi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/figytuna
[1]:https://itch.io/jam/open-jam-1
[2]:https://opensource.com/article/17/11/open-jam
[3]:https://godotengine.org/
[4]:https://lmms.io/
[5]:https://www.gimp.org/
[6]:https://www.blender.org/
[7]:https://astropippin.itch.io/loathsome
[8]:https://masonraus.itch.io/lost-artist
[9]:https://figytuna.itch.io/paint-rider
[10]:http://www.andkon.com/arcade/racing/lineriderbeta2/
[11]:https://itch.io/
[12]:https://en.wikipedia.org/wiki/Spaghetti_code
[13]:http://kidscancode.org/blog/2017/03/godot_101_07/
[14]:https://en.wikipedia.org/wiki/Observer_pattern
[15]:https://discordapp.com/
[16]:https://creativecommons.org/
[17]:http://www.soundclick.com/bands/default.cfm?bandID=1277008
[18]:https://krita.org/en/
[19]:http://www.drpetter.se/project_sfxr.html
[20]:https://notabug.org/Calinou/awesome-gamedev/src/master/README.md

View File

@ -0,0 +1,120 @@
[#]: collector: (lujun9972)
[#]: translator: (HankChow)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Top 5 configuration management tools)
[#]: via: (https://opensource.com/article/18/12/configuration-management-tools)
[#]: author: (Marco Bravo https://opensource.com/users/marcobravo)
五大最流行的配置管理工具
======
在寻找合适的 DevOps 工具之前,你最好要对配置管理工具有一定的了解。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M)
DevOps 正因为有提高产品质量、缩短产品开发时间等优势,目前备受业界关注,同时也在长足发展当中。
[DevOps 的核心价值观][1]是<ruby>团队文化<rt>Culture</rt></ruby><ruby>自动化<rt>Automation</rt></ruby><ruby>评估<rt>Measurement</rt></ruby><ruby>分享<rt>Sharing</rt></ruby>CAMS同时团队对 DevOps 的执行力也是 DevOps 能否成功的重要因素。
* **团队文化**让大家团结一致;
* **自动化**是 DevOps 的基础;
* **评估**保证了及时的改进;
* **分享**让 CAMS 成为一个完整的循环过程。
DevOps 的另一个思想是任何东西,包括服务器、数据库、网络、日志文件、应用配置、文档、自动化测试、部署流程等,都可以通过代码来管理。
在本文中,我主要介绍配置管理的自动化。配置管理工具作为[<ruby>基础架构即代码<rt>Infrastructure as Code</rt></ruby>][2]IaC的一部分支持使用软件进行开发实践以及通过明文定义的文件来管理数据中心。
DevOps 团队只需要通过操作简单的配置文件,就可以实现应用开发中包括版本控制、测试、小型部署、设计模式这些最佳实践。总而言是,配置管理工具实现了通过编写代码来使基础架构管理变得自动化。
### 为什么要使用配置管理工具?
配置管理工具可以提高应用部署和变更的效率,还可以让这些流程变得可重用、可扩展、可预测,甚至让它们维持在期望的状态,从而让资产的可控性提高。
使用配置管理工具的优势还包括:
* 让代码遵守编码规范,提高代码可读性;
* 具有<ruby>幂等性<rt>Idempotency</rt></ruby>,也就是说,无论执行多少次重复的配置管理操作,得到的结果都是一致的;
* 可以方便地管理分布式系统和大量的远程服务器。
配置管理工具主要分为<ruby>拉取<rt>pull</rt></ruby>模式和<ruby>推送<rt>push</rt></ruby>模式。拉取模式是指安装在各台服务器上的<ruby>代理<rt>agent</rt></ruby>定期从<ruby>中央存储库<rt>central repository</rt></ruby>拉取最新的配置并应用到对应的服务器上;而推送模式则由<ruby>中央服务器<rt>central server</rt></ruby>主动向其它服务器推送更新的配置。
### 五大最流行的配置管理工具
目前配置管理工具有很多,不同的配置管理工具都有自己最适合的使用场景。而对于下面五个我按照字母顺序列出的配置管理工具,都对 DevOps 有明显的帮助:具有开源许可证、使用外部配置文件、支持无人值守运行、可以通过脚本自定义运行。下面对它们的介绍都来源于它们的软件库和官网内容。
#### Ansible
“Ansible 是一个极其简洁的 IT 自动化平台,可以让你的应用和系统以更简单的方式部署。不需要安装任何代理,只需要使用 SSH 的方式和简单的语言,就可以免去脚本或代码部署应用的过程。”——[GitHub Ansible 代码库][3]
Ansible 是我最喜欢的工具之一,我在几年前就开始使用了。你可以使用 Ansible 在命令行中让多个服务器执行同一个命令,也可以使用 YAML 格式的 playbook 来让它自动执行特定的操作,这让技术团队和非技术团队之间的沟通变得更加明确。简洁、无代理、配置文件对非技术人员友好是它的几个主要优点。
由于 Ansible 不需要代理因此对服务器的资源消耗会很少。在默认情况下Ansible 使用的推送模式需要借助 SSH 连接,但 Ansible 也支持拉取模式。[playbook][4] 可以使用最少的命令集编写,当然也可以扩展为更加精细的自动化任务,包括引入其它角色、变量和模块。
你可以将 Ansible 和其它工具(包括 Ansible Works、Jenkins、RunDeck、[ARA][5] 等)结合起来使用,因为这些工具支持 [playbook 的回溯功能][6],这样就可以很方便地控制整个开发周期中的不同流程。
### CFEngine
“CFEngine 3 是一个流行的开源配置管理系统,它可以为大规模的系统提供自动化配置和维护。”——[GitHub CFEngine 代码库][7]
CFEngine 最早在 1993 年由 Mark Burgess 以自动配置管理的科学方法提出目的是降低计算机系统配置中的熵最终收敛到期望的配置状态同时还阐述了幂等性是让系统达到期望状态的能力。Burgess 在 2004 年又提出了<ruby>承诺理论<rt>Promise Theory</rt></ruby>,这个理论描述了代理之间自发合作的模型。
CFEngine 的最新版本已经用到了承诺理论在各个服务器上的代理程序会从中央存储库拉取配置。CFEngine 的配置对专业技能要求较高,因此它比较适合技术团队使用。
### Chef
“为整个基础架构在配置管理上带来便利的一个系统集成框架。”——[GitHub Chef 代码库][9]
Chef 通过由 Ruby 编写的“<ruby>菜谱<rt>recipe</rt></ruby>”来让你的基础架构保持在最新、最兼容的状态这些“菜谱”描述了一系列资源的某种状态。Chef 既可以通过客户端-服务端的模式运行,也可以在 [chef-solo][10] 这种独立配置的模式下运行。大部分云提供商都很好地集成了 Chef因此可以使用它为新机器做自动配置。
Chef 有广泛的用户基础,同时也提供了完备的工具包,让不同技术背景的团队可以通过“菜谱”进行沟通。尽管如此,它仍然算是一个技术导向的工具。
### Puppet
“Puppet 是可以在 Linux、Unix 和 Windows 系统上运行的自动化管理引擎,它可以根据集中的规范来执行诸如添加用户、安装软件包、更新服务器配置等等管理任务。”——[GitHub Puppet 代码库][11]
Puppet 作为一款面向运维工程师和系统管理员的工具,在更多情况下是作为配置管理工具来使用。它通过客户端-服务端的模式工作,使用代理从主服务器获取配置指令。
Puppet 使用<ruby>声明式语言<rt>declarative language</rt></ruby>或 Ruby 来描述系统配置。它包含了不同的模块,并使用<ruby>清单文件<rt>manifest files</rt></ruby>记录期望达到的目标状态。Puppet 默认使用推送模式,但也支持拉取模式。
### Salt
“为大规模基础结构或应用程序实现自动化管理的软件。”——[GitHub Salt 代码库][12]
Salt 的专长就是快速收集数据,即使是上万台服务器也能够轻松完成任务。它使用 Python 模块来管理配置信息和执行特定的操作,这些模块可以让 Salt 实现所有远程操作和状态管理。但配置 Salt 模块对技术水平有一定的要求。
Salt 使用客户端-服务端的结构Salt minions 是客户端,而 Salt master 是服务端),并以 Salt 状态文件记录需要达到的目标状态。
### 总结
DevOps 工具领域一直在发展,因此必须时刻关注其中的最新动态。希望这篇文章能够鼓励读者进一步探索相关的概念和工具。为此,<ruby>云原生计算基金会<rt>Cloud Native Computing Foundation</rt></ruby>CNCF在 [Cloud Native Landscape Project][13] 中也提供了很好的参考案例。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/12/configuration-management-tools
作者:[Marco Bravo][a]
选题:[lujun9972][b]
译者:[HankChow](https://github.com/HankChow)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/marcobravo
[b]: https://github.com/lujun9972
[1]: https://www.oreilly.com/learning/why-use-terraform
[2]: https://www.oreilly.com/library/view/infrastructure-as-code/9781491924334/ch04.html
[3]: https://github.com/ansible/ansible
[4]: https://opensource.com/article/18/8/ansible-playbooks-you-should-try
[5]: https://github.com/openstack/ara
[6]: https://opensource.com/article/18/5/analyzing-ansible-runs-using-ara
[7]: https://github.com/cfengine/core
[8]: https://en.wikipedia.org/wiki/Promise_theory
[9]: https://github.com/chef/chef
[10]: https://docs.chef.io/chef_solo.html
[11]: https://github.com/puppetlabs/puppet
[12]: https://github.com/saltstack/salt
[13]: https://github.com/cncf/landscape

View File

@ -0,0 +1,139 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Hegemon A Modular System And Hardware Monitoring Tool For Linux)
[#]: via: (https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/)
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
Hegemon - 一个 Linux 中的模块化系统和硬件监控工具
======
我知道每个人都更喜欢使用 **[top 命令][1]**来监控系统利用率。
这是被 Linux 系统管理员大量使用的原生命令之一。
在 Linux 中,每个包都有一个替代品。
Linux 中有许多可用于此的工具,我更喜欢 **[htop 命令][2]**。
如果你想了解其他替代方案,我建议你浏览每个链接了解更多信息。
它们有 htop、CorFreq、glances、atop、Dstat、Gtop、Linux Dash、Netdata、Monit 等。
所有这些只允许我们监控系统利用率而不能监控系统硬件。
但是 Hegemon 允许我们在单个仪表板中监控两者。
如果你正在寻找系统硬件监控软件,那么我建议你看下 **[lm_sensors][3]** 和 **[s-tui 压力终端 UI][4]**。
### Hegemon 是什么?
Hegemon 是一个正在开发中的模块化系统监视器, 以安全的 Rust 编写。
它允许用户在单个仪表板中监控两种使用情况。分别是系统利用率和硬件温度。
### Hegemon 目前的特性
* 监控 CPU 和内存使用情况、温度和风扇速度
  * 展开任何数据流以显示更详细的图表和其他信息
  * 可调整的更新间隔
  * 干净的 MVC 架构,具有良好的代码质量
  * 单元测试
### 计划的特性包括
* macOS 和 BSD 支持(目前仅支持 Linux
  * 监控磁盘和网络 I/O、GPU使用情况可能
  * 选择并重新排序数据流
  * 鼠标控制
### 如何在 Linux 中安装 Hegemon
Hegemon 需要 Rust 1.26 或更高版本以及 libsensors 的开发文件。因此,请确保在安装 Hegemon 之前安装了这些软件包。
libsensors 库在大多数发行版官方仓库中都有,因此,使用以下命令进行安装。
对于 **`Debian/Ubuntu`** 系统,使用 **[apt-get 命令][5]** 或 **[apt 命令][6]** 在你的系统上安装 libsensors。
```
# apt install lm_sensors-devel
```
对于 **`Fedora`** 系统,使用 **[dnf 包管理器][7]**在你的系统上安装 libsensors。
```
# dnf install libsensors4-dev
```
运行以下命令安装 Rust 语言,并按照指示来做。如果你想要看 **[Rust 安装][8]**的方便教程,请进入这个 URL。
```
$ curl https://sh.rustup.rs -sSf | sh
```
如果你已成功安装 Rust。运行以下命令安装 Hegemon。
```
$ cargo install hegemon
```
### 如何在 Linux 中启动 Hegemon
成功安装 Hegemon 包后,运行下面的命令启动。
```
$ hegemon
```
![][10]
由于 libsensors.so.4 库的问题,我在启动 “Hegemon” 时遇到了一个问题。
```
$ hegemon
error while loading shared libraries: libsensors.so.4: cannot open shared object file: No such file or directory manjaro
```
我使用的是 Manjaro 18.04。它存在 libsensors.so 和 libsensors.so.5 共享库,而没有 libsensors.so.4。所以,我刚刚创建了以下符号链接来解决问题。
```
$ sudo ln -s /usr/lib/libsensors.so /usr/lib/libsensors.so.4
```
这是从我的 Lenovo-Y700 笔记本中截取的示例 gif。
![][11]
默认它仅显示总体摘要,如果你想查看详细输出,则需要展开每个部分。使用 Hegemon 查看展开内容。
![][12]
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/
作者:[Magesh Maruthamuthu][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.2daygeek.com/author/magesh/
[b]: https://github.com/lujun9972
[1]: https://www.2daygeek.com/top-command-examples-to-monitor-server-performance/
[2]: https://www.2daygeek.com/linux-htop-command-linux-system-performance-resource-monitoring-tool/
[3]: https://www.2daygeek.com/view-check-cpu-hard-disk-temperature-linux/
[4]: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/
[5]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
[6]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
[7]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
[8]: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/
[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-1.png
[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-2a.gif
[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-3.png

View File

@ -0,0 +1,157 @@
[#]: collector: (lujun9972)
[#]: translator: (dianbanjiu )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Commands to help you monitor activity on your Linux server)
[#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html)
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
监控 Linux 服务器的几个常用命令
======
watch、top 和 ac 命令为我们监视 Linux 服务器上的活动提供了一些十分高效的途径。
![](https://images.idgesg.net/images/article/2019/01/owl-face-100785829-large.jpg)
为了在获取系统活动时更加轻松Linux 系统提供了一系列相关的命令。在这篇文章中,我们就一起来看看这些对我们很有帮助的命令吧。
### watch 命令
**watch** 是一个使得重复检测 Linux 系统中一系列数据,例如用户活动、正在运行进程、登录、内存使用等更加容易的命令。这个命令实际上是重复地运行一个特定的命令,每次都会重写之前显示的输出,它提供了一个比较方便的方式用以监测在你的系统中发生的活动。
首先以一个基础且不是特别有用的命令开始,你可以运行 `watch -n 5 date`,然后你可以看到在终端中显示了当前的日期和时间,这些数据会每五秒更新一次。你可能已经猜到了,**-n 5** 选项指定了运行接下来一次命令需要等待的秒数。默认是 2 秒。这个命令将会一直运行并按照指定的时间更新显示,直到你使用 ^C 停下它。
```
Every 5.0s: date butterfly: Wed Jan 23 15:59:14 2019
Wed Jan 23 15:59:14 EST 2019
```
下面是一个很有趣的命令实例,你可以监控一个在服务器中登录用户的列表,该列表会按照指定的时间定时更新。就像下面写到的,这个命令会每 10 秒更新一次这个列表。登出的用户将会从当前显示的列表中消失,那些新登录的将会被添加到这个表格当中。如果没有用户再登录或者登出,这个表格跟之前显示的将不会有任何不同。
```
$ watch -n 10 who
Every 10.0s: who butterfly: Tue Jan 23 16:02:03 2019
shs :0 2019-01-23 09:45 (:0)
dory pts/0 2019-01-23 15:50 (192.168.0.5)
nemo pts/1 2019-01-23 16:01 (192.168.0.15)
shark pts/3 2019-01-23 11:11 (192.168.0.27)
```
如果你只是想看有多少用户登录过,可以通过 watch 调用 **uptime** 命令获取用户数和负载的平均水平,以及系统的工作状况。
```
$ watch uptime
Every 2.0s: uptime butterfly: Tue Jan 23 16:25:48 2019
16:25:48 up 22 days, 4:38, 3 users, load average: 1.15, 0.89, 1.02
```
如果你想使用 watch 重复一个包含了管道的命令,就需要将该命令用引号括起来,就比如下面这个每五秒显示一次有多少进程正在运行的命令。
```
$ watch -n 5 'ps -ef | wc -l'
Every 5.0s: ps -ef | wc -l butterfly: Tue Jan 23 16:11:54 2019
245
```
要查看内存使用,你也许会想要试一下下面的这个命令组合:
```
$ watch -n 5 free -m
Every 5.0s: free -m butterfly: Tue Jan 23 16:34:09 2019
total used free shared buff/cache available
Mem: 5959 776 3276 12 1906 4878
Swap: 2047 0 2047
```
你可以在 **watch** 后添加一些选项查看某个特定用户下运行的进程,不过 **top** 为此提供了更好的选择。
### top 命令
如果你想查看某个特定用户下的进程top 命令的 `-u` 选项可以很轻松地帮你达到这个目的。
```
$ top -u nemo
top - 16:14:33 up 2 days, 4:27, 3 users, load average: 0.00, 0.01, 0.02
Tasks: 199 total, 1 running, 198 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 5959.4 total, 3277.3 free, 776.4 used, 1905.8 buff/cache
MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4878.4 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23026 nemo 20 0 46340 7820 6504 S 0.0 0.1 0:00.05 systemd
23033 nemo 20 0 149660 3140 72 S 0.0 0.1 0:00.00 (sd-pam)
23125 nemo 20 0 63396 5100 4092 S 0.0 0.1 0:00.00 sshd
23128 nemo 20 0 16836 5636 4284 S 0.0 0.1 0:00.03 zsh
```
你可能不仅可以看到某个用户下的进程,还可以查看每个进程所占用的资源,以及系统总的工作状况。
### ac 命令
如果你想查看系统中每个用户登录的时长,可以使用 **ac** 命令。运行该命令之前首先需要安装 **acct**(Debian 等) 或者 **psacct**(RHEL、Centos 等) 包。
**ac** 命令有一系列的选项,该命令从 **wtmp** 文件中拉取数据。这个例子展示的是最近用户登录的总小时数。
```
$ ac
total 1261.72
```
这个命令显示了用户登录的总的小时数:
```
$ ac -p
shark 5.24
nemo 5.52
shs 1251.00
total 1261.76
```
这个命令显示了用户每天登录的小时数:
```
$ ac -d | tail -10
Jan 11 total 0.05
Jan 12 total 1.36
Jan 13 total 16.39
Jan 15 total 55.33
Jan 16 total 38.02
Jan 17 total 28.51
Jan 19 total 48.66
Jan 20 total 1.37
Jan 22 total 23.48
Today total 9.83
```
### 总结
Linux 系统上有很多命令可以用于检查系统活动。**watch** 命令允许你以重复的方式运行任何命令,并观察输出有何变化。**top** 命令是一个专注于用户进程的最佳选项,以及允许你以动态方式查看进程的变化,还可以使用 **ac** 命令检查用户连接到系统的时间。
加入 [Facebook][1] 和 [LinkedIn][2] 上的 Network World 社区,来交流更多有用的主题。
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html
作者:[Sandra Henry-Stocker][a]
选题:[lujun9972][b]
译者:[dianbanjiu](https://github.com/dianbanjiu)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
[b]: https://github.com/lujun9972
[1]: https://www.facebook.com/NetworkWorld/
[2]: https://www.linkedin.com/company/network-world