WMI Alerts

  • Hi all,

    I was wondering if anyone could help me, I'm trying to write a WMI alert to tell me when the drive space on certain drives fails below a certain threshold, lets say 1gb.

    Sadly I'm not having much luck, I've tried to find examples but can't seem to find anything, I have the following code;

    USE [msdb]

    GO

    EXEC msdb.dbo.sp_add_alert

    @name =N'Test',

    @enabled =1,

    @delay_between_responses =0,

    @include_event_description_in =0,

    @wmi_namespace =N'\\.\ROOT\CIMV2',

    @wmi_query =N'Select from Win32_LogicalDisk Where FreeSpace < 1000'

    GO

    But I'm getting an error;

    Msg 22022, Level 16, State 1, Line 0

    SQLServerAgent Error: WMI error: 0x80041058.

    Msg 14511, Level 16, State 1, Procedure sp_verify_alert, Line 300

    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.

    The system is a 64 bit system and the error appears to be a name space issue.

    Does anyone have an example of how to do this, or can someone confirm the name space I should be using?

    Many thanks,

    Nic

  • Take a look at http://www.techtalkz.com/microsoft-sql-server/266255-sql-server-agent-wmi-event-alert.html which has some information.

  • Thanks Matt, I'll have a read through it now.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply