|
|
Re: SQL DB Backup test alerting when it shouldn't
Posted: Tue, Oct 06, 2009 10:31 AM :: Rank: 0 |
Author
|
|
|
Points: 40804
Level: System Center Expert |
Thank you for your rating!
|
Hi Bob, what is the Property[@Name='NumHours'] value set to?
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
RE: SQL DB Backup test alerting when it shouldn't
Posted: Tue, Oct 06, 2009 10:49 AM :: Rank: 31 |
Author
|
|
|
Points: 6985
Level: System Center Specialist |
Thank you for your rating!
|
It is set to the results of the SQL query that compares the date/time of the last backup to the current date/time. In other words, if the backup is 4 hours old, then NumHours=4.
There is a line above the section of the script that I posted that creates the property that then gets sent back to SCOM in the property bag.
Call objBag.AddValue("NumHours", CInt(oResults(1)))
The value that I see in the alert (or if I run the SQL query manually in on the server) is correct. The problem is the reaction of SCOM to the value. It's not seeing 3 as being less than 25 for some reason, even though I appear to have the Healthy and Unhealthy expressions correct (as in the picture).
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
RE: SQL DB Backup test alerting when it shouldn't
Posted: Wed, Oct 14, 2009 3:24 PM :: Rank: 0 |
Author
|
|
|
Points: 6985
Level: System Center Specialist |
Thank you for your rating!
|
I never saw anyone post a valid solution to this problem, so I found a way around it. Since the script itself was doing a fine job of figuring out if the backup was under a certain threshold, and SCOM was having a hard time figuring out if 3 was less than 25, I added a line of code to the script. See below:
If oResults.EOF Then
Call objBag.AddValue("BackupType", "Full or differential backup")
Call objBag.AddValue("NumHours", "9999")
Call objBag.AddValue("Reason", "A full backup for database " & strDatabase & " is never be made!")
Call objBag.AddValue("Status","Bad")
Else
Call objBag.AddValue("BackupType", "Full or differential backup")
Call objBag.AddValue("NumHours", CStr(oResults(1)))
If CInt(oResults(1)) > iThresholdHours Then
Call objBag.AddValue("Reason", "The last full or differential backup for database " & strDatabase & " is more than " & oResults(1) & " hours old!")
Call objBag.AddValue("Status","Bad")
Else
' backups is ok
Call objBag.AddValue("Reason", "The last full or differential backup for database " & strDatabase & " SHOULD NOT BE ALERTING BECAUSE IT is less than " & CStr(iThresholdHours) & " hours old.")
Call objBag.AddValue("Status","OK")
End If
End If
Now, I've set the Healthy and Unhealthy expressions in the monitor to key off of the 'Status' variable instead of trying to compare the 'NumHours' variable. Everything is working fine now.
I still have no idea why SCOM had trouble comparing the 2 numbers.
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
Re: SQL DB Backup test alerting when it shouldn't
Posted: Mon, Oct 19, 2009 5:07 AM :: Rank: 1 |
Author
|
|
|
Points: 145
Level: System Center Hero |
Thank you for your rating!
|
Hi ComputerBob,
Can I add another file at the end of my blogpost with your improvements?
Regards,
Stefan Stranger
http://blogs.technet.com/stefan_stranger/archive/2009/02/02/opsmgr-sql-full-or-differential-backup-check.aspx?CommentPosted=true#commentmessage
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
RE: SQL DB Backup test alerting when it shouldn't
Posted: Thu, Oct 29, 2009 8:55 AM :: Rank: 0 |
Author
|
|
|
Points: 6985
Level: System Center Specialist |
Thank you for your rating!
|
Yes, please do. I think other people would benefit from it.
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
RE: SQL DB Backup test alerting when it shouldn't
Posted: Fri, Jan 15, 2010 1:29 AM :: Rank: 0 |
Author
|
|
|
Points: 180
Level: System Center Hero |
Thank you for your rating!
|
Hi Bob,
I also followed Stefan's solution and i also ran into the issue your referring to above. When i posted the same issue the MSDN forum http://social.technet.microsoft.com/Forums/en-US/operationsmanagergeneral/thread/f3ee2886-dcdc-4257-ba67-7f8e047683f5 , Daniele Grandini suggested that i change the data type in the xml configuration from string to integer. Since making this change, the alerts and state changes seems to occur when at the correct time. Here is the bit of xml i changed to integer.
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='NumHours'] </XPathQuery>
</ValueExpression>
<Operator>Greater</Operator>
<ValueExpression>
<Value Type="Integer">20</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
<SuccessExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='NumHours'] </XPathQuery>
</ValueExpression>
<Operator>LessEqual</Operator>
<ValueExpression>
<Value Type="Integer">20</Value>
</ValueExpression>
</SimpleExpression>
</SuccessExpression>
Cheers,
PK
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
Re: SQL DB Backup test alerting when it shouldn't
Posted: Fri, Jan 15, 2010 1:57 PM :: Rank: 0 |
Author
|
|
|
Points: 6985
Level: System Center Specialist |
Thank you for your rating!
|
That's great news, PK! I'm glad someone figured that out. I was beginning to think that the SCOM programmers didn't understand simple boolean logic. Makes sense now to understand that it was reading that variable as string instead of an integer. Thanks.
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
Re: SQL DB Backup test alerting when it shouldn't
Posted: Tue, Jun 15, 2010 10:37 AM :: Rank: 42 |
Author
|
|
|
Points: 6985
Level: System Center Specialist |
Thank you for your rating!
|
PK emailed me about another issue he was having with this process. He had some DBs with a space in the name (ie: "GBIX DB") which caused a problem because the script would see those as 2 separate variables and basically fail. I sent him a solution which worked for him and should work for most people. I have seen this before in another script, and had a fix for it that might work here. When you pass the parameter to the script, put quotations around it. See below to see what I’m talking about.
This is what is documented as the parameters sent to that script:
$Target/Host/Property[Type="SQLServer2!Microsoft.SQLServer.DBEngine"]/ConnectionString$ $Target/Property[Type="SQLServer2!Microsoft.SQLServer.Database"]/DatabaseName$ 47
Change it to look like this (notice the quotations around the 2nd parameter):
$Target/Host/Property[Type="SQLServer2!Microsoft.SQLServer.DBEngine"]/ConnectionString$ “$Target/Property[Type="SQLServer2!Microsoft.SQLServer.Database"]/DatabaseName$” 47
I did this for a script having to do with IIS sites and it fixed my ‘extra parameters’ problem when the people that made the site had put a space in the name.
PK tested this in his environment and it works to resolve his issue.
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
Re: SQL DB Backup test alerting when it shouldn't
Posted: Wed, Dec 14, 2011 4:04 PM :: Rank: 79 |
Author
|
|
|
Points: 60
Level: System Center Enthusiast |
Thank you for your rating!
|
Computer Bob. The link from Stefan is no longer working for the script. Would you be able to post it somewhere. I am tasked with reporting on SQL backups using SCOM. Thanks in advance
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|
|
|
RE: Re: SQL DB Backup test alerting when it shouldn't
Posted: Thu, Dec 15, 2011 9:01 AM :: Rank: 62 |
Author
|
|
|
Points: 47503
Level: System Center Expert |
Thank you for your rating!
|
|
|
| Your Reports Help Protect the Community |
|
The community depends on each member to help keep Answers a safe and positive place. Do your part by using the form below to report Q&A that violates the Community Guidelines.
|
Additional Detail(optional)
|
Report Abuse |
|