Skip to content

Fun with Conky, part 3

All the way back in October 2007 I made two posts about conky, a lightweight and highly configurable system monitor for your desktop.

I still use conky and love it. My configuration changes regularly, especially the colors, but you can get the basic idea from the config files I included in the earlier posts. There is one change I made recently that I would like to highlight because I think others will appreciate it.

Originally, and for many months, I had a line in the configuration that would query a specific website to get my public IP address. I appreciate whatismyip.org allowing people to do this. At the same time, the service has some limitations that I wanted to bypass. For example, you are limited to the number of queries per unit of time, and occasionally I would end up with a conky that included an ugly html page smeared over my desktop instead of a pretty set of IP numbers.

How to fix it?

I decided to do what any good geek would do and make my own IP query site. I won’t share the location, simply because I can’t afford to have 10,000 requests per hour hitting my web server. However, this is something that anyone with web hosting space can do. It is simple.

I just made an unbelievably short php file and uploaded it to my web server. Here is what it contains.

<? $remote = $_SERVER[“REMOTE_ADDR”]; echo $remote; ?>

Yep, that’s it. Put that in a file on your web server with a name like myip.php and test it out by pointing your browser there. If you get your IP address as the response, you are set. Add something like this to your conky file and you are good to go.

${color #FEB60D}Public IP ${color #FECE0D}${execi 360 curl ‘http://yourwebaddress_notmine.com/myip.php’}

4 Comments

  1. If your NAT supports UPnP, you can retrieve the WAN IP address using the GetExternalIPAddress method. Much saner!

  2. John

    Great tip! This very same problem had been niggling at me for a while – never thought to just set up a script on my own website. Thanks a lot 🙂

  3. Nick Presta

    I like,

    `wget -q -O – whatismyip.com/automation…

    🙂

Comments are closed.