EMC M&R/SRM: How do I configure a Variable Handling Filter for EMC M&R/SRM(Watch4net 6.4)?
search cancel

EMC M&R/SRM: How do I configure a Variable Handling Filter for EMC M&R/SRM(Watch4net 6.4)?

book

Article ID: 304683

calendar_today

Updated On:

Products

VMware

Environment

VMware Smart Assurance - Watch4Net/M&R

Resolution

What is the Variable Handling Filter for EMC M&R/SRM and how do I configure one?
This article explains the function and use of the Variable Handling Filter for EMC M&R/SRM, with an example case that shows how to configure a filter that will filter for the variable Windows from the devdesc data that is coming into the emc-smarts collector.


 

The EMC M&R/SRM Variable Handling Filter is used to filter objects at the collector level to the before the backend. The following sections explain the requirements for configuring a Variable Handling Filter for EMC M&R, followed by an Example Case procedure for setting up a Variable Handling Filter.

 EMC M&R / SRM collecting service configuration
The Variable Handling Filter for EMC M&R/SRM must be added in the main collecting.xml configuration file (<APG>/Collecting/Collector-Manager/<INSTANCE>/conf/collecting.xml). Add the following section if it is not present, and make sure that the enabled attribute is set to true:

<filters>
...
<filter name="Variable-Handling-Filter" next="Backend" config="Variable-Handling-Filter/
Default/conf/variable-handling-filter.xml" />
...
</filters>

Filter configuration file
This file is the main configuration file for the filter. It contains information about the way variables will be matched and how they will be handled if a match occurs. The administrator must decide how to name this file and make sure that the selected filter configuration file name is used to configure the filter in the collecting.xml file.

Global structure of the XML configuration file
The XML tags used to form the global structure of the XML configuration file are as follows:

  • <configuration end-policy=end-policy>: The main XML container tag for the collector configuration. Every other tag must be nested inside this one. The optional end-policy attribute represents the handler that will be used once a variable has passed through all matcher/handler pairs. The default value is the PushAllHandler.
  • <handling-configuration id=id>: Defines a new handler/matcher pair. The id attribute is used to uniquely identify this pair.
  • <matcher class=class>: Defines the matcher that will be used. The class attribute is optional, and it represents the java class that will be used as a matcher. If omitted, the default value is the APGFilterMatcher.
  • <parameter [type=string"file] name=name>: Defines a parameter that will be passed to the matcher. The type parameter is optional and is used to specify the parameter type. A string will be used as is, while a file will resolve relative paths from the collector's working directory. The default value is string.
  • <handler class=class>: Defines the handler that will be used if a match occurs. The class attribute is required, and it represents the Java class that will be used as a handler.
  • <parameter [type=string"file] name=name>: Defines a parameter that will be passed to the handler. The type parameter is optional and is used to specify the parameter type. A string will be used as is, while a file will resolve relative paths from the collector's working directory. The default value is string.
  • <parameter [type=string"file] name=name>: Defines a parameter that will be passed to the pair (not used very often). The type parameter is optional and is used to specify the parameter type. A string will be used as is, while a file will resolve relative paths from the collector's working directory. The default value is string.

Example Case
In the following case example, we will filter the word Windows from the devdesc data that is coming into the emc-smarts collector.

  1. From the command prompt open collecting.xml with a text editor:

     /opt/APG/Collecting/Collector-Manager/emc-smarts/conf/collecting.xml
     
  2. You will see the code is similar to the following example:
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://www.watch4net.com/APG/Collecting" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation=
"
http://www.watch4net.com/APG/Collectingcollecting.xsd ">
        <connectors>
                <connector enabled="true" name="Backend" type="Socket-Connector" config="conf/socketconnector.xml" />
                <connector enabled="true" name="Alerting" type="Socket-Connector" config="conf/alertingconnector.xml" />
        </connectors>
  <filters>
                <filter enabled="true" name="FailOver" next="Backend" config="FailOver-Filter/emc-smarts/conf/failover-backend.xml" />
                <filter enabled="true" name="IgnoreErrors" next="Alerting" type="Ignore-Errors-Filter" config="Collector-Manager/emc-smarts/" />
                <filter enabled="true" name="DataEnrichment" next="FailOver IgnoreErrors" config="Property-Tagging-Filter/emc-smarts/conf/property-tagging-filter.xml" />
 </filters>
        <collectors>
                <collector enabled="true" name="emc-smarts" next="DataEnrichment" type="Sm-Discovery" config="Smarts-Collector/emc-smarts/conf/sm-discovery.xml" />
        </collectors>
</config>
  1. Find the collectors tag for where in this case name="emc-smarts" from the following example:
<collectors>

                <collector enabled="true" name="emc-smarts" next="DataEnrichment" type="Sm-Discovery" config="Smarts-Collector/emc-smarts/conf/sm-discovery.xml" />

</collectors>
  1. Edit the next="DataEnrichment" statement to reflect a new filter. In this case, we will change it to VHF-Block-Windows making it unique to this instance from the following example:
<collectors>
                <collector enabled="true" name="emc-smarts" next="VHF-Block-Windows" type="Sm-Discovery" config="Smarts-Collector/emc-smarts/conf/sm-discovery.xml" />
</collectors>
  1. Find the filters tag from the following example:
<filters>
<filter enabled="true" name="FailOver" next="Backend" config="FailOver-Filter/emc-smarts/conf/failover-backend.xml" />
<filter enabled="true" name="IgnoreErrors" next="Alerting" type="Ignore-Errors-Filter" config="Collector-Manager/emc-smarts/" />
<filter enabled="true" name="DataEnrichment" next="FailOver IgnoreErrors" config="Property-Tagging-Filter/emc-smarts/conf/property-tagging-filter.xml" />
</filters>
  1. Add a filters tag. In this case, name="VHF-Block-Windows" as per following example:
<filter enabled="true" name="VHF-Block-Windows" next="DataEnrichment" config="Variable-Handling-Filter/Default/conf/variable-handling-filter.xml" />
  1. The filters section should now look like the following example:
<filters>
<filter enabled="true" name="FailOver" next="Backend" config="FailOver-Filter/emc-smarts/conf/failover-backend.xml" />
<filter enabled="true" name="IgnoreErrors" next="Alerting" type="Ignore-Errors-Filter" config="Collector-Manager/emc-smarts/" />
<filter enabled="true" name="DataEnrichment" next="FailOver IgnoreErrors" config="Property-Tagging-Filter/emc-smarts/conf/property-tagging-filter.xml" />
<filter enabled="true" name="VHF-Block-Windows" next="DataEnrichment" config="Variable-Handling-Filter/Default/conf/variable-handling-filter.xml" />
</filters>
  1. Save the file.
     
  2. To add the filtering information referenced in the collecting.xml from above, use a command prompt to open variable-handling-filter.xml with a text editor:
 /opt/APG/Collecting/Variable-Handling-Filter/Default/conf/variable-handling-filter.xml
  1. You will then see something similar to the following example:
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="
http://www.watch4net.com/VariableHandlingFilter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation=
"
http://www.watch4net.com/VariableHandlingFiltervariable-handling-filter.xsd ">   
          <!-- Block data -->
             <handling-configuration id="Block">
                <matcher class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.matchers.APGFilterMatcher">
                        <parameter name="filter">device=='devblock'</parameter>
                </matcher>
                <handler class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.handlers.BlockAllHandler" />
              </handling-configuration>  
           <!-- Apply arithmetic operations. -->
            <handling-configuration id="Arithmetic">
               <matcher>
                        <parameter name="filter">name=='noname'</parameter>
                </matcher>
                <handler class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.handlers.PropertyArithmeticHandler">
                        <parameter name="file" type="file">conf/property-arithmetic-handler.xml</parameter>
                </handler>
        </handling-configuration>      
          <!-- Property extraction. -->
        <handling-configuration id="Extraction">
                <matcher class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.APGFilterMatcher">
                        <parameter name="filter">devtype=='type'</parameter>
                </matcher>
                <handler class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.PropertyExtractionHandler">
                        <parameter name="file" type="file">conf/property-extraction-handler.xml</parameter>

                </handler>
        </handling-configuration>    
          <!-- Regex replace. -->
    <handling-configuration id="Regex">
        <matcher class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.APGFilterMatcher">
            <parameter name="filter">devtype=='regex'</parameter>
        </matcher>
        <handler class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.ReplaceRegexHandler">
            <parameter name="property">toreplace</parameter>
            <parameter name="regex">ab[^c]def</parameter>
            <parameter name="replacement">abcdef</parameter>
        </handler>
    </handling-configuration>
</configuration>
  1. Add your filter with the values that you want to block as per the following example:
        <!-- Block Windows data -->
        <handling-configuration id="Block">
                <matcher class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.matchers.APGFilterMatcher">
                        <parameter name="filter">devdesc='%Windows%')</parameter>
                </matcher>

                <handler class="com.watch4net.apg.v2.collector.plugins.variablehandlingfilter.
handlers.BlockAllHandler" />
        </handling-configuration>
  1. The added statement should look like this in the file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="
http://www.watch4net.com/VariableHandlingFilter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation=
"
http://www.watch4net.com/VariableHandlingFiltervariable-handling-filter.xsd ">    
       <!-- Block data -->
       <handling-configuration id="Block">
                <matcher class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.matchers.APGFilterMatcher">
                        <parameter name="filter">device=='devblock')</parameter>
                </matcher>
                <handler class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.handlers.BlockAllHandler" />
        </handling-configuration>  
      <!-- Block Windows data -->
        <handling-configuration id="BlockWindows">
                <matcher class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.matchers.APGFilterMatcher">
                        <parameter name="filter">devdesc='%Windows%'</parameter>
                </matcher>
                <handler class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.handlers.BlockAllHandler" />
        </handling-configuration> 

       <!-- Apply arithmetic operations. -->
        <handling-configuration id="Arithmetic">
                <matcher>
                        <parameter name="filter">name=='noname'</parameter>
                </matcher>
                <handler class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.handlers.PropertyArithmeticHandler">
                        <parameter name="file" type="file">conf/property-arithmetic-handler.xml</parameter>
                </handler>
        </handling-configuration>   
     <!-- Property extraction. -->
        <handling-configuration id="Extraction">
                <matcher class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.APGFilterMatcher">
                        <parameter name="filter">devtype=='type'</parameter>

                </matcher>
                <handler class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.PropertyExtractionHandler">
                        <parameter name="file" type="file">conf/property-extraction-handler.xml</parameter>
                </handler>
        </handling-configuration>   
        <!-- Regex replace. -->
    <handling-configuration id="Regex">
        <matcher class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.APGFilterMatcher">
            <parameter name="filter">devtype=='regex'</parameter>
        </matcher>
        <handler class="com.watch4net.apg.v2.collector.plugins.
variablehandlingfilter.ReplaceRegexHandler">
            <parameter name="property">toreplace</parameter>
            <parameter name="regex">ab[^c]def</parameter>
            <parameter name="replacement">abcdef</parameter>
        </handler>
    </handling-configuration>
</configuration>
  1. Save the file.
     
  2. When the filter is installed and configured, EMC M&R / SRM is ready to handle variables as configured.
  3. Re-start the EMC M&R / SRM collecting service for the collecting instance you have setup.