Update of /cvsroot/nagios-db/nagios-db/ui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14302
Modified Files:
mysql_control.php pgsql_control.php sections.html
Log Message:
rudimentary support for host details
Index: pgsql_control.php
===================================================================
RCS file: /cvsroot/nagios-db/nagios-db/ui/pgsql_control.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pgsql_control.php 26 Jan 2005 03:01:38 -0000 1.3
+++ pgsql_control.php 10 Feb 2005 23:43:01 -0000 1.4
@@ -26,7 +26,6 @@
$this->Shared->Init($options);
}
-
/* supporting tac.php */
function tac($type)
{
@@ -296,6 +295,44 @@
}
+ function hostHistory($startTime, $stopTime, $host)
+ {
+ $sql = "select host_history.started,coalesce(host_history.lasted,now()::abstime::int4-host_history.started) as lasted,host_history.soft_state,host_history.plugin_output from host_history,host where host_history.hostid = host.id and host.name='$host'";
+
+ if ($startTime != "null")
+ {
+ $sql = $sql . " and started + coalesce(lasted,0) > $startTime";
+ }
+
+ if ($stopTime != "null")
+ {
+ $sql = $sql . " and started < $stopTime";
+ }
+
+ $sql = $sql . " order by started desc";
+
+ return $this->Shared->query($sql);
+ }
+
+ function serviceHistory($startTime, $stopTime, $host)
+ {
+ $sql = "select service.service_description,service_history.started,coalesce(service_history.lasted,now()::abstime::int4-service_history.started) as lasted,service_history.soft_state,service_history.plugin_output from service_history,service,host where service_history.serviceid = service.id and service.hostid = host.id and host.name = '$host'";
+
+ if ($startTime != "null")
+ {
+ $sql = $sql . " and started + coalesce(lasted,0) > $startTime";
+ }
+
+ if ($stopTime != "null")
+ {
+ $sql = $sql . " and started < $stopTime";
+ }
+
+ $sql = $sql . " order by serviceid,started desc";
+
+ return $this->Shared->query($sql);
+ }
+
/* supporting hostAvailabilityHostgroup data.php */
function hostAvailabilityHostgroup($startTime, $stopTime, $hostgroups)
{
Index: sections.html
===================================================================
RCS file: /cvsroot/nagios-db/nagios-db/ui/sections.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sections.html 2 Jan 2005 22:51:51 -0000 1.2
+++ sections.html 10 Feb 2005 23:43:01 -0000 1.3
@@ -8,6 +8,7 @@
<a href="/neb/hostAvailabilityService/selector.php" target="lower">Host Availability, By Service</a><br>
<a href="/neb/serviceAvailabilityHostgroup/selector.php" target="lower">Service Availability, By Hostgroup</a><br>
<a href="/neb/serviceAvailabilityService/selector.php" target="lower">Service Availability, By Service</a><br>
+<a href="/neb/hostDetails/selector.php" target="lower" target="lower">Host Details</a><br>
</body>
</html>
Index: mysql_control.php
===================================================================
RCS file: /cvsroot/nagios-db/nagios-db/ui/mysql_control.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mysql_control.php 1 Feb 2005 05:53:52 -0000 1.4
+++ mysql_control.php 10 Feb 2005 23:43:01 -0000 1.5
@@ -1032,6 +1032,46 @@
return $this->Shared->query($sql);
}
+ function hostHistory($startTime, $stopTime, $host)
+ {
+ $sql = "select host_history.started,coalesce(host_history.lasted,unix_timestamp()-host_history.started) as lasted,host_history.soft_state,host_history.plugin_output from host_history,host where host_history.hostid = host.id and host.name='$host'";
+
+ if ($startTime != "null")
+ {
+ $sql = $sql . " and started + coalesce(lasted,0) > $startTime";
+ }
+
+ if ($stopTime != "null")
+ {
+ $sql = $sql . " and started < $stopTime";
+ }
+
+ $sql = $sql . " order by started desc";
+
+ return $this->Shared->query($sql);
+ }
+
+ function serviceHistory($startTime, $stopTime, $host)
+ {
+ $sql = "select service.service_description,service_history.started,coalesce(service_history.lasted,unix_timestamp()-service_history.started) as lasted,service_history.soft_state,service_history.plugin_output from service_history,service,host where service_history.serviceid = service.id and service.hostid = host.id and host.name = '$host'";
+
+ if ($startTime != "null")
+ {
+ $sql = $sql . " and started + coalesce(lasted,0) > $startTime";
+ }
+
+ if ($stopTime != "null")
+ {
+ $sql = $sql . " and started < $stopTime";
+ }
+
+ $sql = $sql . " order by serviceid,started desc";
+
+ return $this->Shared->query($sql);
+ }
+
+
+
/* supporting hostAvailabilityHostgroup data.php */
function hostAvailabilityHostgroup($startTime, $stopTime, $hostgroups)
|