$(document).ready(function(){ function get_chef_attributes(hostname) { $.getJSON('node/'+hostname, function(attributes) { var roles = ''; $.each(attributes['automatic']['roles'], function() { roles += this + ' '; }); $('.chef_attributes').html( 'Node Name:
'+attributes['name']+'
'+attributes['automatic']['ec2']['public_ipv4']+'
'+roles+'' ); }); } ws = new WebSocket("ws://" + location.hostname + ":9000"); ws.onmessage = function(evt) { $("#messages").empty(); $("#popups_container").empty(); data = JSON.parse(evt.data); for(var msg in data) { var status = ''; if(data[msg]['status'] == 'CRITICAL') { status = "Critical"; } else { status = "Warning"; } var last_time_ok = new Date(data[msg]['last_time_ok'] * 1000); var last_check = new Date(data[msg]['last_check'] * 1000); $("#messages").append('
'+data[msg]['check_command']+'
'+plugin_output+'