def update_juliabox_status(): in_error = len( JBoxInstanceProps.get_stale_instances(Compute.get_install_id())) instance_status = JBoxInstanceProps.get_instance_status( Compute.get_install_id()) HTML = "<html><body><center><pre>\nJuliaBox is Up.\n\nLast updated: " + datetime.datetime.now( ).isoformat() + " UTC\n\nLoads: " for iid in instance_status: HTML += (str(instance_status[iid]['load']) + '% ') HTML += ( "\n\nErrors: " + str(in_error) + "\n\nAWS Status: <a href='http://status.aws.amazon.com/'>status.aws.amazon.com</a></pre></center></body></html>" ) plugin = JBPluginCloud.jbox_get_plugin(JBPluginCloud.JBP_BUCKETSTORE) bkt = JBoxCfg.get("cloud_host.status_bucket") if plugin is not None and bkt is not None: try: f = open("/tmp/index.html", "w") f.write(HTML) f.close() plugin.push(bkt, "/tmp/index.html") finally: os.remove("/tmp/index.html") else: JBox.log_debug("Status: %s", HTML) return None
def update_juliabox_status(): in_error = len(JBoxInstanceProps.get_stale_instances(Compute.get_install_id())) instance_status = JBoxInstanceProps.get_instance_status(Compute.get_install_id()) HTML = "<html><body><center><pre>\nJuliaBox is Up.\n\nLast updated: " + datetime.datetime.now().isoformat() + " UTC\n\nLoads: " for iid in instance_status: HTML += (str(instance_status[iid]['load']) + '% ') HTML += ("\n\nErrors: " + str(in_error) + "\n\nAWS Status: <a href='http://status.aws.amazon.com/'>status.aws.amazon.com</a></pre></center></body></html>") plugin = JBPluginCloud.jbox_get_plugin(JBPluginCloud.JBP_BUCKETSTORE) bkt = JBoxCfg.get("cloud_host.status_bucket") if plugin is not None and bkt is not None: try: f = open("/tmp/index.html", "w") f.write(HTML) f.close() plugin.push(bkt, "/tmp/index.html") finally: os.remove("/tmp/index.html") else: JBox.log_debug("Status: %s", HTML) return None