Skip to main content

Hi all



Can anyone advise me how to create an extension attribute that will record the result of the command curl ifconfig.me



Many thanks
Andy

You need to set it to be script populated and use:



result=$(curl ifconfig.me)
echo "<result>$result</result>"


I thought the public IP address was in the inventory anyway?


Hi @May,



Give this a try.



#!/bin/sh
externalIP=$(curl ifconfig.me)
echo "<result>$externalIP</result>"
exit 0


EDIT: @davidacland beat me to it!


@davidacland @kitzy



The inventory only shows the Macs ip address and the IP address of our firewall (when the machine is outside our network)



Thank you!
Andy


@May I think there's a way to set up the JSS to report the actual external IP address of the client, and not the firewall by adjusting something on the JSS, but it escapes me now. Been a long time since I did it or learned about it now.
Because the JSS should be reporting this natively if set up correctly, which would mean an EA for this isn't necessary. That site for me is horribly slow. It can take upwards of 10-12 seconds for a response to come back even from curl. It might just be our company network though.


It should be in the tomcat settings:



Enable Remote IP Valve
Ensure that the JSS resolves originating IP addresses instead of apparent client IP addresses when behind a load balancer


@davidacland Thanks, that's what I was thinking of. Yes, if that's enabled, the IP address should get resolved from the client and not the load balancer.


Thanks @davidacland @mm2270



I'll give this a whirl and report back



Cheers again!
Andy