ipwatch
ipwatch copied to clipboard
Suggestion: Report local IP as well
Make it report local ip's as well, or an config option as to what interfaces to do an additional check for ip changes.
Example: Someone else is moving a server to a new network, gets new ip, it gets internet connectivity, send an email about the external and internal ip's. (its behind a firewall, cant connect externally) Then when I'm at site connecting locally thru same network, I already know the ip. no need to do a netscan.
A hostname can kinda "do" the same thing, but for me its better to know the ip than the hostname.
Thank you for the suggestion @SuperHofstad. It is a good one. At this time I probably won't add that feature as I'm busy with other projects but I'll keep this suggestion open against the day that I find the time. Feel free to implement the feature yourself and submit a pull request.
This could be done using the same email functionality built into the software but driven by hostname -i
or hostname -I
or ifconfig
or ip address
+ some grep
work. It might be a bit complicated by the fact that different distros support different commands and formats.
I needed the local IP address too, so implemented it in my own fork of this repo. It's not clean enough to be ready for a pull request, but it does work.
Thanks @begleysm for this useful code.
Thanks @carolmanderson! And you're welcome!
I've been a bit hesitant to attack this since my, limited, research suggested that it is difficult to make it platform independent and reliable. Although I found the comment in the link you provided in the code (https://stackoverflow.com/a/28950776). It looks like people are having pretty good results with this solution.
And as to the code not being "clean enough". I'm an EE, not a CC, so it looks fine to me! I'd accept a pull request if you submitted one.