OpsMgr 2012 UNIX/Linux Authoring Templates: Shell Command
January 30, 2012 1 Comment
Many of the OpsMgr authoring examples for UNIX/Linux monitoring that I have described on this blog are based on the use of the WSMan Invoke modules to execute shell commands. This is a really powerful mechanism to extend the capabilities of Operations Manager monitoring, and the 2012 version of Operations Manager includes a new set of templates allowing the creation of rules, monitors, and tasks using UNIX/Linux shell commands directly from the Authoring pane of the console.
The new templates are:
Monitors
- UNIX/Linux Shell Command Three State Monitor
- UNIX/Linux Shell Command Two State Monitor
Rules
- UNIX/Linux Shell Command (Alert)
- UNIX/Linux Shell Command (Performance)
Tasks
- Run a UNIX/Linux Shell Command
Note: For the OpsMgr 2012 Release Candidate, the Shell Command Template MP needs to be downloaded and imported. In the final release, it will be imported by default.
Underneath the covers, all of these templates use the ExecuteShellCommand method of the agent’s script provider with the WSMan Invoke module. This method executes the command and outputs StdOut, StdErr, and ReturnCode. The command can be a path to a simple command, a command or script existing on the managed computer, or a “one-liner” script (a shell script condensed to one line with pipes and semi-colons). The templates also allow you to select whether to run with the nonprivileged action account, or the privileged account (which also supports sudo elevation).
If you’ve done this kind of UNIX/Linux authoring in 2007 R2, you will quickly see how much easier and faster this can be done in 2012.
To show the use of these templates, I have put together an MP authoring walkthrough for monitoring BIND DNS servers on Linux. This entire MP will be created in the Operations Console, with no XML editing!