Ad Widget

Collapse

How to get an IP address from a string with preprocessing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mellis
    Senior Member
    • Oct 2017
    • 145

    #1

    How to get an IP address from a string with preprocessing

    Good Morning

    I need a help in getting an IP address from a string. My problem is we have a web site hosted behind a forigate load balancer. The forigate will not allow us to use a FQDN, only an IP address. The host from time to time decides to change the IP of the VM that host the two load balanced web servers. I am using the item net.dns.record to return the IP from the DNS server. My return value looks like:
    2021-07-30 08:32:13 internal-ca-we-prdprivate-alb-1120804323.us-gov-west-1.elb.amazonaws.com A 10.0.12.176
    internal-ca-we-prdprivate-alb-1120804323.us-gov-west-1.elb.amazonaws.com A 10.0.11.188
    I would like to use the preprocessing to only collect the IP addresses.

    I am using the 4.4.10 server and proxies.


    Thanks
  • Glencoe
    Zabbix developer
    • Oct 2019
    • 152

    #2
    You can use some regex like this
    Code:
    A\s(\d.+?)\n.*A\s(\d.+?)$
    Not ideal but will work for your lines - and if there are two lines and you need two addresses in the output:

    Click image for larger version

Name:	Screenshot 2021-07-30 at 19.00.10.png
Views:	799
Size:	32.3 KB
ID:	429011

    Comment

    Working...