NIXVALIS
Nixvalis es un servicio de valor añadido para los clientes del centro de datos. Permite conocer el estado de tus equipos en tiempo real con un simple lector RSS.
Se trata de una pasarela entre el cliente y el servicio de monitorizacion de las instalaciones.
Con:
- OK - El servidor tiene conectividad
- CAIDO - Posibles problemas
Solicita una cuenta de acceso y mandanos tu opinión.
Descargar
El paquete de extraccion de datos lo forman:
-rw-rw-rw- root/root 123 2009-09-27 10:52:13 array.php -rw-rw-rw- root/root 324 2009-09-26 19:07:48 config.php -rw-rw-rw- root/root 3516 2009-09-22 16:58:38 parser.php
Descargar fuente beta1
La parte principal del software esta basado en un parser para los .dat de ejecucion del Nagios. Principalmente se usan dos funciones:
- get_nagios_status (file): a la que se le pasa la ruta del fichero status.dat
- get_nagios_hostgroups (file): a la que se le pasa el fichero de config en memoria - objects.cache
El hostgroups del nagios determina, realmente, los host disponibles del cliente.
Sobre parser.php:
<?php
#
# Aaron M. Segura 07/07/2006
#
# Function(s) to parse the nagios status file into an array
#
function get_nagios_status($file)
{
$status = array();
if ( file_exists($file) )
{
$data = file($file);
foreach ( $data as $line )
{
$line = rtrim($line);
if ( preg_match('/^[A-Za-z]* \{/', $line) )
{
// section header
$key = split(" ", $line);
$index = $key[0];
}
else
if ( preg_match('/[a-z_A-Z]+=/', $line) )
{
$list = explode("=", trim($line));
$key = $list[0];
$val = implode("=", array_slice($list,1));
// list($key, $val) = split("=", trim($line));
switch($index)
{
case "info":
case "program":
$status["$index"]["$key"] = $val;
break;
case "hoststatus":
if ( $key == "host_name" )
{
$status["hosts"][] = $val;
$status["$val"] = array();
$current_host = $val;
}
else
$status["$current_host"]["$key"] = $val;
break;
case "servicestatus":
switch($key)
{
case "host_name":
$current_host = $val;
break;
case "service_description":
$current_svc = $val;
$status["$current_host"]["services"][] = $val;
$status["$current_host"]["$val"] = array();
break;
default:
$status["$current_host"]["$current_svc"]["$key"] = $val;
}
break;
}
}
else
if ( preg_match("/\}$/", $line) || preg_match("/^$/", $line) )
$current_host = $current_svc = NULL;
} // Foreach
return($status);
} // if (Status Log Exists)
else
return(NULL);
} // end function
#
# Jose Luis Salas 15/09/2009
#
# Function(s) to parse the nagios config file into an array (to extract hostgroup)
#
function get_nagios_hostgroups($file)
{
$status = array();
if ( file_exists($file) ){
$data = file($file);
foreach ( $data as $line ){
$line = trim($line);
if ( preg_match('/^[A-Za-z]+ [A-Za-z]+ \{/', $line) ){
$key = split(" ", $line);
$index = $key[1];
if ( $index != "hostgroup" ) {continue;}
}else if ( preg_match('/^[a-z_A-Z]+\s+/', $line) ) {
$line = str_replace("\t",' ',$line);
$list = explode(" ", trim($line));
$key = $list[0];
$val = $list[count($list)-1];
switch($index) {
case "hostgroup":
if ( $key == "members") {
$status["$current_host"] = explode(',',$val);
} else if ($key == "hostgroup_name") {
$current_host = $val;
}
}
} else if ( preg_match("/\}$/", $line) || preg_match("/^$/", $line) )
$current_host = NULL;
} // Foreach
return($status);
} // if (Status Log Exists)
else
return(NULL);
} // end function
?>Widgets para Mac OS XEn Dashboard (Mac Os 10.4.x o sup): ![]() Descargar widget para Apple 10.4.x |
App para AndroidPara Android 1.6 (o sup): ![]() Descargar aplicacion para Android |

