December 6, 2017 at 9:29 am
I am on windows 2012R2 standard, with sql 2014 EE, I am getting the following error when creating alert, what am I doing worng
Msg 22022, Level 16, State 1, Line 2
SQLServerAgent Error: WMI error: 0x80041002.
Msg 14511, Level 16, State 1, Procedure sp_verify_alert, Line 306
The @wmi_query could not be executed in the @wmi_namespace provided. Verify that an event class selected in the query exists in the namespace and that the query has the correct syntax.
USE [msdb]
GO
EXEC msdb.dbo.sp_add_alert @name=N'high cpu',
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=0,
@wmi_namespace=N'\\.\root\cimv2',
@wmi_query=N'SELECT * FROM __InstanceModificationEvent WITHIN 5 WHERE TargetInstance ISA Win32_Processor AND TargetInstance.loadpercentage > 50
',
@job_id=N'00000000-0000-0000-0000-000000000000'
GO
December 6, 2017 at 12:11 pm
Never mind I found the correct syntax
USE [msdb]
GO
/****** Object: Alert [Alert High CPU % (WMI)] Script Date: 12/6/2017 1:38:57 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N'Alert High CPU % (WMI)',
@message_id=0,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]',
@wmi_namespace=N'\\.\ROOT\CIMV2',
@wmi_query=N'SELECT * FROM __InstanceModificationEvent WITHIN 5
WHERE TargetInstance ISA ''Win32_Processor'' AND TargetInstance.LoadPercentage > 60',
@job_id=N'00000000-0000-0000-0000-000000000000'
GO
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply