MOM 2000/2005 WAP Operator Console is born!.
MOM 2000/2005 WAP Operator Console is born.
Past week I had a great idea. We are now sending SMS alerts to our standby phone. This is working O.K but the problem was that the standby operator was getting multiply SMS parts because the alert message was longer than 160 chars. I had to figure out to get a fast and costless solution for this. I thought about this:
1) Get a XDA or PDA smart phone.
Send the alert as email to the standby operator mail box. Since Exchange SP2 you are getting right-on your messages.
Problem: You must have a XDA/PDA smart phone and an GPRS/UMTS connection.
2) Get a XDA or PDA smart phone.
Connect with the PDA internet explorer to the MOM web operator console and browse the alerts/events.
Problem: The web console is not written for a PDA screen resolution. So you are spending more time clicking on the scroll bars than reading you alerts.
3) Get a XDA or PDA smart phone.
Connect with the PDA internet explorer to the MOM Mobile operator console and browse the alerts/events. Seems the perfect solution. BUT….
Problem: Yea sure , Microsoft hasn’t writing one yet. They have indeed written one but that’s a Chinese version. (by the way : I have the source code , and I’m trying to translate this one…)
4) OR… You’re using your old Nokia phone (with WAP function)
So now we still send 1 SMS to this phone. This SMS is only saying that a “source” is in service unavailable state. The operator then connects with WAP to the MOM operator WAP console. Read the Alert information and browse other alerts/events.
Option 4 is the solution I’m going to explain. This one is written in 30min and installed in 5min. You don’t have to get to your boss and ask for a XDA/PDA investment, just use your old WAP compatible phone. I have written this one in my private time so I will share some code.
Short steps I’ve taken:
- Open a new project in visual studio named: Mobile Web application
- Drag a new form on it.
- Drag a Object List on this form
- Drag 3 buttons on it. (or more)
- Name the button: SU alerts , CE alerts , Error Alerts etc..
- Click on the (example CE alerts) button and assign a action.
- The action is a procedure I will explain below. For now just fill in this code:
private void Command2_Click(object sender, System.EventArgs e)
{
try
{
// ResolutionState=0, Severity=70 critial error
GetAlerts(0,70);
}
catch(System.Exception err)
{
Label1.Text = "Fatal error : " + err.Message;
}
}
- Now we are getting to the main part of this console. The Getalerts() procedure.
This procedure is for now using the (old unsupported?) MOM WMI interfaces. But you can however simple use the SDK MOM SQL views for this. That’s up to you!. I’m using for now the WMI MSFT_Alert interfaces to retrieve the alerts with a specific resolution state.
Here’s the code:
private void GetAlerts(int ResolutionState, int Severity )
{
try
{
string sMOMserver = ".";
ManagementScope scope = new ManagementScope("\"+ sMOMserver +"rootmom");
// display where to get the data
Label2.Text = "MOM " + sMOMserver;
// Create a DataSet (only needed if you want to save to XML )
System.Data.DataSet ds = new System.Data.DataSet();
// Create a DataTable to hold our results
System.Data.DataTable dt = new System.Data.DataTable("Alerts");
// Add the table to the dataset
ds.Tables.Add(dt);
// Create columns for our data
dt.Columns.Add(new System.Data.DataColumn("DateTime", typeof(DateTime)));
dt.Columns.Add(new System.Data.DataColumn("Type", typeof(String)));
dt.Columns.Add(new System.Data.DataColumn("Name", typeof(String)));
dt.Columns.Add(new System.Data.DataColumn("Message", typeof(String)));
scope.Connect();
ObjectQuery query= new ObjectQuery("Select * from MSFT_Alert where ResolutionState=" + ResolutionState.ToString() +" and Severity= " + Severity.ToString() );
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
DateTime TimeLastModified = new DateTime();
// Loop through each item in the collection
foreach( System.Management.ManagementObject queryObj in searcher.Get() )
{
// convert the WMI datetime to a GM date time
TimeLastModified = ManagementDateTimeConverter.ToDateTime(queryObj["TimeLastModified"].ToString());
// Add a row of data to our table
dt.Rows.Add(new object[] {
TimeLastModified,
queryObj["Severity"],
queryObj["Name"],
queryObj["Description"] } );
}
Label2.Text = "ROWS: " + dt.Rows.Count.ToString();
// sort on datetime
DataView dv = new DataView(dt);
dv.Sort = "DateTime DESC";
ObjectList1.DataSource = dv;
ObjectList1.DataBind();
}
catch(ManagementException err)
{
Label1.Text = "An error occurred while querying for WMI data: " + err.Message;
}
catch(System.UnauthorizedAccessException unauthorizedErr)
{
Label1.Text = "Connection error (user name or password might be incorrect): " + unauthorizedErr.Message;
}
catch(System.Exception err)
{
Label1.Text = "Fatal error : " + err.Message;
}
}
9) Now you build the project and deploy it on your MOM server. This is a WEB project so it must be deployed as a IIS web application.
10)Open a internet explorer and browse to the IIS application site you have created. And now you must see the create WAP site. If so. Then you’re ready to test it with the WAP phone.
11)Open with the phone the WAP URL. I’ve created a bookmark so it can be request easily.
This is it up to now. You can easily extend this MOM WAP console and even get a trend performance graph in to it… But that’s up to you.
Hope this helps..
Any questions are welcome…
Michel
See for project download:
https://accblogs.infosupport.com/files/folders/11170/download.aspx
https://accblogs.infosupport.com/files/folders/11170/download.aspx