Icinga Koji Monitoring Page + Greasemonkey Script

Following up on my work with the Koji Icinga/Nagios based monitoring system for our Fedora ARM machines: A screenshot of how it looks along with a GM script that helped to make it look like that. The Perl script I made in an earlier post checks for some of the following errors that could cause a Koji builder to fail. And on an semi-related note, if you’d like to follow our build progress, I’m currently testing a Twitter script posting here: http://twitter.com/fedoraarmstats

 

  • Any non-rw mount points
  • Permissions and sizes for directories: [/, /var, /tmp, /var/{lib,cache}/mock]
  • Running kojid systemd/systemctl cgroup process numbers, commands
  • Koji config file, cert date, system time checks
  • Koji host, enabled, ready, not-ready+tasks, update-time, task-times

 

// ==UserScript==
// @name        icinga
// @namespace   icinga-dev
// @include     http://hongkong.proximity.on.ca/icinga/cgi-bin/status.cgi?host=all*
// @version     1
// ==/UserScript==

var cnmatch = false, globflag = false;
var tablelist = document.getElementsByTagName("table");
var bodylist = [], rowlist = [], collist = [];
var regxobjc = new RegExp("Koji Stat", "g");

for (var tableitem in tablelist)
{
	try { cnmatch = tablelist[tableitem].className.match(/^.*status.*$/); }
	catch(erro) { cnmatch = false; }
	
	if (cnmatch)
	{
		bodylist = tablelist[tableitem].childNodes;
		
		for (var bodyitem in bodylist)
		{
			try { cnmatch = (bodylist[bodyitem].nodeName.toLowerCase() == "tbody"); }
			catch(erro) { cnmatch = false; }
			
			if (cnmatch)
			{
				var lastclas = "", lastvalu = "";
				
				rowlist = bodylist[bodyitem].childNodes;
				
				for (var rowitem in rowlist)
				{
					var rowflag = true;
					var colnumb = 0, colobjc = null;
					
					try { cnmatch = (rowlist[rowitem].nodeName.toLowerCase() == "tr"); }
					catch(erro) { cnmatch = false; }
					
					if (cnmatch)
					{
						collist = rowlist[rowitem].childNodes;
						
						for (var colitem in collist)
						{
							try { cnmatch = (collist[colitem].nodeName.toLowerCase() == "td"); }
							catch(erro) { cnmatch = false; }
							
							if (cnmatch)
							{
								if (colnumb == 0)
								{
									if (collist[colitem].innerHTML != "")
									{
										lastvalu = collist[colitem].innerHTML;
									}
									
									else
									{
										colobjc = collist[colitem];
									}
								}
								
								if (colnumb == 1)
								{
									if (!collist[colitem].innerHTML.match(regxobjc))
									{
										rowflag = false;
									}
								}
								
								lastclas = collist[colitem].className;
								++colnumb;
							}
						}
						
						if ((colobjc != null) && (colnumb > 3))
						{
							lastvalu = lastvalu.replace(/class=['"]status[^'"]+['"]/g, lastclas);
							colobjc.innerHTML = lastvalu;
							colobjc.className = lastclas;
						}
					}
					
					if ((rowflag == false) || ((0 < colnumb) && (colnumb < 4)))
					{
						try { rowlist[rowitem].style.display = "none"; }
						catch(erro) { cnmatch = false; }
					}
				}
			}
		}
	}
}

Advertisements
Icinga Koji Monitoring Page + Greasemonkey Script

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s