Posted on 04-10-2015 08:54 AM
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
Solved! Go to Solution.
Posted on 04-10-2015 08:58 AM
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?
Posted on 04-10-2015 09:01 AM
Hi @May,
Give this a try.
#!/bin/sh
externalIP=$(curl ifconfig.me)
echo "<result>$externalIP</result>"
exit 0
EDIT: @davidacland beat me to it!
Posted on 04-10-2015 08:58 AM
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?
Posted on 04-10-2015 09:01 AM
Hi @May,
Give this a try.
#!/bin/sh
externalIP=$(curl ifconfig.me)
echo "<result>$externalIP</result>"
exit 0
EDIT: @davidacland beat me to it!
Posted on 04-10-2015 09:05 AM
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
Posted on 04-10-2015 09:13 AM
@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.
Posted on 04-10-2015 09:17 AM
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
Posted on 04-10-2015 09:38 AM
@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.
Posted on 04-10-2015 09:44 AM