Automated administration systems, review problems and solution. Ed Wilson

the following translation of part of Chapter 1 of the book Powershell and WMI. Highlights the direction of development of information systems with regard to system administration. Given view Ed Wilson on the problems of the system owner, specifies the direction of reducing costs of infrastructure maintenance.

/ >

Solving administrative challenges


Ask any Windows administrator about his problems, and at the top of the list will be a lot of work and constant lack of time to do it. They know about the automation, perhaps even aware of the capabilities of WMI and Powershell, but they don't have time to master these technologies. This is a shameful situation, because it is considered that up to 70% of it budgets are spent on organizations that "everything to be in working condition" (note of the translator: in the original "keep the lights on."). Automation can reduce the cost of the 70%, this will free up your time and money for tasks further down the list of "problems".

It's also possible that they were interested in WMI or Powershell, and came to the conclusion that these tools are too difficult to learn. This is understandable, especially given the complexity of working with WMI via VBScript, and the lack of examples that would explain the techniques used. Even I horrified some examples of Powershell scripts posted online, what feel those who have just started to understand with this theme. Administrators, rejecting the use of these tools miss the opportunity to reduce their workload, missing the opportunity to carry out the automation of its processes.

To lower the bar of entry to using WMI the goal of this book. The examples provided can be used without modification or with minimal number of them. In addition, you will receive a deeper understanding of WMI, which can be used to operate the areas previously unavailable to your control. PowerShell is designed to make using WMI easier and more intuitive than scripting languages earlier, PowerShell automation engine from Microsoft, which, among other things, provides easier access to rich sets of management tools that are available in WMI.

Together PowerShell and WMI provide a set of proven methods that will allow you to manage your system easily and quickly. You can automate many of the standard tasks that currently consume too much of your attention.

First, we describe the problem facing the modern system administrator.
There are a number of issues that affect any Windows environment, a significant amount of
the
    the
  • Increase the number of systems
  • the
  • Increasing complexity
  • the
  • Increasing the speed of change

In the second part of the Chapter, I'll show you why PowerShell and WMI provide a great toolset for solving these problems. Benefiting from PowerShell assumes a modest initial investment of time to study, especially when using WMI. Having studied the language and automate your daily processes, you can achieve a great return on time spent on the learning process.

The Chapter concludes with two examples demonstrating the power of this combination technology. The first example shows how you can disable all servers in the data center with one command, and the second shows how you can test settings on many machines in one pass.

Let's start with the responsibilities of a modern Windows administrator and the problems it faced.

1.1 Administrative tasks


Administrators are very busy people. They always seem to have to do more with fewer resources. Figure 1.1 on the left we see a graph of cost reduction, hardware. For example, I recently bought a laptop with a 4 core processor (HyperThreading allows you to see eight cores) and 16 GB of RAM, I'm going to use it as their mobile laboratory. Now, a few years ago, the machine with these settings was in the mid-range servers, not laptops!
image

The same is true for servers with 4, 8 or even 10 core processors. In computers you can install more memory is relatively cheap. This means that an increasing number of companies can afford to run applications and business processes, which were previously used only by large corporations with huge it budgets.

Cheaper power equipment leads to the other two charts, they reflect the steep growth of the infrastructure and even faster growth in administrative expenses to maintain it in working condition. Increasingly complex infrastructure and the increasing costs of it is at the moment the main problem of it departments.

For budget cuts need to break the curve of rising operating costs and PowerShell with WMI will help you with this. For starters, let's see where there is complexity and increase administration costs?

1.1.1. Too many cars
If you really need every server you've created? Many, if not most organizations have too many servers. This happens for several reasons:

the
    the
  • reducing the cost of the hardware power – this leads to the fact that when the load is high it is easier to buy a new server than to seek how to optimize available.
  • the
  • Self-procurement Department or procurement for projects – this is due to the issues of servers, departments or "proektika" don't want on their servers, someone "sat". They do not wish to provide others their resources.
  • "One application – one server" — separating applications so that a problem in one does not affect the other, this rule can still operate for business-critical applications but not necessarily for second-or third-tier applications. And of course, it is not necessary for the purposes of testing and training. the

  • Slow reaction or rigidity of the it departments – the lack of control and neglect of the processes in it Department leads to confusion in projects and random system changes.


The administration overhead is growing faster than the growth rate of power machines due to the time that they need to spend on switching between machines (you typically need to make a new dial-up connection), the additional complexity each machine and its applications are brought into the life of the system administrator.
Virtualization running at full speed also makes his own. There are several advantages of virtualization:
the
    the
  • Reduced the number of physical servers
  • the
  • Reduced requirement for data center organizations, including the space, power and cost for air conditioning
  • the
  • or More accurately use the power of physical assets, leading to greater return of investment

The organization as a whole benefits from virtualization, but the load of the administrator increases. If you had 100 servers to virtualization, and you have established instead of 4 physical host and avirtually on 100 servers, you will only have 104 of the system you want to manage. In addition there are 4 more difficulty levels will increase due to the fact that the virtualization platform may introduce a different operating system in the infrastructure or add new tools. The increase in the total (physical plus virtual) systems, also means that increases the likelihood of accidents, during the evolution of the infrastructure.

1.1.2 too many changes


The change can be seen as the worst headache of the administrator. Unfortunately the environment is not static, changes occur always:
the
    the
  • Operating system and applications receive regular patches
  • the
  • there are new versions of programs
  • the
  • storage Space needs to be reconfigured to meet changing typical user tasks.
  • a Typical scenario, applications require hardware changes or hardware upgrades.


These problems come on top of dozens, hundreds or even thousands of machines, imposed on daily activities, such as monitoring and backups.
This situation cannot continue indefinitely. The company can't mitigate the growing cost of administration of today's economic realities prohibit the use of alternative mechanisms such as an infinite increase in income to not notice the rising costs of it departments. The situation should be solved by reducing operating costs, but administrators can't do it due to the fact that many changes bring new technologies are not reducing the load and so it is infinite.

1.1.3 Increasing complexity


Complexity is a real problem. It occurs because of several reasons:
the
    the
  • Multiple operating systems, have different sets of tools and terminology, the difference is even between two versions of Windows.
  • the
  • Various types of applications, such as databases, email, Active Directory, and web applications, require different skills, different tools have different requirements and pose different loads on the server.
  • the
  • Many machines perform the same or similar roles, but invisible features in their implementation, undocumented features increase the likelihood of error and make the structure more complicated.

Complexity also increases because of the incompleteness of knowledge and skills of administrators themselves. Too often, the project introduces a new technology and system administrators is expected that they will immediately pick up and begin to control the system. They have the necessary skills? If they have time to study the intricacies of the introduced technology? Unfortunately, the answer to both questions is often negative.
The administrator in this situation, take the only right decision – he will begin to do so as best he can. Sometimes, if the new technology is a version change from something already, the administrator will continue to use the old methods, even if the new version has a much better way to perform the task.

The lack of skills and knowledge leads to mistakes and these mistakes cost money, they can often be treated as a loss of revenue for the organization. This puts under stress administrators and leads to distrust on the part of the management of the business. The it Department is often excluded from discussions about the introduction of new technologies, too late he finds out that the management decided to change their environment and the cycle of errors repeated again.
In addition, little are big changes introduced by the projects, system administrators are faced with many little changes needed to keep the environment safe and provide stability.

1.2 automation – the path to breakthrough


A solution to overcome these problems is to automate routine operations. To instruct the machine to do simple, repetitive work that's what we made them!

Automation is understood in different ways. The following is the hierarchy of automation.

image

To implement the level above the this hierarchy need to answer the question – "can I benefit from switching to a more difficult level?". I know a number of organizations that lack the functionality of standard Windows tools and some tools mass mailing commands (approx. translator: I do not know how to accurately translate "a few bulk-editing tools"). Others are trying to use task scheduler or even create responses to events in the log. Automation for most organizations is a mixture of command line tools, scripts, and tasks in the scheduler.

The next question is "How can we automate my administrative tasks?". PowerShell provides a set of command-line tools (called "cmdlets") that can be used interactively by entering in the console. As the complexity of tasks becomes more and more ambitious, is the appearance of scripts. In PowerShell you can use some commands, one writing and one style to the command line and in scripting.
PowerShell is a wonderful tool (Yes, I'm a fan of PowerShell). If necessary, you can easily upgrade to the next level of complexity, and so on, and WMI will be at the top of this lestnicy. (note of the translator. Richard Siddaway's book, "powershell in depth" he wrote "if you don't use WMI in conjunction with powershell, Yes, you lose 60% of capacity"). WMI will give You access to a standard set of management tools system that you can use locally or on a remote machine, potentially you can even work with non-Windows systems (approx. interpreter he means CIM). Scripts can be run interactively or can be scheduled on time. But before we get into details we need to look at automation as a whole.

In this book, we will concentrate on scenarios as a means of automation. Of course, you could do a lot from the command line when connecting to remote machines. However, the advantage of scenarios is that you can use the code repeatedly, each time saving you time on writing and debugging code. This topic is discussed in detail in Chapter 4 of the book "PowerShell in practice" published by Manning in 2010. Scheduled tasks and "automatic behavior" is too heavily dependent on your specific infrastructure, in Chapter 3 we start to consider how you can make automatic responses to events occurring in your system.

Let's look at an example. Suppose you need to determine the amount of free disk space With multiple machines in your environment. One of the ways is to come to the datacenter to connect to each machine in turn and view the free space of drive C. to Record the answer and repeat for the next machine.
A little easier option is to use RDP to connect to each machine and manually download the information. So you won't get out of their Desk. But you still have to do lots of little actions, you still lose too much time.
And the decision that I like to use for this purpose the PowerShell code shown in listing 1.1. Don't worry if you right now don't understand it. We will revisit this scenario in Chapter 6 when we look at how to manage the disk subsystem.

The example starts with a list of computer names my lab. This list is passed by conveyor to the ForEach-Object (foreach) which causes Get-WmiObject for each server from the list with the query data on the logical drive C. Then, the resulting information is formatted and displayed in a table

Listing 1.1 to Determine the free disk space

the
"dc02", "W08R2CS01", "W08R2CS02", "W08R2SQL08", "W08R2SQL08A", "WSS08" |  foreach  {
Get-WmiObject -Class Win32_LogicalDisk -ComputerName $_ -Filter "DeviceId='C:'" } |
Format-Table SystemName, @{Name="Free"; Expression={[math]::round($($_.FreeSpace/1GB), 2)}} -auto 


The free space is recalculated from bytes to GB to make the results more understandable. Notice that PowerShell understands GB reduction, as well as KB, MB, TB and PB.

The result of the script looks like the following:

the
SystemName Free
---------- ----
W08R2CS01 119.04
W08R2CS02 118.65
W08R2SQL08 114.8
W08R2SQL08A 115.17
WSS08 111.41
DC02 118.53


A number of improvements you can make to this script:
the
    the
  • Place the computer names in a CSV file (as we do in listing 1.4)
  • the
  • Add the result of the work in Excel, or a database so you can see the trend in disk space
  • the
  • to Schedule a task in task scheduler

I have this scenario with the first two improvements. He regularly reports the disk space, you can see trends. After writing I have a tool which can be run for a few seconds, will query each machine myself and return information. In which case I can finish it

It took me a few minutes to write it and I save time when I run it again and again. This way PowerShell helps to save time. Jeffrey Snover, architect of PowerShell, wrote — "I firmly believe that the economy determines what people do and what they don't. PowerShell is designed from the ground up to be extensible, high-level, task-oriented abstraction, which helps to reduce administration costs and support." The full text of his article, (there is already translated) "the Semantic gap" available on the Windows Powershell blog at blogs.msdn.com/b/powershell do a search for the word "semantic gap" and you will come across this article.
a comment of the translator here, me skipped a few sections


1.3.3 to Break growth curve


Figure 1.1. we have seen the continuous increase in the complexity of the organization and administration costs. This continuous increase of complexity and costs sooner or later lead to loss of balance and stop the growth of management costs, need a way to break down this growth.

PowerShell can help stop the growth of spending, providing the following:
the
    the
  • provides a set of tools for interactive work with server and applications
  • the
  • Works on all Windows systems (note of the translator: in the original, applied the word accurate estate transfer – estate holdings. Means that it's a core Microsoft technology, and all systems somehow have cmdlets)
  • Provides one generic approach is to work with different systems (note of the translator: all the cmdlets odnoobrazny do not need to study the list of keys console utility) the

  • Built-in remote management capabilities
  • the
  • Built-in capabilities for further complicating automation

PowerShell methods to increase productivity and efficiency. And with PowerShell and WMI you can count on to further improve your height control system.

P/S/ a bottom line: if your infrastructure is facing increasing complexity, you should think about moving to a new level of automation. I hear a lot from friends about the complexity of the infrastructure, the constant pressure from marketing departments, constant change in systems. Personally, I feel the pressure, now looking for a way to create automated bots for admin tasks.
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

Monitoring PostgreSQL with Zabbix

PostgreSQL load testing using JMeter, Yandex.Tank and Overload

MODX Revolution meets Fenom