Showing posts with label management pack. Show all posts
Showing posts with label management pack. Show all posts

Tuesday 25 August 2009

Port Monitoring from a text file

This is another solution on how to make something that requires permissions and experience in OspMgr available to everyone to use. Teach a man to fish and all that.

These two Management packs will allow any user you specify using simple NTFS permissions to add port monitoring for a server, network device etc.

Usage

Download and Import the 2 management packs:





On each management server a discovery in the AgentlessAvailabilty MP will create a text file C:\AgentlessMonitoring\resource.txt

You can add entries to this file in the format:
{name or IP address}, port - (comma seperated)

If no port is specified it will default to port 445.
Use the hash # at the start of a line to insert a comment.








The discovery runs every 1 hour. After the discovery runs any entries in the file will then display in the console under the standard Synthetic Transaction folder
Each entry will be checked every 10 minutes.












These MPs simply reuse the existing Port Monitoring template so there is a full range of specific alerts, health states and associated Knowledge articles





To make this so that anyone can use it simply share the C:\AgentlessMonitoring folder giving write permissions to those who need it

Technical Details


The sealed Custom.PortMonitoring.Library is essentially the Port Monitoring template with the module types having any specific information promoted to class properties. The discovery in the unselaed Custom.Infra.AgentlessAvailabilty MP then creates class instances with the necessary properties.

You can leverage the sealed MP from other management packs to add port monitoring. All it takes is writing a discovery.






Friday 3 October 2008

Useful methods for searching MP's

Usually when i am looking for a way to do something in a management pack I refer to the Microsoft MP's as it has likely been done in them. Here is my normal process for searching these MP's.

In my development environment I dump all the management packs out to their XML. This is done using Command Shell.

mkdir c:\unsealed
get-managementpack | export-managementpack -path C:\unsealed


Then I open Notepad++ with the XML Tools plugin installed. A fantastic function of Notepad++ is Find in Files...

So say I am looking for the syntax to use in a recovery to start a service. I can Open up Notepad++ and do a Find in Files and look for "net start"




A few comments I read on the OpsMgr newsgroups about the Agent Maintenance Mode solution that I posted pointed out that the %MOMROOT% variable was not on the path and could not be used from the command line. If you do a search across all the MP's using the methid above it is defined in several different ones ( Sharepoint 2003, System Center Core Management Pack). Looks like this is something defined only within the context of OpsMgr.


Wednesday 1 October 2008

Hp Storageworks Management Pack

I had a quick look at the Hp Storageworks MP v1.5 for the first time today and noticed quite a few glaring issues.

There are 5 separate discoveries running every 60 seconds on ALL computers. Looks like someone forgot to change the interval on these after development was finished. At least it is possible to change these intervals using overrides.

The discovery "HP StorageWorks SNMP Trap Catcher Discovery Rule" discovers every system with the SNMPTRAP service installed. Then proceeds to start monitoring all these servers. This monitoring includes an WMI query that runs every 15 seconds on all the servers that have the SNMPTRAP service and runs a script every time!!

The WMI query rule is using the backward compatibility layer so the interval cannot even be overriden.

Tuesday 12 August 2008

Updated Agent Maintenance Mode

---Update---

Updated version of this MP at http://derekhar.blogspot.com/2009/11/new-agent-maintenance-mode.html


---------


There is a new version of my Maintenance Mode MP and scripts that can do maintenance mode from the Agent with no extras installed (The original post is here). The 4 files are available for download from http://cid-397bb61b75cc76c5.skydrive.live.com/browse.aspx/Public/AgentMaintModeV2?view=details

-----------

EDIT

Be aware the PowerShell execution policy might block the script from being run.

You may need to do the following:
1. Open the Command Shell, and do "set-executionpolicy remotesigned" (using "allsigned" may be considered a bit more secure.
2. Right-click on the .ps1 files, chose properties and click "Unblock" especially if you've downloaded these scripts using Internet Explorer.

Thanks to Marco for catching this. I had a few people contact with with the earlier version not working and I could never figure out why. Could be the same reason.

----------------

This version adds the ability to turn off maintenance mode from the agent as well as turn it on. The vbscript has been updated with some more options and some instructions on how to use it.

To install or update you need to import the management pack and copy the 2 ps1 files to System Center Operations Manager 2007 program folder on the RMS.

Then you need to copy the vbscript file to any agent managed server and run it to set any server in maintenance mode for the desired time period.

------------------------------

VBScript Usage:

Usage: MaintMode ON|OFF [ON Duration][D][H][M]

Examples: MaintMode ON 6H
MaintMode ON 2D

ON is a mandatory keyword to put a server in maintenance mode.

ON Duration is number of [D]ays [M]inutes or [H]ours Maintenance
Mode should remain ON.

If not specified, the default is 6 hours.
This means Maintenance mode will turn itself OFF after 6 hours.

If ON Duration is specified without [D][H][M], the number is
interpreted as hours.

------------------------------

This MP creates a new class which contains all Windows Operating Systems. There are 2 rules in this class. One listens for the Maint Mode ON event and the other listens for the Maint Mode OFF event. The script on the RMS that turns on Maintenance Mode actually turns it on for all the components of the server and then turns it off again only for the Maint Mode class. This means that even in Maint Mode it can listen for the OFF event.

NOTE: The discovery for this class runs every 12 hours so be aware that systems may take this long after install for the scripts to work

Thanks again to Boris for his examples and scripts for doing maintenance mode.

Tuesday 19 February 2008

Initiate Maintenance Mode from an Agent (no extras installed)

---Update---

Updated version of this MP at http://derekhar.blogspot.com/2009/11/new-agent-maintenance-mode.html


---------


This post will detail a method to initiate Maintenance Mode from an agent managed computer using a vbscript. This method is useful in the case where the people doing patching are not the same people who use the Operations Console and when you cannot dictate what is to be installed in the server. Clive Eastwood's AgentMM for example, if run remotely requires .NET 3.0, Operations Manager specific dll's, Admin permissions on OpsMgr and the ability to connect to the SDK service on the RMS.

Using this method, the person running the command needs to have absolutely no permissions on Ops Manager. All of the components required to have this function are part of a standard OS with and agent installed. It works through Gateways so can be used in firewalled or untrusted environments if you have a gateway in place.

There are 3 parts to this solution:

1) A VBScript on each managed computer that writes an event to the local event log.

2) A Management pack containing an rule that detects this event and runs a response on the RMS.

3) The response executes a Powershell script on the RMS that puts the server in to Maintenance Mode. I have borrowed pieces of the powershell script from Boris.


VBScript

Powershell Script

Management Pack

The vbscript is pretty simple and just writes an event to the event log that indicates the length of time Maintenance Mode should remain on. This time is passed as a parameter to the script.

Usage: MaintModeOn 4

- This command turns on Maintenance Mode for 4 hours

The single rule in the management pack picks up the event from the Application Log with event ID of 0, with a source of WSH and where the description contains the words "Maintenance Mode". In response, the rule runs the Powershell script MaintModeON.ps1 and passes to it two parameters -the name of the computer where the script was run and the event description.

The Powershell script puts all three pieces of an agent in the Maintenance Mode. This Powershell script should be copied to the System Center Operations Manager 2007 program folder on the root management server. If you have clustered the RMS it should be in the folder on both nodes.



---Update---

I have updated the links since google appears to have taken down the site hosting the files.

Tuesday 17 July 2007

Export a Sealed MP

Export a Sealed MP

A sealed MP can be exported to an XML file using Command Shell.
Find the correct name of the MP you want to export using:

get-managementpack | where {$_.Name -like "*Server.2003"}

Export using:

get-managementpack | where {$_.Name -eq "Microsoft.Windows.Server.2003"} | export-managementpack -path C:\MP