1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #!/usr/bin/env python """LXC monitor indicator.""" import appindicator import commands import gtk if __name__ == "__main__": def on_timer(args=None): lxc_number = str(len(commands.getstatusoutput("lxc-ls --running")[1].split("\n"))) ind.set_label(lxc_number) item.set_label(commands.getstatusoutput("lxc-ls -f")[1]) return True ind = appindicator.Indicator( "lxc-monitor", "monitor", appindicator.CATEGORY_APPLICATION_STATUS) ind.set_status (appindicator.STATUS_ACTIVE) ind.set_label("..."); menu = gtk.Menu() item = gtk.MenuItem("...") item.show() menu.append(item) ind.set_menu(menu) gtk.timeout_add(1000, on_timer) gtk.main() |
Hello and thanks for visiting my blog! Here you'll find some of the code I write, some of the technologies I use and like and some things I think it's important to remember. Have fun! :)
Tuesday, December 16, 2014
Simple LXC status indicator
Here is a simple indicator to monitor the status of the LXC running on the machine, works perfectly on Ubuntu 14.04:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment