SCOM SDK – PowerShell – Creating monitor

 

icon_sdkOne of my customers wanted to monitor a 3rd party solution by monitoring events and asked if it`s possible with SCOM. As you probably know it`s one of the easiest tasks in SCOM to create monitors to monitor events on event viewer for specific or bunch of servers.

I was told to send them instructions to create a monitor based on Windows events. I started to get screenshots from create management pack and create monitor wizards, and then creating a group for the servers need to be monitored and finally overriding my monitor to enable monitoring for this specific computer group. At the end I realized it was about 30 page screenshots. Instead of sending these screenshots I though it would be much easier and sexy to send them a single PowerShell script to create a monitor. I thought SCOM Shell would have these cmdlets.

I was wrong.

Unfortunately, SCOM Shell doesn`t have any supported shell to create a unit monitor for Windows events. Then I decided to check SCOM SDK.

https://msdn.microsoft.com/en-us/library/hh329086.aspx

That was the first time for me to deal with SDK with PowerShell. SDK is much more powerful than PowerShell but you need to figure out how to deal with objects and methods.

There is an example to create a unit monitor by using SCOM SDK but as you may realize it`s written in C#. That was a good starting point for me.

https://msdn.microsoft.com/en-us/library/hh329015.aspx

So I started my journey, spent couple of hours to create my PowerShell script that uses SCOM SDK binaries. You can find the script below.

Please note that this is really an ugly script, no error handling, structure or sexy functions. This is just a sample to deal with SDK. If you are interested in to learn how to deal with SDK using PowerShell, it`s a good chance to open my script and C# example and see the integration between them.

Also SCOM MVP Tao Yang has done great job with Automating OpsMgr series on his blog http://blog.tyang.org/ .

He also shared with me an article yet to be written regarding monitor creation using SDK. It`s much more better than my ugly script 🙂 So if you need more details, follow Tao`s automation series.

My ugly script:

https://onedrive.live.com/redir?resid=3CAAB02B9CC620D5!57641&authkey=!AKbaImed7116Ig8&ithint=file%2cps1

 

The Power of Automation

 

IT automation has always been one of the most important goal of IT managers to make their organization run efficiently. Automation simply ensures that all resources will be allocated according to business needs dynamically.

Hu wrote a post on HDS community where he talked about typical break down of IT budgets.

https://community.hds.com/community/innovation-center/hus-place/blog/2015/04/23/software-defined-infrastructure-enables-greater-innovation-in-it

 

ITSpending

I also found another diagram on Gartner`s IT metrics report that shows us organizations are spending %66 of their time and budget to just “run the business”

Gartner IT Metric Report

These two diagrams simply show us that in order to grow and transform our business we should focus on innovation and reduce time/money spending on operating. That’s obviously not an easy task to achieve and can only be possible if your infrastructure is flexible and adaptable for these changes.

Couple of years ago, it was a straightforward task for IT administrators to manage/operate less data, servers, and applications. But now, every single minute hundreds of terabytes of data are flowing from “things” to our systems. Since IoT concept will be an enabler to different domains including logistic, transportation, automotive, healthcare and smart cities, in the near future every single “thing” will be sensor attached and connected to the internet/cloud. Analysts expect that 50 to 100 billion devices will be connected to the Internet by 2020.

IT administrators should handle not only this huge amount of data but also underlying components such as storage, network, servers, applications, hypervisors so on.

Unfortunately without having a true software-defined infrastructure approach, managing, maintaining or innovating could be impossible.

As my colleagues Paul Meehan and Paula Phipps mention, to design a software-defined infrastructure approach, we can use three A`s

Automation: 29% of IT time is spent on tedious tasks. 39% of IT outages are due to human error. Hitachi midrange VSP family eliminates tedious manual tasks, reduces errors and lets administrators focus on revenue-generating activities.

Access: Access more data and solve real-world problems

Abstraction: Provide more services faster with more flexibility to support a diverse set of applications.

Couple of years ago I was involved in a project. Customer was working for government and had very sensitive public IIS web sites. Development team was developing updates every two weeks and sending MSI update package to Operations team. This team was responsible to achieve following actions:

  • RDP to different DMZ servers. All servers were belong to different forests therefore they need to use different credential for each server.
  • Copy MSI package to servers, unzip it (No check if MSI damaged/working or not)
  • Call network team and ask them to disable pool member on Load Balancer
  • For each web site, stop IIS service, change webconfig file, install MSI (no check if its installed or not, no check on event viewer or log files)
  • Start IIS service
  • Call network team to revert back configuration
  • Connect another IIS web site….

Operation team was spending around one or two days to update all web servers in production.

But I think time was not the main problem. The main problem was human errors. According the researches, most of the storage, server or service outages are caused by human errors. For the above scenario, if operation guy changes wrong line in webconfig or network guy removes wrong pool member, production environment will have service outage.

However, as using a correct automation method, organizations can easily reduce these statistics and save more money/time.   Remember the first “A” – Automation.

Microsoft is investing in automating, enabling the use of different automation solutions such as PowerShell, System Center Orchestrator and Service Management Automation. These automation solutions can be used to automate not only Microsoft workloads but also cross-platform Linux workloads, Network and Storage solutions.

I believe PowerShell is one of the most important initiatives by Microsoft in recent years. It`s a scripting language with an easy syntax and developed for System administrators. Almost all of the new Microsoft products, on-premise or Azure based, have native Windows PowerShell support.

Orchestrator is the new version of Opalis, acquired by Microsoft in 2009. It`s a process automation solution and comes with System Center suite. If you are using Virtual Machine Manager or Operations Manager you already have an IT Process Automation solution as well. Simple dashboard, drag&drop workflow design. You can also use .NET Script activity to run PowerShell scripts in workflows.

And Service Management Automation built-on PowerShell workflows. It`s a web based process automation tool designed to work with Windows Azure Pack, local version of Microsoft Azure in your datacenter. It allows you to build SMA workflows to create, monitor, deploy and manage resources in your private cloud environment.

When it comes to Software-Defined Infrastructure and Automation, Hitachi offers a wide range of solutions.  The Hitachi midrange VSP family provides the foundation for software-defined infrastructures by making automation and abstraction easy with an integrated portfolio of infrastructure automation and virtualization software.

If you are using Hitachi`s converged solution, you already know that how it simplifies management of private cloud and data center environments. You can also combine Microsoft System Center / Windows Azure Pack suite with UCP and it enables an end-to-end Private Cloud platform with self-service / orchestration / automation capabilities.

http://www.hds.com/solutions/virtualization/microsoft-hyper-v/hitachi-ucp-for-microsoft/

This solution automates the management of servers, networking components and storage using UCP Director, System Center and Microsoft adaptors.

Hitachi integrates with Microsoft applications to create a unified automation/management solution for Microsoft environments.

These are the available adaptors provided by Hitachi:

  • Hitachi Infrastructure Adapter for Microsoft System Center Operations Manager
  • Hitachi Adapter for Microsoft System Center Virtual Machine Manager
  • Hitachi Storage Adapter for Microsoft System Center Orchestrator
  • Hitachi Storage Adapter for Microsoft® SQL Server Remote BLOB Storage
  • Hitachi Storage Adapter for Microsoft Windows PowerShell
  • Hitachi Storage Adapter for Microsoft Volume ShadowCopy Service

Especially adapters for PowerShell and Orchestrator enables you to automate and orchestrate processes using together Hitachi and Microsoft solutions.

Hitachi Storage Adapter for Microsoft Windows PowerShell allows Hitachi storage administrators to use PowerShell cmdlets on Hitachi storage systems. Using cmdlets, administrators can create scripts to automate complex tasks.

Hitachi Storage Adapter for Microsoft Windows PowerShell

Using Hitachi Storage Adapter for Microsoft System Center Orchestrator you can easily extend the capabilities of System Center Orchestrator.

Hitachi Storage Adapter for Microsoft System Center Orchestrator

This plug-in provides:

  • Storage management and Hitachi NAS (HNSA) support
  • Virtualized storage management
  • Hitachi Content Platform (HCP) management

Each activity uses built-in PowerShell processes to run on remote server and allows you to create workflows/Runbooks to automate complex tasks in your datacenter.

It`s really good to see how two different vendor come together and built a complete management and automation solution. One more time hats-off to Hitachi engineers. They created really valuable plugins and integrations with Microsoft/System Center suite. These adaptors combines the power of Hitachi performance, reliability and agility with the productivity of Microsoft solutions.

One more step to Hybrid Cloud – SCVMM 2012R2 UR6

Microsoft team just announced Update Rollup 6 for System Center 2012 R2 Virtual Machine Manager. This time Microsoft has incorporated requests from customer feedbacks and brought two great features. Gen 2 Support for VMM Service Templates and ability to manage Microsoft Azure VMSs directly from VMM console.

Let`s talk about why these 2 updates are so important.

Generation 2 VMs were announced as a new type of virtual machines in Windows Server 2012 R2. Using Gen2 VMS, you have great benefits such as booting from SCSI attached storage, eliminating legacy networking, larger volume sizes, secure boot features so on. Gen 2 VMs also use UEFI firmware. As you may notice many of these advantages are patently exciting.

However, after you dig far into Generation 2 VMs, you will notice that there is lack of compatibility issue with VMM service templates.  Therefore if you want to deploy “IT services” using VMM Service template which is suggested method, you will get an error regarding compatibility.

This is why, UR6 VMM Service Template support for Gen 2 VMs is important.

Secondly, I like the idea of Microsoft`s Hybrid Cloud approach. Enterprises are looking ways to get full potential of all different cloud types they require to be competitive in market. Microsoft plays a significant role when it comes to a consistent platform for different customers and different needs. Microsoft is single cloud player that offers same consistent platform for customers, consumers and service providers.

Microsoft also invested the idea of Hybrid Cloud in past years. As a virtualization manager, you may have investments in your local datacenter and you may be using  a virtualization fabric management solution like Virtual Machine Manager to manage Hyper-V or different hypervisors. You may also have some workloads on public cloud as well (Azure). Before UR6, to manage local VMs and fabric you had to use Virtual Machine Manager console. To manage your Azure virtual machines, options were browser, PowerShell, Rest Api etc

VMM UR6 brings a new capability into VMM to manage all Virtual Machines from your local datacenter or Azure Infrastructure Services. In one single cloud management portal, you will have a great control of your infrastructure services from Private or Public cloud services.

If you want to know more about these features, checkout below video, Matt McSpirit and Jonobie Ford are discussing some of what`s coming up with UR6.