Condividi tramite


Eventi WMI

 

Si applica a: System Center 2012 R2 Operations Manager, System Center 2012 - Operations Manager, System Center 2012 SP1 - Operations Manager

<_caps3a_sxs _xmlns3a_caps="https://schemas.microsoft.com/build/caps/2013/11"><_caps3a_sxstarget locale="it-IT">Eventi WMI vengono create dalle query WMI che rilevano le particolari azioni nel sistema operativo o in applicazioni che creano i propri eventi WMI. Questi eventi è utilizzabile per rilevare tali azioni come processo finale, un file viene creato o una chiave del Registro di sistema da modificare. Gli eventi WMI non sono persistenti. Pertanto, tutti gli eventi WMI che vengono creati quando il servizio agente non è in esecuzione vengono persi.Questa guida presuppone una conoscenza di come compilare una query di notifica di WMI. Per una panoramica di questo argomento e l'esempio, vedere query sblocco Mistero di eventi WMI in MOMhttps://go.microsoft.com/fwlink/?LinkID=187607.Procedure guidate di eventi WMINella tabella seguente sono elencate le procedure guidate disponibili per gli eventi WMI.Oggetto Management PackProcedure guidate disponibilimonitoraggiRilevamento evento semplice utilizzando ognuna dello standard Event Monitor Reset metodiRipetuto il rilevamento di eventi utilizzando ognuna dello standard Event Monitor Reset metodiregoleRegola di avviso WMI la generazione di eventiRegola di evento WMI raccolta eventiOpzioni della procedura guidata evento WMIQuando si esegue una guidata regola o il monitoraggio di eventi WMI, è necessario fornire valori per le opzioni nelle tabelle seguenti. Ogni tabella rappresenta una singola pagina della procedura guidata.GeneraleIl Generale pagina include le impostazioni generali per la regola o monitoraggio inclusi il nome, categoria, destinazione e file del management pack in cui salvarlo.OpzioneDescrizioneNomeNome utilizzato per la regola o monitoraggio. Per una regola, viene visualizzato il nome di regole visualizzare nel Authoring riquadro. Quando si crea una vista o un report, è possibile selezionare il nome da utilizzare i dati raccolti da esso. Per un monitoraggio, il nome viene visualizzato in Esplora stati degli oggetti di destinazione.DescrizioneDescrizione facoltativa della regola o del monitoraggio.Management PackFile del management pack per archiviare la regola o monitoraggio.Per ulteriori informazioni sui management pack, vedere Selecting a Management Pack.Categoria della regola (solo regole)Categoria per la regola. Per una regola di raccolta di eventi deve essere la raccolta degli eventi. Per una regola di avviso, deve essere avviso.Monitoraggio padre (solo monitor)Monitoraggio aggregato che verrà posizionato il monitoraggio in Esplora stati. Per ulteriori informazioni, vedere Aggregate Monitors.DestinazioneLa classe da utilizzare per la destinazione della regola o del monitoraggio. La regola o il monitoraggio deve essere eseguito su qualsiasi agente che ha almeno un'istanza di questa classe. Per ulteriori informazioni sulle destinazioni, vedere Targets, Groups, and Objects.La regola è attivataIl monitoraggio è attivatoSpecifica se la regola o il monitoraggio è abilitato.Configurazione di WMI / Provider di eventi WMIIl configurazione WMI pagina consente di specificare lo spazio dei nomi WMI, query e l'intervallo di polling. Esisterà un unico configurazione WMI pagina per una raccolta o regola di avviso e di un monitoraggio dell'utilizzo di reimpostazione manuale o timer. Per un monitoraggio utilizzando Reimposta evento WMI, saranno presenti un Provider eventi WMI pagina per definire la query per la condizione di errore e per la condizione integra.OpzioneDescrizioneSpazio dei nome WMILo spazio dei nomi contenente la classe che viene utilizzata nella query WMI.QueryQuery di notifica WMI che cerca l'occorrenza di un evento WMI specifico.Intervallo di pollingSpecifica la frequenza Operations Manager eseguirà il polling per l'evento WMI. Questo valore deve essere esattamente a quello utilizzato nella clausola WITHIN della query di notifica.Corrispondenza intervalli di polling WMICreare espressioneIl Crea espressione pagina consente di definire un filtro per i dati provenienti dalla query WMI. Esisterà un unico Crea espressione pagina per un monitoraggio eventi WMI tramite la reimpostazione manuale o timer. Per un monitoraggio utilizzando Reimposta evento WMI, vi è un'espressione per ogni stato di integrità.Poiché possono essere specificati nella clausola WHERE della query WMI, un'espressione spesso non è necessario in un monitoraggio eventi WMI. È solo necessario se la query deve restituire più record. Le regole di eventi WMI si basano sui criteri nella query stessa e non consentono un'espressione. Le procedure guidate console operazioni richiedono tuttavia specificare i criteri di monitoraggio eventi WMI. Se non è necessario alcun criterio, criteri fittizi devono specificati nella procedura guidata e quindi rimosso visualizzando le proprietà del monitoraggio dopo averlo creato.Le proprietà disponibili per un evento WMI cambieranno in base al tipo di evento da monitorare. Le proprietà disponibili anche varia a seconda delle proprietà della classe WMI incluse nella query. I dati saranno sotto forma di contenitore di proprietà che dispone di una raccolta di proprietà per una o più istanze della classe WMI. Gli eventi WMI creati utilizzando una query che utilizza __InstanceCreationEvent o __InstanceDeletionEvent disporranno di una raccolta unica denominata TargetInstance in cui l'istanza verrà creata o eliminata. Gli eventi WMI creati utilizzando __InstanceModificationEvent disporranno di un ulteriore raccolta denominata PreviousInstance.La sintassi per le proprietà di un evento WMI è la seguente:Collection[@Name='TargetInstance']/Property[@Name='Caption']Ad esempio, la seguente query WMI consente di monitorare le modifiche in un file denominato c:\MyApp\MyAppLog.txt.SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA 'CIM_DataFIle' AND TargetInstance.Name = 'C:\\MyApp\\MyAppLog.txt'Presupponendo che i dati vengono aggiunti al file modificando le dimensioni del file e attiva la query, nella tabella seguente sono riportati alcuni esempi di proprietà di questa query:ProprietàSintassiDimensioni del file originaleCollection[@name='PreviousInstance']/Property[@name='FileSize']Nuova dimensione del fileCollection[@name='TargetInstance']/Property[@name='FileSize']Riavvio automatico del timerIl Timer di reimpostazione automatica pagina è disponibile solo per timer Reimposta monitoraggi. Consente di impostare il tempo che deve trascorrere dopo aver creato l'avviso prima che l'avviso verrà risolto automaticamente.Configura statoIl Configura stato pagina è disponibile solo per i monitor. Consente di specificare lo stato di integrità che verrà impostato per ogni evento. Per un manuale Reimposta monitor, la reimpostazione manuale condizione sarà integro, ed è possibile specificare se il generato l'evento condizione verrà impostato il monitoraggio un avviso o un critico stato. Per un Timer reimpostato o Reimposta evento WMI, è possibile specificare lo stato impostato da ogni evento. Il primo evento verrà in genere impostato il monitoraggio avviso o critico mentre il secondo evento o il timer verrà impostato il monitoraggio integro.Configura avvisiIl Configura avvisi pagina è disponibile solo per i monitoraggi e le regole di avviso. Vengono descritte le opzioni disponibili in Alerts.Creazione di regole e monitoraggi di eventi WMILa procedura seguente viene illustrato come creare un monitoraggio eventi WMI in Operations Manager con i dettagli seguenti:Viene eseguito in tutti gli agenti con un particolare servizio installato.Imposta il monitoraggio un critico stato quando viene avviato il blocco note nel computer dell'agente.Imposta il monitoraggio un integro stato quando termina il blocco note nel computer dell'agente.In questo esempio non si intende illustrare uno scenario reale, poiché non vi sarà un valore minimo nel monitoraggio quando viene avviato il blocco note. Tramite rappresenta uno scenario comune di monitoraggio di due diversi eventi WMI in un monitor. Utilizzando blocco note, viene fornito un esempio semplice di testare avvio e arresto di blocco note nel computer dell'agente.Per creare un monitoraggio eventi WMISe non si dispone di un Management Pack per l'applicazione monitorata, crearne uno utilizzando il processo descritto in Selecting a Management Pack.Creare una nuova destinazione utilizzando il processo in To create a Windows Service template. È possibile utilizzare qualsiasi servizio installato in un agente di test per questo modello.Nella Console operatore selezionare l'area di lavoro Creazione e modifica.Fare doppio clic su Monitor, selezionare creare un monitoraggio, quindi selezionare monitoraggio unità.Nel tipo di monitoraggio pagina, eseguire le operazioni seguenti:Espandere eventi WMI, quindi rilevamento evento semplice, e quindi riavvio evento WMI.Selezionare il management pack dal passaggio 1.Fare clic su Avanti.Nella pagina Generale, eseguire le operazioni seguenti:Nel nome digitare errore di evento WMI MyApplication.Fare clic su selezionare accanto al destinazione monitoraggio casella.Accanto a destinazione monitoraggio fare clic su selezionare e quindi selezionare il nome della destinazione creata nel passaggio 2.Nel monitoraggio padre selezionare disponibilità.Lasciare il Monitor attivato casella è selezionata, selezionare e fare clic su Avanti.Nel primo Provider eventi WMI pagina, eseguire le operazioni seguenti:Nel spazio dei nomi WMI digitare root\cimv2.Nel Query digitare la seguente query WMI.Select * From __InstanceCreationEvent WITHIN 60 Where TargetInstance ISA 'Win32_Process' and TargetInstance.Name = 'notepad.exe'Nel l'intervallo di polling digitare 60.Fare clic su Avanti.Nel Crea prima espressione pagina, eseguire le operazioni seguenti:In questo esempio, i criteri siano inclusi nella query WMI, pertanto nessuna espressione è necessario il monitoraggio. Poiché la creazione guidata eventi WMI in Operations console richiede un'espressione per ogni evento, espressioni fittizia verranno fornite per completare la procedura guidata e quindi eliminate una volta creato il monitoraggio.Fare clic su Inserisci.Nel nome del parametro digitare Dummy.Nel operatore selezionare è uguale a.Nel valore digitare Dummy.Fare clic su Avanti.Nel secondo Provider eventi WMI pagina, eseguire le operazioni seguenti:Nel spazio dei nomi WMI digitare root\cimv2.Nel Query casella, incollare la seguente query WMI.Select * From __InstanceDeletionEvent WITHIN 60 Where TargetInstance ISA 'Win32_Process' and TargetInstance.Name = 'notepad.exe'Nel l'intervallo di polling digitare 60.Fare clic su Avanti.Nel seconda espressione pagina, eseguire le operazioni seguenti:Fare clic su Inserisci.Nel nome del parametro digitare Dummy.Nel operatore selezionare è uguale a.Nel valore digitare Dummy.Fare clic su Avanti.Nella pagina Configura stato, procedere come segue:Accanto a FirstEventRaised, modificare il stato a critico.Fare clic su Avanti.Nel Configura avvisi pagina, eseguire le operazioni seguenti:Controllare Genera avvisi per questo monitorNel Genera un avviso quando selezionare il monitor si trova in uno stato di integrità critico.Lasciare la casella selezionata per risolvere automaticamente l'avviso.Nel Nome avviso digitare processo Blocco note rilevatoFare clic sul pulsante puntini di sospensione accanto a Descrizione avviso.Cancellare il contenuto del valore e quindi digitare percorso del file eseguibile: .Fare clic su dati, quindi raccolta, quindi proprietà.Nella variabile di sostituzione << INT >> con "TargetInstance" e << stringa >> con ExecutablePath. Il testo finale nel valore dovrebbe essere percorso del file eseguibile: $Data/Context/Collection["TargetInstance"]/Property[@Name="ExecutablePath"]$Fare clic su OK.Scegliere Crea.Fare doppio clic su errore di evento WMI MyApplication e selezionare proprietà.Nel prima espressione scheda, fare clic su eliminare.Nel seconda espressione scheda, fare clic su eliminare.Fare clic su OK.Event Monitors and Rules Event Monitor Reset Repeating Events Alerts <_caps3a_sxssource locale="en-US">WMI events are created from WMI queries that detect particular actions in the operating system or in applications that create their own WMI events. These events can be used to detect such actions as a process ending, a file being created, or a registry key being modified. WMI events are not persisted. Therefore, any WMI events that are created when the agent service is not running are lost.This guide assumes knowledge of how to build a WMI notification query. For a an overview of this topic and sample queries see Unlocking the Mystery of WMI Events in MOMhttps://go.microsoft.com/fwlink/?LinkID=187607.WMI Event WizardsThe table below lists the wizards that are available for WMI events.Management Pack ObjectWizards AvailableMonitorsSimple Event Detection using each of the standard Event Monitor Reset methodsRepeated Event Detection using each of the standard Event Monitor Reset methodsRulesAlert Generating WMI event ruleEvent collection WMI event ruleWMI Event Wizard OptionsWhen you run a WMI event rule or monitor wizard, you will need to provide values for options in the following tables. Each table represents a single page in the wizard.GeneralThe General page includes general settings for the rule or monitor including its name, category, target, and the management pack file to store it in.OptionDescriptionNameThe name used for the rule or monitor. For a rule, the name appears in the Rules view in the Authoring pane. When you create a view or report, you can select this name to use the data collected by it. For a monitor, the name appears in the Health Explorer of any target objects.DescriptionOptional description of the rule or monitor.Management PackManagement pack file to store the rule or monitor.For more information on management packs, see Selecting a Management Pack.Rule Category (Rules only)The category for the rule. For an event collection rule, this should be Event Collection. For an alerting rule, this should be Alert.Parent Monitor (Monitors only)The aggregate monitor that the monitor will be positioned under in the Health Explorer. For more information, see Aggregate Monitors.TargetThe class to use for the target of the rule or monitor. The rule or monitor will be run on any agent that has at least one instance of this class. For more information on targets, see Targets, Groups, and Objects.Rule is enabledMonitor is enabledSpecifies whether the rule or monitor is enabled.WMI Configuration / WMI Event ProviderThe WMI Configuration Page allows you to provide the WMI namespace, query, and poll interval. There will be a single WMI Configuration page for a collection or alerting rule and for a monitor using manual or timer reset. For a monitor using WMI Event Reset, there will be a WMI Event Provider page to define the query for both the error condition and for the healthy condition.OptionDescriptionWMI NamespaceThe namespace containing the class that is used in the WMI query.QueryWMI notification query that looks for the occurrence of a particular WMI event.Poll IntervalSpecifies how frequently Operations Manager will poll WMI for the occurrence of the event. This value should be the same as the value used in the WITHIN clause of the notification query.WMI matching poll intervalsBuild ExpressionThe Build Expression page allows you to define a filter for the data coming from the WMI query. There will be a single Build Expression page for a WMI event monitor using manual or timer reset. For a monitor using WMI Event Reset, there is an expression for each health state.Because criteria can be specified in the WHERE clause of the WMI query, an expression is frequently not required in a WMI event monitor. It is only required if the query is expected to return multiple records. WMI event rules rely on the criteria in the query itself and don’t allow an expression. The Operations console wizards though require that criteria be specified in WMI Event monitors. If no criteria is required, then dummy criteria must be specified in the wizard and then removed by viewing the properties of the monitor after it is created.The properties available for a WMI event will vary, depending on the kind of event being monitored. The properties available will also vary, depending on the properties of the WMI class included in the query. The data will be in the form of a property bag that has a collection of properties for one or more WMI class instances. WMI events created by using a query that uses either __InstanceCreationEvent or __InstanceDeletionEvent will have a single collection called TargetInstance with the instance being either created or deleted. WMI events created by using __InstanceModificationEvent will have an additional collection called PreviousInstance.The syntax for properties from a WMI event is as follows:Collection[@Name='TargetInstance']/Property[@Name='Caption']For example, the following WMI query monitors for the change in a file that is named c:\MyApp\MyAppLog.txt.SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA 'CIM_DataFIle' AND TargetInstance.Name = 'C:\\MyApp\\MyAppLog.txt'Assuming that data is added to the file changing the file size and triggering the query, examples of properties from this query are shown in the following table:PropertySyntaxOriginal file sizeCollection[@Name=’PreviousInstance’]/Property[@Name='FileSize']New file sizeCollection[@Name=’TargetInstance’]/Property[@Name='FileSize']Auto Reset TimerThe Auto Reset Timer page is only available for timer reset monitors. It allows you to set the time that must pass after the alert is created before the alert is automatically resolved.Configure HealthThe Configure Health page is only available for monitors. It allows you to specify the health state that will be set for each of the events. For a manual reset monitor, the Manual Reset condition will be Healthy, and you can specify whether the Event Raised condition will set the monitor to a Warning or a Critical state. For a Timer Reset or an WMI Event Reset, you can specify the health state set by each event. The first event will typically set the monitor to Warning or Critical while the second event or the timer will set the monitor to Healthy.Configure AlertsThe Configure Alerts page is only available for monitors and alerting rules. Its options are explained in Alerts.Creating WMI event monitors and rulesThe following procedure shows how to create a WMI event monitor in Operations Manager with the following details:Runs on all agents with a particular service installed.Sets the monitor to a critical state when Notepad is started on the agent computer.Sets the monitor to a healthy state when Notepad is ended on the agent computer.This example is not meant to illustrate a real world scenario since there would be minimal value in monitoring when Notepad is started. It does through represent a common scenario of monitoring two different WMI events in a monitor. Using Notepad provides a sample that is easy to test by starting and stopping Notepad on the agent computer.To create a WMI event monitorIf you don’t have a management pack for the application that you are monitoring, create one using the process in Selecting a Management Pack.Create a new target using the process in To create a Windows Service template. You can use any service installed on a test agent for this template.In the Operations console, select the Authoring workspace.Right-click Monitors, select Create a Monitor, and then select Unit Monitor.On the Monitor Type page, do the following:Expand WMI Events, then Simple Event Detection, and then WMI Event Reset.Select the management pack from step 1.Click Next.On the General page, do the following:In the Name box, type MyApplication WMI Event Error.Click Select next to the Monitor Target box.Next to Monitor Target click Select and then select the name of the target that you created in step 2.In the Parent Monitor box, select Availability.Leave the Monitor is enabled box checked , select and click Next.On the First WMI Event Provider page, do the following:In the WMI Namespace box, type root\cimv2.In the Query box, type the following WMI query.Select * From __InstanceCreationEvent WITHIN 60 Where TargetInstance ISA 'Win32_Process' and TargetInstance.Name = 'notepad.exe'In the Poll Interval box, type 60.Click Next.On the Build First Expression page, do the following:In this example, criteria is included in the WMI query, so no expression is required in the monitor. Since the WMI event wizard in the Operations console requires an expression for each event, dummy expressions will be provided to complete the wizard and then deleted once the monitor is created.Click Insert.In the Parameter Name box type Dummy.In the Operator box select Equals.In the Value box type Dummy.Click Next.On the Second WMI Event Provider page, do the following:In the WMI Namespace box, type root\cimv2.In the Query box, paste the following WMI query.Select * From __InstanceDeletionEvent WITHIN 60 Where TargetInstance ISA 'Win32_Process' and TargetInstance.Name = 'notepad.exe'In the Poll Interval box, type 60.Click Next.On the Second Expression page, do the following:Click Insert.In the Parameter Name box type Dummy.In the Operator box select Equals.In the Value box type Dummy.Click Next.On the Configure Health page, do the following:Next to FirstEventRaised, change the Health State to Critical.Click Next.On the Configure Alerts page, do the following:Check Generate alerts for this monitorIn the Generate an alert when box, select The monitor is in a critical health state.Leave the box selected to automatically resolve the alert.In the Alert name box, type Notepad process detectedClick the ellipse button next to Alert description.Clear the contents of the Value box and then type Path of executable: .Click Data, then Collection, then Property.In the variable, replace <<INT>> with "TargetInstance" and <<STRING>> with ExecutablePath. The final text in the Value box should be Path of executable: $Data/Context/Collection["TargetInstance"]/Property[@Name="ExecutablePath"]$Click OK.Click Create.Right-click MyApplication WMI Event Error and select Properties.On the First Expression tab, click Delete.On the Second Expression tab, click Delete.Click OK.Event Monitors and Rules Event Monitor Reset Repeating Events Alerts