📜 ⬆️ ⬇️

Color coding servers

When servers are few, they are very personal. This is the TOT server. And this is a completely different server . This attitude can only be to unique servers with a specific configuration and role (roles). In the conditions of mass use of servers, no personal component can be distinguished, because if the servers have the same configuration, then it is very difficult to distinguish between them. This is especially noticeable in terms of clusters, storage, access-level switches and virtualization hosts.

The situation is further complicated after test configurations appear, similar to workers. Operations that are common to tests can have fatal consequences for the product (package installation, reboot, re-creation of addressing objects, etc.).

It is clear that "you need to think with your head." But it is always better to be warned once again. And the simplest solution is to use color coding.
All Hail Britania!

linux / bsd

The obvious place for color coding is PS1 (request to enter a command).

For example, in my PS1 cloud on the server, the color automatically changes depending on whether the host is in the product pool or not - in the .bash_profile check of the pool type is registered and if the pool has the product attribute, it sets the color to red, and if testing, then green. At the same time, new pools, which are not included anywhere, obviously have a “gray” color. There also (in PS1, the pool number is coded and a sign that the host is a pool master). This is in addition to the hostname itself, which also has a deep meaning. I once wrote about this a long time ago.

Here is an example of a colored command promt. Pay attention to the additional square brackets around the ESC codes, if they are not put, then the text positioning flies near the tower (in particular, the history output and the Home / End buttons break down). quote from .bashrc:
 pr = "\ [\ e [1; 31m \]"
 end = "\ [\ e [0m \]"
 export PS1 = "$ pr \\ h \\ W \\ $ $ end"

This gives a bold red color in the command-prompt. Other colors are described in man console_codes (pr - esc-code to turn on color, end - to turn off).

The essential issue is the use of the “own” colors of the window background. In principle, xterm supports changing the “global” properties (for example, changing the palette) - locally I would not advise going somewhere outside the command line. Quite often, applications send commands to reset color modes, and this will lead to unpleasant gaps in the background color.


Yes, I administered some Windows. Here are the memories from the nightmarish past: the easiest way to color-code a server is through color. Since it is almost always visible on the screen, the “tone” of the design elements automatically tells you which server you are on. In the picture, for example, exchange (sand), server with mssql (purple) and terminal server (green) are visible. And in the background is a typical console with a shell on a linux server.

Source: https://habr.com/ru/post/107038/

All Articles