nri-flex icon indicating copy to clipboard operation
nri-flex copied to clipboard

enhancement to parse_html

Open haihongren opened this issue 1 year ago • 2 comments

enhancement

  • added parse_html_attributes function to allow html element attribute to be parsed and included in the value, for example: class of the element

Use case Google cloud service status web site uses class to show the status of the service. https://status.cloud.google.com/

Working Example: GCP status

integrations:
  - name: nri-flex
    config:
      name: gcpStatus
      apis:
        - name: gcpStatus
          event_type: gcpStatus
          url: https://status.cloud.google.com/
          parse_html: true
          parse_html_attributes: 
            class: .*
          
          remove_keys: 
            - class
            - style
            - index
          
          value_mapper:
            Americas  regions:
                - (__cell;$)=>N/A
                - (.*__available;.*)=>Normal
                - (.*__information;.*)=>Info         
                - (.*__warning;.*)=>Warning
            Asia Pacific  regions:
                - (__cell;$)=>N/A
                - (.*__available;.*)=>Normal
                - (.*__information;.*)=>Info
                - (.*__warning;.*)=>Warning                                 
            Europe  regions:
                - (__cell;$)=>N/A
                - (.*__available;.*)=>Normal
                - (.*__information;.*)=>Info    
                - (.*__warning;.*)=>Warning                              
            Global:
                - (__cell;$)=>N/A
                - (.*__available;.*)=>Normal   
                - (.*__information;.*)=>Info    
                - (.*__warning;.*)=>Warning                                                                           
            Multi regions:
                - (__cell;$)=>N/A
                - (.*__available;.*)=>Normal 
                - (.*__information;.*)=>Info  
                - (.*__warning;.*)=>Warning                                 
            Products: 
                - (.*;)(.*)=>$2                                                            

haihongren avatar Sep 12 '22 23:09 haihongren