summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2004-09-16 20:25:50 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2004-09-16 20:25:50 +0000
commit140d7a7de72b6a69f9b08e7f09e794b2765c2804 (patch)
tree4e96002628be213a0af0bf18254984e540e0eb16
parent6e3f49e2f74f219768745695167b50c523ca4130 (diff)
downloadzabbix-140d7a7de72b6a69f9b08e7f09e794b2765c2804.tar.gz
zabbix-140d7a7de72b6a69f9b08e7f09e794b2765c2804.tar.xz
zabbix-140d7a7de72b6a69f9b08e7f09e794b2765c2804.zip
- added table audit (Alexei)
- added audit.php (Alexei) - new default port numbers for agent and trapper, 10050 and 10051 (Alexei) - better internal coding standard for ZABBIX agent (Alexei) - added support for md5sum for files less than 64M (Alexei) - added include md5.c and md5.h (Alexei) - remove trends.php, trend.php (Alexei) - remove compare.php, chart3.php (Alexei) - show trigger dependencies in list of configuration of triggers (Alexei) - make Zabbix reset nextcheck for items when updating or adding a trigger (Alexei) - minimum value of PingerFrequency changed to 1 (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@1423 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog11
-rw-r--r--TODO28
-rw-r--r--create/mysql/schema.sql16
-rw-r--r--create/postgresql/schema.sql17
-rw-r--r--frontends/php/actions.php4
-rw-r--r--frontends/php/audit.php164
-rw-r--r--frontends/php/chart3.php306
-rw-r--r--frontends/php/compare.php149
-rw-r--r--frontends/php/history.php4
-rw-r--r--frontends/php/hosts.php2
-rw-r--r--frontends/php/include/config.inc.php85
-rw-r--r--frontends/php/include/defines.inc.php11
-rw-r--r--frontends/php/include/forms.inc.php2
-rw-r--r--frontends/php/include/local_en.inc.php42
-rw-r--r--frontends/php/latest.php20
-rw-r--r--frontends/php/sysmap.php6
-rw-r--r--frontends/php/trend.php283
-rw-r--r--frontends/php/trends.php170
-rw-r--r--frontends/php/triggers.php18
-rw-r--r--include/md5.c381
-rw-r--r--include/md5.h93
-rw-r--r--misc/conf/zabbix_agentd.conf4
-rw-r--r--misc/conf/zabbix_trapperd.conf2
-rw-r--r--src/zabbix_agent/Makefile.in4
-rw-r--r--src/zabbix_agent/sysinfo.c731
-rw-r--r--src/zabbix_agent/sysinfo.h137
-rw-r--r--src/zabbix_agent/zabbix_agentd.c2
-rw-r--r--src/zabbix_agent_win32/main.cpp2
-rw-r--r--src/zabbix_sucker/Makefile.in2
-rw-r--r--src/zabbix_sucker/pinger.c2
-rw-r--r--src/zabbix_sucker/zabbix_sucker.c2
-rw-r--r--src/zabbix_trapper/zabbix_trapperd.c2
-rw-r--r--upgrades/dbpatches/1.0_to_1.1alpha1/mysql/patch.sql16
-rw-r--r--upgrades/dbpatches/1.0_to_1.1alpha1/postgresql/patch.sql17
34 files changed, 1396 insertions, 1339 deletions
diff --git a/ChangeLog b/ChangeLog
index 9848cf07..3087bbf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
Changes for 1.1alpha1:
+ - added table audit (Alexei)
+ - added audit.php (Alexei)
+ - new default port numbers for agent and trapper, 10050 and 10051 (Alexei)
+ - better internal coding standard for ZABBIX agent (Alexei)
+ - added support for md5sum for files less than 64M (Alexei)
+ - added include md5.c and md5.h (Alexei)
+ - remove trends.php, trend.php (Alexei)
+ - remove compare.php, chart3.php (Alexei)
+ - show trigger dependencies in list of configuration of triggers (Alexei)
+ - make Zabbix reset nextcheck for items when updating or adding a trigger (Alexei)
+ - minimum value of PingerFrequency changed to 1 (Alexei)
- different icons depending on a triger status for sysmaps (Alexei)
- added column sysmaps_hosts.icon_on (Alexei)
- hierarchial maps (Alexei)
diff --git a/TODO b/TODO
index 0d15d1d0..41578aa5 100644
--- a/TODO
+++ b/TODO
@@ -12,6 +12,10 @@ ZABBIX 1.1
- custom multiplier
- support of SNMPv3
- hierarchial maps
+ - new defaul port numbers to avoid confusion with WebMin
+
+TKOM:
+ - maps with background and attractive icons
--------------------------------------------
@@ -24,7 +28,6 @@ ZABBIX 1.1:
- repeated notifications
- monitoring of log files
- audit log
- - new defaul port numbers to avoid confusion with WebMin
- anvanced SNMP trapper
- hard-linked templates
- passing of parameters to user-defined commands (agent)
@@ -34,7 +37,6 @@ ZABBIX 1.1:
TKOM:
- alarms forwarding to external systems (using SNMP traps, for example)
- - maps with background and attractive icons
- groups of graphs
- auto-discovery script
- alarm/trigger sounds
@@ -97,14 +99,9 @@ Most of the signal handlers all need to delay or block signals to avoid signal r
- in user administration, add many resources from a list (not by one ID)
- availability report for day/week/month/etc
- check if items delay works
- - change location of Zabbix Manual in about.php
- apply Igor patches for chart.php (calculation of MIN, MAX)
- review PHP code for simplifying (urls, iif() )
- - fix screenedit.php permissions
-
- Triggers - v ih spiske videljatj trigera u kotorih estj 'depends on'.
- * K primeru, posle virazhenija pistaj tekst v skobkah (depends on) ili inim
- metodom !
+ - fix screenedit.php permissions
Kak naschet dopolnenij k time & date:
* tipa weekday, month, day, year, hour, minute, ...
@@ -117,11 +114,8 @@ Most of the signal handlers all need to delay or block signals to avoid signal r
- add requirement for fping to the manual
- separate login.php and index.php
- add gaps to graph when no data present
- - make Zabbix reset nextcheck for items when updating or adding a trigger
- remove icmpping and others from the QUEUE
- escalation and repeated notifications
- - take advantage of PHP OOP (everything in classes)
- - improve WEB site to provide understanding of Zabbix and its concepts
- summarising report about triggers/actions/items. Show items without triggers,
trigger wihout actions, etc etc
@@ -270,8 +264,6 @@ TOP PRIORITY:
- fix update of 'status'. When added it never gets updated, if server is already unreachable.
- pay attention to Solaris agent
- - better viewing of trigger dependencies
- - do not show "all" if no groups defined
- add more checks for forms (check all possible wrong values)
- support of fetch_html[*]
- restructure sources
@@ -282,22 +274,12 @@ BUGS:
- add protection from IT Service looping
-PERFORMANCE IMPROVEMENTS:
-
- - remove lastvalue, lastclock, prevvalue from table ITEMS
- - is there any need to update datta of table FUNCTIONS? Can it be done in memory only?
-
DIFFERENT TASKS:
- - better monitoring of log files
- SNMP trapping
- - SNMP v3
- distributed monitoring
- backup/restore scripts for server. Backup all (DB, configs, etc).
- - IT Helpdesk
- personalisation (refresh rate, graph size, default graph period, etc)
- - encryption
- - automated report generation
- SNMP-walk in WEB interface
- add UserParameter without restart of an agent
diff --git a/create/mysql/schema.sql b/create/mysql/schema.sql
index 6695f956..a90a2e20 100644
--- a/create/mysql/schema.sql
+++ b/create/mysql/schema.sql
@@ -399,6 +399,22 @@ CREATE TABLE users (
) type=InnoDB;
--
+-- Table structure for table 'audit'
+--
+
+CREATE TABLE audit (
+ auditid int(4) NOT NULL auto_increment,
+ userid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ action int(4) DEFAULT '0' NOT NULL,
+ resource int(4) DEFAULT '0' NOT NULL,
+ details varchar(128) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (auditid),
+ UNIQUE (userid,clock),
+ KEY (clock)
+) type=InnoDB;
+
+--
-- Table structure for table 'sessions'
--
diff --git a/create/postgresql/schema.sql b/create/postgresql/schema.sql
index 01f696ae..98df0fc1 100644
--- a/create/postgresql/schema.sql
+++ b/create/postgresql/schema.sql
@@ -169,6 +169,23 @@ CREATE TABLE users (
CREATE UNIQUE INDEX users_alias on users (alias);
--
+-- Table structure for table 'audit'
+--
+
+CREATE TABLE audit (
+ auditid serial,
+ userid int4 DEFAULT '0' NOT NULL,
+ clock int4 DEFAULT '0' NOT NULL,
+ action int4 DEFAULT '0' NOT NULL,
+ resource int4 DEFAULT '0' NOT NULL,
+ details varchar(128) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (auditid)
+);
+
+CREATE UNIQUE INDEX audit_userid_clock on audit (userid,clock);
+CREATE INDEX audit_clock on audit (clock);
+
+--
-- Table structure for table 'actions'
--
diff --git a/frontends/php/actions.php b/frontends/php/actions.php
index 52797229..dbd74529 100644
--- a/frontends/php/actions.php
+++ b/frontends/php/actions.php
@@ -87,8 +87,8 @@
$result=DBselect($sql);
echo "<div align=center>";
- echo "<TABLE BORDER=0 WIDTH=100% BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
- echo "<TR>";
+ echo "<TABLE BORDER=0 WIDTH=100% BGCOLOR=\"#AAAAAA\" cellspacing=1 cellpadding=3>";
+ echo "<TR BGCOLOR=\"#CCCCCC\">";
echo "<TD><b>".S_SCOPE."</b></TD>";
echo "<TD><b>".S_SEND_MESSAGE_TO."</b></TD>";
echo "<TD WIDTH=10%><b>".S_WHEN_TRIGGER."</b></TD>";
diff --git a/frontends/php/audit.php b/frontends/php/audit.php
new file mode 100644
index 00000000..3a192169
--- /dev/null
+++ b/frontends/php/audit.php
@@ -0,0 +1,164 @@
+<?php
+/*
+** Zabbix
+** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**/
+?>
+<?php
+ include "include/config.inc.php";
+ $page["title"] = S_AUDIT_LOG;
+ $page["file"] = "audit.php";
+ show_header($page["title"],30,0);
+?>
+
+<?php
+ if(isset($_GET["start"])&&isset($_GET["do"])&&($_GET["do"]=="<< Prev 100"))
+ {
+ $_GET["start"]-=100;
+ }
+ if(isset($_GET["do"])&&($_GET["do"]=="Next 100 >>"))
+ {
+ if(isset($_GET["start"]))
+ {
+ $_GET["start"]+=100;
+ }
+ else
+ {
+ $_GET["start"]=100;
+ }
+ }
+ if(isset($_GET["start"])&&($_GET["start"]<=0))
+ {
+ unset($_GET["start"]);
+ }
+?>
+
+<?php
+ show_table3_header_begin();
+ echo "&nbsp;".S_AUDIT_LOG_BIG;
+ show_table3_h_delimiter(20);
+ echo "<form name=\"form2\" method=\"get\" action=\"audit.php\">";
+ if(isset($_GET["start"]))
+ {
+ echo "<input class=\"biginput\" name=\"start\" type=hidden value=".$_GET["start"]." size=8>";
+ echo "<input class=\"button\" type=\"submit\" name=\"do\" value=\"<< Prev 100\">";
+ }
+ else
+ {
+ echo "<input class=\"button\" type=\"submit\" disabled name=\"do\" value=\"<< Prev 100\">";
+ }
+ echo "<input class=\"button\" type=\"submit\" name=\"do\" value=\"Next 100 >>\">";
+ echo "</form>";
+ show_table_header_end();
+?>
+
+<FONT COLOR="#000000">
+<?php
+ $sql="select max(auditid) as max from audit";
+ $result=DBselect($sql);
+ $row=DBfetch($result);
+ $maxauditid=@iif(DBnum_rows($result)>0,$row["max"],0);
+
+ if(!isset($_GET["start"]))
+ {
+ $sql="select u.alias,a.clock,a.action,a.resource,a.details from audit a, users u where u.userid=a.userid and a.auditid>$maxauditid-200 order by clock desc limit 200";
+ }
+ else
+ {
+ $sql="select u.alias,a.clock,a.action,a.resource,a.details from audit a, users u where u.userid=a.userid and a.auditid>$maxauditid-".($_GET["start"]+200)." order by clock desc limit ".($_GET["start"]+200);
+
+ }
+ $result=DBselect($sql);
+
+// echo "<TABLE WIDTH=100% align=center BORDER=0 BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
+ echo "<TABLE WIDTH=100% align=center BGCOLOR=\"#AAAAAA\" BORDER=0 cellspacing=1 cellpadding=3>";
+ echo "<TR BGCOLOR=\"#CCCCCC\">";
+ echo "<TD width=20%><b>".S_TIME."</b></TD>";
+ echo "<TD width=10%><b>".S_USER."</b></TD>";
+ echo "<TD width=10%><b>".S_RESOURCE."</b></TD>";
+ echo "<TD width=10%><b>".S_ACTION."</b></TD>";
+ echo "<TD><b>".S_DETAILS."</b></TD>";
+ echo "</TR>";
+ $col=0;
+ $i=0;
+ while($row=DBfetch($result))
+ {
+ $i++;
+ if(isset($_GET["start"])&&($i<$_GET["start"]))
+ {
+ continue;
+ }
+// if(!check_right_on_trigger("R",$row["triggerid"]))
+// {
+// continue;
+// }
+ if($col++%2==0) { echo "<tr bgcolor=#DDDDDD>"; }
+ else { echo "<tr bgcolor=#EEEEEE>"; }
+
+ if($col>100) break;
+
+ echo "<TD>",date("Y.M.d H:i:s",$row["clock"]),"</TD>";
+ echo "<TD>",$row["alias"],"</TD>";
+ echo "<TD>";
+ if($row["resource"]==AUDIT_RESOURCE_USER)
+ {
+ echo S_USER;
+ }
+ else if($row["resource"]==AUDIT_RESOURCE_ZABBIX_CONFIG)
+ {
+ echo S_CONFIGURATION_OF_ZABBIX;
+ }
+ else if($row["resource"]==AUDIT_RESOURCE_MEDIA_TYPE)
+ {
+ echo S_MEDIA_TYPE;
+ }
+ else
+ {
+ echo S_UNKNOWN_RESOURCE;
+ }
+ echo "</TD>";
+ echo "<TD>";
+ if($row["action"]==AUDIT_ACTION_ADD)
+ {
+ echo S_ADDED;
+ }
+ else if($row["action"]==AUDIT_ACTION_UPDATE)
+ {
+ echo S_UPDATED;
+ }
+ else if($row["action"]==AUDIT_ACTION_DELETE)
+ {
+ echo S_DELETED;
+ }
+ else
+ {
+ echo S_UNKNOWN_ACTION;
+ }
+ echo "</TD>";
+ echo "<TD>",$row["details"],"</TD>";
+ echo "</TR>";
+ cr();
+ }
+ echo "</TABLE>";
+?>
+</FONT>
+</TR>
+</TABLE>
+
+<?php
+ show_footer();
+?>
diff --git a/frontends/php/chart3.php b/frontends/php/chart3.php
deleted file mode 100644
index 688677fc..00000000
--- a/frontends/php/chart3.php
+++ /dev/null
@@ -1,306 +0,0 @@
-<?php
-/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**/
-?>
-<?php
- include "include/config.inc.php";
-
-# PARAMETERS:
-
-# itemid
-# type
-
- $start_time=time(NULL);
-
- if(!isset($_GET["type"]))
- {
- $_GET["type"]="week";
- }
-
- if($_GET["type"] == "month")
- {
- $period=30*24*3600;
- }
- else if($_GET["type"] == "week")
- {
- $period=7*24*3600;
- }
- else if($_GET["type"] == "year")
- {
- $period=365*24*3600;
- }
- else
- {
- $period=7*24*3600;
- $type="week";
- }
-
- if(isset($_GET["width"])&&$_GET["width"]>0)
- {
- $sizeX=$_GET["width"];
- }
- else
- {
- $sizeX=900;
- }
- $sizeY=200;
-
- $shiftX=12;
- $shiftYup=13;
- $shiftYdown=7+15*2;
-
-
-// Header( "Content-type: text/html");
- Header( "Content-type: image/png");
- Header( "Expires: Mon, 17 Aug 1998 12:51:50 GMT");
-
- check_authorisation();
-
- $im = imagecreate($sizeX+$shiftX+61,$sizeY+$shiftYup+$shiftYdown+10);
-
- $red=ImageColorAllocate($im,255,0,0);
- $darkred=ImageColorAllocate($im,150,0,0);
- $green=ImageColorAllocate($im,0,255,0);
- $darkgreen=ImageColorAllocate($im,0,150,0);
- $blue=ImageColorAllocate($im,0,0,255);
- $darkblue=ImageColorAllocate($im,0,0,150);
- $yellow=ImageColorAllocate($im,255,255,0);
- $darkyellow=ImageColorAllocate($im,150,150,0);
- $cyan=ImageColorAllocate($im,0,255,255);
- $black=ImageColorAllocate($im,0,0,0);
- $gray=ImageColorAllocate($im,150,150,150);
- $white=ImageColorAllocate($im,255,255,255);
- $bg=ImageColorAllocate($im,6+6*16,7+7*16,8+8*16);
-
- $x=imagesx($im);
- $y=imagesy($im);
-
- ImageFilledRectangle($im,0,0,$sizeX+$shiftX+61,$sizeY+$shiftYup+$shiftYdown+10,$white);
- ImageRectangle($im,0,0,$x-1,$y-1,$black);
-
- if(!check_right("Item","R",$_GET["itemid"]))
- {
-// show_table_header("<font color=\"AA0000\">No permissions !</font>");
-// show_footer();
- ImageOut($im);
- ImageDestroy($im);
- exit;
- }
-
-
- $now = time(NULL);
- $to_time=$now;
- $from_time=$to_time-$period;
- $from_time_now=$to_time-24*3600;
-
- $count=array();
- $min=array();
- $max=array();
- $avg=array();
-
- $sql="select round(900*((clock+3*3600)%(24*3600))/(24*3600)) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max from history where itemid=".$_GET["itemid"]." and clock>$from_time and clock<$to_time group by 1";
-// echo $sql."<br>";
- $result=DBselect($sql);
- while($row=DBfetch($result))
- {
- $i=$row["i"];
-
- $max[$i]=$row["max"];
- $min[$i]=$row["min"];
- $avg[$i]=$row["avg"];
- $count[$i]=$row["count"];
- }
-
- $count_now=array();
- $avg_now=array();
- $result=DBselect("select round(900*((clock+3*3600)%(24*3600))/(24*3600)) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max from history where itemid=".$_GET["itemid"]." and clock>$from_time_now and clock<$to_time group by 1");
- while($row=DBfetch($result))
- {
- $i=$row["i"];
- $avg_now[$i]=$row["avg"];
- $count_now[$i]=$row["count"];
- }
-
- for($i=0;$i<=$sizeY;$i+=$sizeY/5)
- {
- DashedLine($im,$shiftX,$i+$shiftYup,$sizeX+$shiftX,$i+$shiftYup,$gray);
- }
-
- for($i=0;$i<=$sizeX;$i+=$sizeX/24)
- {
- DashedLine($im,$i+$shiftX,$shiftYup,$i+$shiftX,$sizeY+$shiftYup,$gray);
- ImageString($im, 1,$i+$shiftX-11, $sizeY+$shiftYup+5, date("H:i",-3*3600+24*3600*$i/900) , $black);
- }
-
- unset($maxY);
- unset($minY);
-
- $maxY=max($avg);
- $tmp=max($avg_now);
- if($tmp>$maxY)
- {
- $maxY=$tmp;
- }
- $minY=min($avg);
- $tmp=min($avg_now);
- if($tmp<$minY)
- {
- $minY=$tmp;
- }
-
- $maxX=900;
- $minX=0;
-
- if(isset($minY)&&($maxY)&&($minX!=$maxX)&&($minY!=$maxY))
- {
- $nodata=0;
- for($i=0;$i<900;$i++)
- {
- if(isset($count[$i])&&$count[$i]>0)
- {
-/* if(!isset($trendavg))
- {
- $x1=$sizeX*($i-$minX)/($maxX-$minX);
- $y1=$sizeY*($max[$i]-$minY)/($maxY-$minY);
- $x2=$sizeX*($i-$minX)/($maxX-$minX);
- $y2=$sizeY*($min[$i]-$minY)/($maxY-$minY);
- $y1=$sizeY-$y1;
- $y2=$sizeY-$y2;
-
- ImageLine($im,$x1+$shiftX,$y1+$shiftYup,$x2+$shiftX,$y2+$shiftYup,$bg);
- }*/
-
-/* if(!isset($trendavg))
- {
- $x1=$sizeX*($i-$minX)/($maxX-$minX);
- $y1=$sizeY*($max[$i]-$minY)/($maxY-$minY);
- $x2=$x1;
- $y2=0;
- $y1=$sizeY-$y1;
- $y2=$sizeY-$y2;
-
- ImageLine($im,$x1+$shiftX,$y1+$shiftYup,$x2+$shiftX,$y2+$shiftYup,$blue);
- }*/
-
- $x1=$sizeX*($i-$minX)/($maxX-$minX);
- $y1=$sizeY*($avg[$i]-$minY)/($maxY-$minY);
- $x2=$x1;
- $y2=0;
- $y1=$sizeY-$y1;
- $y2=$sizeY-$y2;
-
- ImageLine($im,$x1+$shiftX,$y1+$shiftYup,$x2+$shiftX,$y2+$shiftYup,$darkgreen);
-
-/* if(!isset($trendavg))
- {
- $x1=$sizeX*($i-$minX)/($maxX-$minX);
- $y1=$sizeY*($min[$i]-$minY)/($maxY-$minY);
- $x2=$x1;
- $y2=0;
- $y1=$sizeY-$y1;
- $y2=$sizeY-$y2;
-
- ImageLine($im,$x1+$shiftX,$y1+$shiftYup,$x2+$shiftX,$y2+$shiftYup,$green);
- }*/
- }
- if(isset($count_now[$i])&&isset($count_now[$i-1])&&($count_now[$i]>0)&&($count_now[$i-1]>0))
- {
- if($i>0)
- {
- $x1=$sizeX*($i-$minX)/($maxX-$minX);
- $y1=$sizeY*($avg_now[$i]-$minY)/($maxY-$minY);
- $x2=$sizeX*($i-$minX-1)/($maxX-$minX);
- $y2=$sizeY*($avg_now[$i-1]-$minY)/($maxY-$minY);
-// $x2=$x1;
-// $y2=0;
- $y1=$sizeY-$y1;
- $y2=$sizeY-$y2;
-
- ImageLine($im,$x1+$shiftX,$y1+$shiftYup,$x2+$shiftX,$y2+$shiftYup,$darkred);
-// ImageLine($im,$x1+$shiftX-1,$y1+$shiftYup,$x2+$shiftX-1,$y2+$shiftYup,$darkred);
- }
- }
-
-
-# ImageStringUp($im, 1, $x1+10, $sizeY+$shiftYup+15, $i , $red);
- }
- }
- else
- {
-// ImageLine($im,$shiftX,$shiftYup+$sizeY/2,$sizeX+$shiftX,$shiftYup+$sizeY/2,$green);
- }
-
- $i=intval( 900*(($now+3*3600)%(24*3600))/(24*3600));
- $x1=$sizeX*($i-$minX)/($maxX-$minX);
- $y1=$sizeY*($avg[$i]-$minY)/($maxY-$minY);
- $x2=$x1;
- $y2=0;
- $y1=$sizeY-$y1;
- $y2=$sizeY-$y2;
-
- DashedLine($im,$x1+$shiftX,$shiftYup,$x2+$shiftX,$sizeY+$shiftYup,$black);
-
- if(isset($nodata)&&($nodata == 0))
- {
- $item=get_item_by_itemid($_GET["itemid"]);
- for($i=0;$i<=$sizeY;$i+=$sizeY/5)
- {
- ImageString($im, 1, $sizeX+5+$shiftX, $sizeY-$i-4+$shiftYup, convert_units($i*($maxY-$minY)/$sizeY+$minY,$item["units"]) , $darkred);
- }
-
-// date("dS of F Y h:i:s A",DBget_field($result,0,0));
-
-// ImageString($im, 1,10, $sizeY+$shiftY+5, date("dS of F Y h:i:s A",$minX) , $red);
-// ImageString($im, 1,$sizeX+$shiftX-168,$sizeY+$shiftY+5, date("dS of F Y h:i:s A",$maxX) , $red);
- }
- else
- {
- ImageString($im, 2,$sizeX/2 -50, $sizeY+$shiftYup+3, "NO DATA FOR THIS PERIOD" , $red);
- }
-
- ImageFilledRectangle($im,$shiftX,$sizeY+$shiftYup+19+15*0,$shiftX+5,$sizeY+$shiftYup+15+9+15*0,$darkgreen);
- ImageRectangle($im,$shiftX,$sizeY+$shiftYup+19+15*0,$shiftX+5,$sizeY+$shiftYup+15+9+15*0,$black);
- if($_GET["type"]=="year")
- {
- ImageString($im, 2,$shiftX+9,$sizeY+$shiftYup+15*0+15, "Average for last 365 days", $black);
- }
- else if($_GET["type"]=="month")
- {
- ImageString($im, 2,$shiftX+9,$sizeY+$shiftYup+15*0+15, "Average for last 30 days", $black);
- }
- else
- {
- ImageString($im, 2,$shiftX+9,$sizeY+$shiftYup+15*0+15, "Average for last 7 days", $black);
- }
-
- ImageFilledRectangle($im,$shiftX,$sizeY+$shiftYup+19+15*1,$shiftX+5,$sizeY+$shiftYup+15+9+15*1,$darkred);
- ImageRectangle($im,$shiftX,$sizeY+$shiftYup+19+15*1,$shiftX+5,$sizeY+$shiftYup+15+9+15*1,$black);
- ImageString($im, 2,$shiftX+9,$sizeY+$shiftYup+15*1+15, "Average for last 24 hours", $black);
-
-// ImageString($im, 1,$shiftX, $sizeY+$shiftY+15, "AVG (LAST WEEK)" , $darkgreen);
-// ImageString($im, 1,$shiftX+80, $sizeY+$shiftY+15, "AVG (TODAY)" , $darkred);
-
- ImageStringUp($im,0,imagesx($im)-10,imagesy($im)-50, "http://www.zabbix.com", $gray);
-
- $end_time=time(NULL);
- ImageString($im, 0,imagesx($im)-100,imagesy($im)-12,"Generated in ".($end_time-$start_time)." sec", $gray);
-
- ImageOut($im);
- ImageDestroy($im);
-?>
diff --git a/frontends/php/compare.php b/frontends/php/compare.php
deleted file mode 100644
index 3324c3a5..00000000
--- a/frontends/php/compare.php
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**/
-?>
-<?php
- include "include/config.inc.php";
- $page["title"] = "Latest values";
- $page["file"] = "latest.php";
- show_header($page["title"],300,0);
-?>
-
-<?php
- if(!check_right("Item","R",$_GET["itemid"]))
- {
- show_table_header("<font color=\"AA0000\">No permissions !</font>");
- show_footer();
- exit;
- }
-?>
-
-<?php
- show_table_header_begin();
- $result=DBselect("select i.description,h.host,h.hostid from items i,hosts h where i.hostid=h.hostid and i.itemid=".$_GET["itemid"]);
- $description=DBget_field($result,0,0);
- $host=DBget_field($result,0,1);
- $hostid=DBget_field($result,0,2);
-
- echo "<A HREF='latest.php?hostid=$hostid'>$host</A> : <a href='history.php?action=showhistory&itemid=".$_GET["itemid"]."'>$description</a>";
-
- show_table_v_delimiter();
-
- echo "<font size=2>";
-
- if(isset($_GET["type"])&&$_GET["type"]=="year")
- {
- echo "<b>[<a href='compare.php?itemid=".$_GET["itemid"]."&type=year'>year</a>]</b> ";
- }
- else
- {
- echo "<a href='compare.php?itemid=".$_GET["itemid"]."&type=year'>year</a> ";
- }
- if(isset($_GET["type"])&&$_GET["type"]=="month")
- {
- echo "<b>[<a href='compare.php?itemid=".$_GET["itemid"]."&type=month'>month</a>]</b> ";
- }
- else
- {
- echo "<a href='compare.php?itemid=".$_GET["itemid"]."&type=month'>month</a> ";
- }
- if(isset($_GET["type"])&&$_GET["type"]=="week")
- {
- echo "<b>[<a href='compare.php?itemid=".$_GET["itemid"]."&type=week'>week</a>]</b> ";
- }
- else
- {
- echo "<a href='compare.php?itemid=".$_GET["itemid"]."&type=week'>week</a> ";
- }
- echo "</font>";
-
-
- if(isset($_GET["type"]))
- {
- show_table_v_delimiter();
- echo "<b>[<a href='compare.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."&type2=day'>day</a>]</b> ";
- }
-
- show_table_header_end();
- echo "<br>";
-?>
-
-<?php
- if(isset($_GET["itemid"])&&isset($_GET["type"]))
- {
- show_table_header(strtoupper($_GET["type"]));
- }
- else
- {
- show_table_header("Select type of trend");
- }
- echo "<TABLE BORDER=0 align=center COLS=4 WIDTH=100% BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
- echo "<TR BGCOLOR=#EEEEEE>";
- echo "<TR BGCOLOR=#DDDDDD>";
- echo "<TD ALIGN=CENTER>";
- if(isset($_GET["itemid"])&&isset($_GET["type"]))
- {
- if(isset($_GET["trendavg"]))
- {
- echo "<script language=\"JavaScript\">";
- echo "if (navigator.appName == \"Microsoft Internet Explorer\")";
- echo "{";
- echo " document.write(\"<IMG SRC='chart3.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."&trendavg=1&width=\"+(document.body.clientWidth-108)+\"'>\")";
- echo "}";
- echo "else if (navigator.appName == \"Netscape\")";
- echo "{";
- echo " document.write(\"<IMG SRC='chart3.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."&trendavg=1&width=\"+(document.width-108)+\"'>\")";
- echo "}";
- echo "else";
- echo "{";
- echo " document.write(\"<IMG SRC='chart3.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."&trendavg=1'>\")";
- echo "}";
- echo "</script>";
- }
- else
- {
- echo "<script language=\"JavaScript\">";
- echo "if (navigator.appName == \"Microsoft Internet Explorer\")";
- echo "{";
- echo " document.write(\"<IMG SRC='chart3.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."&width=\"+(document.body.clientWidth-108)+\"'>\")";
- echo "}";
- echo "else if (navigator.appName == \"Netscape\")";
- echo "{";
- echo " document.write(\"<IMG SRC='chart3.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."&width=\"+(document.width-108)+\"'>\")";
- echo "}";
- echo "else";
- echo "{";
- echo " document.write(\"<IMG SRC='chart3.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."'>\")";
- echo "}";
- echo "</script>";
- }
- }
- else
- {
- echo "...";
- }
- echo "</TD>";
- echo "</TR>";
- echo "</TABLE>";
-
-?>
-
-<?php
- show_footer();
-?>
diff --git a/frontends/php/history.php b/frontends/php/history.php
index d11e656b..5a0cbd69 100644
--- a/frontends/php/history.php
+++ b/frontends/php/history.php
@@ -189,8 +189,8 @@
show_table_header("Showing history of ".$_GET["period"]." seconds($hours h)<BR>[from: ".date("Y.M.d H:i:s",$time)."] [till: ".date("Y.M.d H:i:s",$till)."]");
- echo "<TABLE BORDER=0 COLS=2 ALIGN=CENTER WIDTH=100% BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
- echo "<TR>";
+ echo "<TABLE BORDER=0 COLS=2 ALIGN=CENTER WIDTH=100% BGCOLOR=\"#AAAAAA\" cellspacing=1 cellpadding=3>";
+ echo "<TR BGCOLOR=\"#CCCCCC\">";
echo "<TD><B>".S_CLOCK."</B></TD>";
echo "<TD><B>".S_VALUE."</B></TD>";
echo "</TR>";
diff --git a/frontends/php/hosts.php b/frontends/php/hosts.php
index 54041e45..65f86cb0 100644
--- a/frontends/php/hosts.php
+++ b/frontends/php/hosts.php
@@ -296,7 +296,7 @@
<?php
$host=@iif(isset($_GET["host"]),$_GET["host"],"");
- $port=@iif(isset($_GET["port"]),$_GET["port"],get_profile("HOST_PORT",10000));
+ $port=@iif(isset($_GET["port"]),$_GET["port"],get_profile("HOST_PORT",10050));
$status=@iif(isset($_GET["status"]),$_GET["status"],0);
$useip=@iif(isset($_GET["useip"]),$_GET["useip"],"off");
$newgroup=@iif(isset($_GET["newgroup"]),$_GET["newgroup"],"");
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 64b6cf4b..0bc7709a 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -1232,7 +1232,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
}
?>
</td>
- <td colspan=1 bgcolor=FFFFFF align=center valign=top width=15%>
+ <td colspan=2 bgcolor=FFFFFF align=center valign=top width=15%>
<?php
if(check_anyright("Default permission","R"))
{
@@ -1355,7 +1355,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
}
?>
</td>
- <td colspan=2 bgcolor=FFFFFF align=center valign=top width=15%>
+ <td colspan=3 bgcolor=FFFFFF align=center valign=top width=15%>
<?php
if(check_anyright("Default permission","R"))
{
@@ -1373,7 +1373,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
}
?>
</td>
- <td colspan=3 bgcolor=FFFFFF align=center valign=top width=15%>
+ <td colspan=4 bgcolor=FFFFFF align=center valign=top width=15%>
<?php
if(check_anyright("Host","R"))
{
@@ -1447,6 +1447,22 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
</td>
<td colspan=1 bgcolor=FFFFFF align=center valign=top width=10%>
<?php
+ if(check_anyright("Audit","U"))
+ {
+ echo "<a href=\"audit.php\">";
+ }
+ if($page["file"]=="audit.php")
+ {
+ echo "<b>[".S_MENU_AUDIT."]</b></a>";
+ }
+ else
+ {
+ echo S_MENU_AUDIT."</a>";
+ }
+?>
+ </td>
+ <td colspan=1 bgcolor=FFFFFF align=center valign=top width=10%>
+<?php
if(check_anyright("Host","U"))
{
echo "<a href=\"hosts.php\">";
@@ -2514,6 +2530,20 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return DBexecute($sql);
}
+ # Reset nextcheck for related items
+
+ function reset_items_nextcheck($triggerid)
+ {
+ $sql="select itemid from functions where triggerid=$triggerid";
+ $result=DBselect($sql);
+ for($i=0;$i<DBnum_rows($result);$i++)
+ {
+ $itemid=DBget_field($result,$i,0);
+ $sql="update items set nextcheck=0 where itemid=$itemid";
+ DBexecute($sql);
+ }
+ }
+
# Add Trigger definition
function add_trigger($expression,$description,$priority,$status,$comments,$url)
@@ -2542,7 +2572,9 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
$expression=implode_exp($expression,$triggerid);
$sql="update triggers set expression='$expression' where triggerid=$triggerid";
# echo $sql,"<br>";
- return DBexecute($sql);
+ $triggerid=DBexecute($sql);
+ reset_items_nextcheck($triggerid);
+ return $triggerid;
}
# Delete Trigger definition
@@ -2608,6 +2640,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
$expression=implode_exp($expression,$triggerid);
add_alarm($triggerid,2);
// $sql="update triggers set expression='$expression',description='$description',priority=$priority,status=$status,comments='$comments',url='$url' where triggerid=$triggerid";
+ reset_items_nextcheck($triggerid);
$sql="update triggers set expression='$expression',description='$description',priority=$priority,status=$status,comments='$comments',url='$url',value=2 where triggerid=$triggerid";
return DBexecute($sql);
}
@@ -2624,6 +2657,8 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return 0;
}
+ add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_USER,"User alias [$alias] name [$name] surname [$surname]");
+
if($passwd=="")
{
$sql="update users set name='$name',surname='$surname',alias='$alias',url='$url' where userid=$userid";
@@ -2655,6 +2690,8 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
$ERROR_MSG="Insufficient permissions";
return 0;
}
+
+ add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_USER,"User alias [$alias] name [$name] surname [$surname]");
$passwd=md5($passwd);
$sql="insert into users (name,surname,alias,passwd,url) values ('$name','$surname','$alias','$passwd','$url')";
@@ -3143,10 +3180,30 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return DBexecute($sql);
}
+ function get_mediatype_by_mediatypeid($mediatypeid)
+ {
+ global $ERROR_MSG;
+
+ $sql="select * from media_type where mediatypeid=$mediatypeid";
+ $result=DBselect($sql);
+ if(DBnum_rows($result) == 1)
+ {
+ return DBfetch($result);
+ }
+ else
+ {
+ $ERROR_MSG="No media type with with mediatypeid=[$mediatypeid]";
+ }
+ return $item;
+ }
+
# Delete media type
function delete_mediatype($mediatypeid)
{
+ $mediatype=get_mediatype_by_mediatypeid($mediatypeid);
+ add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_MEDIA_TYPE,"Media type [".$mediatype["description"]."]");
+
delete_media_by_mediatypeid($mediatypeid);
delete_alerts_by_mediatypeid($mediatypeid);
$sql="delete from media_type where mediatypeid=$mediatypeid";
@@ -3157,6 +3214,8 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
function update_mediatype($mediatypeid,$type,$description,$smtp_server,$smtp_helo,$smtp_email,$exec_path)
{
+ $description=addslashes($description);
+ add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_MEDIA_TYPE,"Media type [$description]");
$sql="update media_type set type=$type,description='$description',smtp_server='$smtp_server',smtp_helo='$smtp_helo',smtp_email='$smtp_email',exec_path='$exec_path' where mediatypeid=$mediatypeid";
return DBexecute($sql);
}
@@ -3165,6 +3224,8 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
function add_mediatype($type,$description,$smtp_server,$smtp_helo,$smtp_email,$exec_path)
{
+ $description=addslashes($description);
+ add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_MEDIA_TYPE,"Media type [$description]");
$sql="insert into media_type (type,description,smtp_server,smtp_helo,smtp_email,exec_path) values ($type,'$description','$smtp_server','$smtp_helo','$smtp_email','$exec_path')";
return DBexecute($sql);
}
@@ -3232,6 +3293,8 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return 0;
}
+ add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_ZABBIX_CONFIG,"Alarm history [$alarm_history] alert history [$alert_history]");
+
// $sql="update config set smtp_server='$smtp_server',smtp_helo='$smtp_helo',smtp_email='$smtp_email',alarm_history=$alarm_history,alert_history=$alert_history";
$sql="update config set alarm_history=$alarm_history,alert_history=$alert_history";
return DBexecute($sql);
@@ -3376,6 +3439,9 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return 0;
}
+ $user=get_user_by_userid($userid);
+ add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_USER,"User alias [".$user["alias"]."] name [".$user["name"]."] surname [".$user["surname"]."]");
+
delete_media_by_userid($userid);
delete_actions_by_userid($userid);
delete_rights_by_userid($userid);
@@ -4615,4 +4681,15 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
// ImageJPEG($image);
ImagePNG($image);
}
+
+ function add_audit($action,$resource,$details)
+ {
+ global $USER_DETAILS;
+
+ $details=addslashes($details);
+ $userid=$USER_DETAILS["userid"];
+ $clock=time();
+ $sql="insert into audit (userid,clock,action,resource,details) values ($userid,$clock,$action,$resource,'$details')";
+ return DBexecute($sql);
+ }
?>
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index 5b60630c..8f9e2fcc 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -19,6 +19,17 @@
**/
?>
<?php
+ define("AUDIT_ACTION_ADD", 0);
+ define("AUDIT_ACTION_UPDATE", 1);
+ define("AUDIT_ACTION_DELETE", 2);
+ define("AUDIT_ACTION_LOGIN", 3);
+ define("AUDIT_ACTION_LOGOUT", 4);
+
+ define("AUDIT_RESOURCE_USER", 0);
+ define("AUDIT_RESOURCE_ZABBIX", 1);
+ define("AUDIT_RESOURCE_ZABBIX_CONFIG", 2);
+ define("AUDIT_RESOURCE_MEDIA_TYPE", 3);
+
define("HOST_STATUS_MONITORED", 0);
define("HOST_STATUS_NOT_MONITORED", 1);
define("HOST_STATUS_UNREACHABLE", 2);
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index f960325b..0b6a3866 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -103,7 +103,7 @@
$description=@iif(isset($_GET["description"]),$_GET["description"],"");
$key=@iif(isset($_GET["key"]),$_GET["key"],"");
$host=@iif(isset($_GET["host"]),$_GET["host"],"");
- $port=@iif(isset($_GET["port"]),$_GET["port"],10000);
+ $port=@iif(isset($_GET["port"]),$_GET["port"],10050);
$delay=@iif(isset($_GET["delay"]),$_GET["delay"],30);
$history=@iif(isset($_GET["history"]),$_GET["history"],90);
$trends=@iif(isset($_GET["trends"]),$_GET["trends"],365);
diff --git a/frontends/php/include/local_en.inc.php b/frontends/php/include/local_en.inc.php
index 2fd9bbd4..dac74e57 100644
--- a/frontends/php/include/local_en.inc.php
+++ b/frontends/php/include/local_en.inc.php
@@ -21,22 +21,22 @@
<?php
// about.php
- define("S_ABOUT_ZABBIX", "About Zabbix");
- define("S_INFORMATION_ABOUT_ZABBIX", "Information about Zabbix (v1.1alpha1)");
- define("S_HOMEPAGE_OF_ZABBIX", "Homepage of Zabbix");
- define("S_HOMEPAGE_OF_ZABBIX_DETAILS", "This is home page of Zabbix.");
- define("S_LATEST_ZABBIX_MANUAL", "Latest Zabbix Manual");
+ define("S_ABOUT_ZABBIX", "About ZABBIX");
+ define("S_INFORMATION_ABOUT_ZABBIX", "Information about ZABBIX (v1.1alpha1)");
+ define("S_HOMEPAGE_OF_ZABBIX", "Homepage of ZABBIX");
+ define("S_HOMEPAGE_OF_ZABBIX_DETAILS", "This is home page of ZABBIX.");
+ define("S_LATEST_ZABBIX_MANUAL", "Latest ZABBIX Manual");
define("S_LATEST_ZABBIX_MANUAL_DETAILS", "Latest version of the Manual.");
define("S_DOWNLOADS", "Downloads");
- define("S_DOWNLOADS_DETAILS", "Latest Zabbix release can be found here.");
+ define("S_DOWNLOADS_DETAILS", "Latest ZABBIX release can be found here.");
define("S_FEATURE_REQUESTS", "Feature requests");
define("S_FEATURE_REQUESTS_DETAILS", "If you need additional functionality, go here.");
define("S_FORUMS", "Forums");
- define("S_FORUMS_DETAILS", "Zabbix-related discussion.");
+ define("S_FORUMS_DETAILS", "ZABBIX-related discussion.");
define("S_BUG_REPORTS", "Bug reports");
- define("S_BUG_REPORTS_DETAILS", "Bug in Zabbix ? Please, report it.");
+ define("S_BUG_REPORTS_DETAILS", "Bug in ZABBIX ? Please, report it.");
define("S_MAILING_LISTS", "Mailing lists");
- define("S_MAILING_LISTS_DETAILS", "Zabbix-related mailing lists.");
+ define("S_MAILING_LISTS_DETAILS", "ZABBIX-related mailing lists.");
// actions.php
define("S_ACTIONS", "Actions");
@@ -136,7 +136,7 @@
define("S_YELLOW", "Dark yellow");
// config.php
- define("S_CONFIGURATION_OF_ZABBIX", "Configuration of Zabbix");
+ define("S_CONFIGURATION_OF_ZABBIX", "Configuration of ZABBIX");
define("S_CONFIGURATION_OF_ZABBIX_BIG", "CONFIGURATION OF ZABBIX");
define("S_CONFIGURATION_UPDATED", "Configuration updated");
define("S_CONFIGURATION_WAS_NOT_UPDATED", "Configuration was not updated");
@@ -269,12 +269,12 @@
define("S_HISTORY", "History");
define("S_TRENDS", "Trends");
define("S_SHORT_NAME", "Short name");
- define("S_ZABBIX_AGENT", "Zabbix agent");
+ define("S_ZABBIX_AGENT", "ZABBIX agent");
define("S_SNMPV1_AGENT", "SNMPv1 agent");
- define("S_ZABBIX_TRAPPER", "Zabbix trapper");
+ define("S_ZABBIX_TRAPPER", "ZABBIX trapper");
define("S_SIMPLE_CHECK", "Simple check");
define("S_SNMPV2_AGENT", "SNMPv2 agent");
- define("S_ZABBIX_INTERNAL", "Zabbix internal");
+ define("S_ZABBIX_INTERNAL", "ZABBIX internal");
define("S_ZABBIX_UNKNOWN", "Unknown");
define("S_ACTIVE", "Active");
define("S_NOT_ACTIVE", "Not active");
@@ -363,6 +363,7 @@
define("S_MENU_USERS", "USERS");
define("S_MENU_HOSTS", "HOSTS");
define("S_MENU_ITEMS", "ITEMS");
+ define("S_MENU_AUDIT", "AUDIT");
// queue.php
define("S_QUEUE_BIG", "QUEUE");
@@ -372,7 +373,7 @@
define("S_TOTAL", "Total");
// report1.php
- define("S_STATUS_OF_ZABBIX", "Status of Zabbix");
+ define("S_STATUS_OF_ZABBIX", "Status of ZABBIX");
define("S_STATUS_OF_ZABBIX_BIG", "STATUS OF ZABBIX");
define("S_VALUE", "Value");
define("S_ZABBIX_SUCKERD_IS_RUNNING", "zabbix_suckerd is running");
@@ -498,6 +499,7 @@
define("S_CHANGE", "Change");
define("S_TRIGGER_UPDATED", "Trigger updated");
define("S_CANNOT_UPDATE_TRIGGER", "Cannot update trigger");
+ define("S_DEPENDS_ON", "Depends on");
// tr_comments.php
define("S_TRIGGER_COMMENTS", "Trigger comments");
@@ -562,4 +564,16 @@
define("S_PASSWORD", "Password");
define("S_PASSWORD_ONCE_AGAIN", "Password (once again)");
define("S_URL_AFTER_LOGIN", "URL (after login)");
+
+// audit.php
+ define("S_AUDIT_LOG", "Audit log");
+ define("S_AUDIT_LOG_BIG", "AUDIT LOG");
+ define("S_ACTION", "Action");
+ define("S_DETAILS", "Details");
+ define("S_UNKNOWN_ACTION", "Unknown action");
+ define("S_ADDED", "Added");
+ define("S_UPDATED", "Updated");
+ define("S_LOGGED_IN", "Logged in");
+ define("S_LOGGED_OUT", "Logged out");
+ define("S_MEDIA_TYPE", "Media type");
?>
diff --git a/frontends/php/latest.php b/frontends/php/latest.php
index 53741039..3104f6d2 100644
--- a/frontends/php/latest.php
+++ b/frontends/php/latest.php
@@ -204,10 +204,10 @@
cr();
echo "<TD WIDTH=5% align=center><B>History</B></TD>";
cr();
- echo "<TD WIDTH=5% align=center><B>Trends</B></TD>";
- cr();
- echo "<TD WIDTH=5% align=center><B>Compare</B></TD>";
- cr();
+// echo "<TD WIDTH=5% align=center><B>Trends</B></TD>";
+// cr();
+// echo "<TD WIDTH=5% align=center><B>Compare</B></TD>";
+// cr();
echo "</TR>";
cr();
@@ -304,13 +304,13 @@
"<td align=center><a href=\"history.php?action=showhistory&itemid=".$row["itemid"]."\">".S_GRAPH."</a></td>",
"<td align=center><a href=\"history.php?action=showvalues&period=3600&itemid=".$row["itemid"]."\">".S_HISTORY."</a></td>");
- iif_echo($row["value_type"]==0,
- "<td align=center><a href=\"trends.php?itemid=".$row["itemid"]."\">".S_TREND."</a></td>",
- "<td align=center>-</td>");
+// iif_echo($row["value_type"]==0,
+// "<td align=center><a href=\"trends.php?itemid=".$row["itemid"]."\">".S_TREND."</a></td>",
+// "<td align=center>-</td>");
- iif_echo($row["value_type"]==0,
- "<td align=center><a href=\"compare.php?itemid=".$row["itemid"]."\">".S_COMPARE."</a></td>",
- "<td align=center>-</td>");
+// iif_echo($row["value_type"]==0,
+// "<td align=center><a href=\"compare.php?itemid=".$row["itemid"]."\">".S_COMPARE."</a></td>",
+// "<td align=center>-</td>");
echo "</tr>";
cr();
diff --git a/frontends/php/sysmap.php b/frontends/php/sysmap.php
index f3c45a9f..e17fce12 100644
--- a/frontends/php/sysmap.php
+++ b/frontends/php/sysmap.php
@@ -114,7 +114,8 @@
echo "</TABLE>";
show_table_header("DISPLAYED HOSTS");
- echo "<TABLE BORDER=0 COLS=4 align=center WIDTH=100% BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
+ echo "<TABLE BORDER=0 COLS=4 align=center WIDTH=100% BGCOLOR=\"#AAAAAA\" cellspacing=1 cellpadding=3>";
+ echo "<TR BGCOLOR=\"#CCCCCC\">";
echo "<TD WIDTH=10% NOSAVE><B>Host</B></TD>";
echo "<TD><B>Label</B></TD>";
echo "<TD WIDTH=5% NOSAVE><B>X</B></TD>";
@@ -159,7 +160,8 @@
<?php
show_table_header("CONNECTORS");
- echo "<TABLE BORDER=0 COLS=4 align=center WIDTH=100% BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
+ echo "<TABLE BORDER=0 COLS=4 align=center WIDTH=100% BGCOLOR=\"#AAAAAA\" cellspacing=1 cellpadding=3>";
+ echo "<TR BGCOLOR=\"#CCCCCC\">";
echo "<TD WIDTH=10% NOSAVE><B>Host 1</B></TD>";
echo "<TD WIDTH=10% NOSAVE><B>Host 2</B></TD>";
echo "<TD><B>Link status indicator</B></TD>";
diff --git a/frontends/php/trend.php b/frontends/php/trend.php
deleted file mode 100644
index e520a368..00000000
--- a/frontends/php/trend.php
+++ /dev/null
@@ -1,283 +0,0 @@
-<?php
-/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**/
-?>
-<?php
- include "include/config.inc.php";
-
-# PARAMETERS:
-
-# itemid
-# type
-# trendavg
-
- $start_time=time(NULL);
-
- if(!isset($_GET["type"]))
- {
- $_GET["type"]="15min";
- }
-
- if($_GET["type"] == "15min")
- {
- $period=900;
- $label_format="H:i";
- }
- else if($_GET["type"] == "30min")
- {
- $period=1800;
- $label_format="H:i";
- }
- else if($_GET["type"] == "4hours")
- {
- $period=4*3600;
- $label_format="H:i";
- }
- else if($_GET["type"] == "12hours")
- {
- $period=12*3600;
- $label_format="H:i";
- }
- else
- {
- $period=3600;
- $label_format="H:i";
- }
-
- if(isset($_GET["width"])&&$_GET["width"]>0)
- {
- $sizeX=$_GET["width"];
- }
- else
- {
- $sizeX=900;
- }
- $sizeY=200;
-
- $shiftX=10;
- $shiftY=15;
-
- $nodata=1;
-
-
-// Header( "Content-type: text/html");
- Header( "Content-type: image/png");
- Header( "Expires: Mon, 17 Aug 1998 12:51:50 GMT");
-
- check_authorisation();
-
- $im = imagecreate($sizeX+$shiftX+61,$sizeY+2*$shiftY+10);
-
- $red=ImageColorAllocate($im,255,0,0);
- $darkred=ImageColorAllocate($im,150,0,0);
- $green=ImageColorAllocate($im,0,255,0);
- $darkgreen=ImageColorAllocate($im,0,150,0);
- $blue=ImageColorAllocate($im,0,0,255);
- $yellow=ImageColorAllocate($im,255,255,0);
- $darkyellow=ImageColorAllocate($im,150,150,0);
- $cyan=ImageColorAllocate($im,0,255,255);
- $black=ImageColorAllocate($im,0,0,0);
- $gray=ImageColorAllocate($im,150,150,150);
- $white=ImageColorAllocate($im,255,255,255);
-
- $x=imagesx($im);
- $y=imagesy($im);
-
- ImageFilledRectangle($im,0,0,$sizeX+$shiftX+61,$sizeY+2*$shiftY+10,$white);
- ImageRectangle($im,0,0,$x-1,$y-1,$black);
-
- if(!check_right("Item","R",$_GET["itemid"]))
- {
- ImageOut($im);
- ImageDestroy($im);
- exit;
- }
-
- $now = time(NULL);
- $to_time=$now-$now%$period;
- $from_time=$to_time-17*$period;
-
- $count=array();
- $min=array();
- $max=array();
- $avg=array();
-#if($DB_TYPE!="MYSQL")
-if(0)
-{
-// $sql="select round(900*((clock+3*3600)%(24*3600))/(24*3600)) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max from history where itemid=$itemid and clock>$from_time and clock<$to_time group by round(900*((clock+3*3600)%(24*3600))/(24*3600))";
- $p=$to_time-$from_time;
- $z=$from_time%$p;
- $sql="select round(900*((clock+$z)%($p))/($p)) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max from history where itemid=$itemid and clock>$from_time and clock<$to_time group by round(900*((clock+$z)%($p))/($p))";
- $result=DBselect($sql);
- while($row=DBfetch($result))
- {
- $i=$row["i"];
- $count[$i]=$row["count"];
- $min[$i]=$row["min"];
- $max[$i]=$row["max"];
- $avg[$i]=$row["avg"];
- $nodata=0;
- }
-}
-else
-{
- for($i=0;$i<900;$i++)
- {
- $result=DBselect("select count(value),min(value),max(value),avg(value) from history where itemid=".$_GET["itemid"]." and clock>$from_time+$i*($to_time-$from_time)/(900-50) and clock<$from_time+($i+1)*($to_time-$from_time)/(900-50)");
- $count[$i]=DBget_field($result,0,0);
- if($count[$i]>0)
- {
- $min[$i]=DBget_field($result,0,1);
- $max[$i]=DBget_field($result,0,2);
- $avg[$i]=DBget_field($result,0,3);
- $nodata=0;
- }
- }
-}
-
-
- for($i=0;$i<=$sizeY;$i+=$sizeY/5)
- {
- DashedLine($im,$shiftX,$i+$shiftY,$sizeX+$shiftX,$i+$shiftY,$gray);
- }
-
- for($i=0;$i<=$sizeX;$i+=$sizeX/24)
- {
- DashedLine($im,$i+$shiftX,$shiftY,$i+$shiftX,$sizeY+$shiftY,$gray);
- if($nodata == 0)
- {
- ImageString($im, 1,$i+$shiftX-11, $sizeY+$shiftY+5, date($label_format,$from_time+$period*($i/50)) , $black);
- }
- }
-
- unset($maxY);
- unset($minY);
-
-/*
- for($i=0;$i<900;$i++)
- {
- $nodata=0;
- if(!isset($maxY) || $max[$i]>$maxY)
- {
- $maxY=$max[$i];
- }
- if(!isset($minY) || (($min[$i]<$minY)&&($count[$i]>0)) )
- {
- $minY=$min[$i];
- }
- }
-*/
-
- if($nodata == 0)
- {
- if(isset($_GET["trendavg"]))
- {
- $maxY=max($avg);
- $minY=min($avg);
- }
- else
- {
- $maxY=max($max);
- $minY=min($min);
- }
- }
-
- $maxX=900;
- $minX=0;
-# echo "MIN/MAX:",$minX," - ",$maxX," - ",$minY," - ",$maxY,"<Br>";
-
- if(isset($minY)&&($maxY)&&($minX!=$maxX)&&($minY!=$maxY))
- {
- for($i=0;$i<900;$i++)
- {
- if($count[$i]>0)
- {
- if(!isset($_GET["trendavg"]))
- {
- $x1=$sizeX*($i-$minX)/($maxX-$minX);
- $y1=$sizeY*($max[$i]-$minY)/($maxY-$minY);
- $x2=$x1;
- $y2=0;
- $y1=$sizeY-$y1;
- $y2=$sizeY-$y2;
-
- ImageLine($im,$x1+$shiftX,$y1+$shiftY,$x2+$shiftX,$y2+$shiftY,$darkred);
- }
-
- $x1=$sizeX*($i-$minX)/($maxX-$minX);
- $y1=$sizeY*($avg[$i]-$minY)/($maxY-$minY);
- $x2=$x1;
- $y2=0;
- $y1=$sizeY-$y1;
- $y2=$sizeY-$y2;
-
- ImageLine($im,$x1+$shiftX,$y1+$shiftY,$x2+$shiftX,$y2+$shiftY,$darkyellow);
-
- if(!isset($_GET["trendavg"]))
- {
- $x1=$sizeX*($i-$minX)/($maxX-$minX);
- $y1=$sizeY*($min[$i]-$minY)/($maxY-$minY);
- $x2=$x1;
- $y2=0;
- $y1=$sizeY-$y1;
- $y2=$sizeY-$y2;
-
- ImageLine($im,$x1+$shiftX,$y1+$shiftY,$x2+$shiftX,$y2+$shiftY,$darkgreen);
- }
- }
-
-
-# ImageStringUp($im, 1, $x1+10, $sizeY+$shiftY+15, $i , $red);
- }
- }
- else
- {
-// ImageLine($im,$shiftX,$shiftY+$sizeY/2,$sizeX+$shiftX,$shiftY+$sizeY/2,$green);
- }
-
- if($nodata == 0)
- {
- $item=get_item_by_itemid($_GET["itemid"]);
- for($i=0;$i<=$sizeY;$i+=$sizeY/5)
- {
- ImageString($im, 1, $sizeX+5+$shiftX, $sizeY-$i-4+$shiftY, convert_units($i*($maxY-$minY)/$sizeY+$minY,$item["units"],$item["multiplier"]) , $darkred);
- }
-
-// date("dS of F Y h:i:s A",DBget_field($result,0,0));
-
-// ImageString($im, 1,10, $sizeY+$shiftY+5, date("dS of F Y h:i:s A",$minX) , $red);
-// ImageString($im, 1,$sizeX+$shiftX-168,$sizeY+$shiftY+5, date("dS of F Y h:i:s A",$maxX) , $red);
- }
- else
- {
- ImageString($im, 2,$sizeX/2 -50, $sizeY+$shiftY+3, "NO DATA FOR THIS PERIOD" , $darkred);
- }
-
- ImageString($im, 1,$shiftX, $sizeY+$shiftY+15, "MIN" , $darkgreen);
- ImageString($im, 1,$shiftX+20, $sizeY+$shiftY+15, "AVG" , $darkyellow);
- ImageString($im, 1,$shiftX+40, $sizeY+$shiftY+15, "MAX" , $darkred);
-
- ImageStringUp($im,0,imagesx($im)-10,imagesy($im)-50, "http://www.zabbix.com", $gray);
-
- $end_time=time(NULL);
- ImageString($im, 0,imagesx($im)-100,imagesy($im)-12,"Generated in ".($end_time-$start_time)." sec", $gray);
-
- ImageOut($im);
- ImageDestroy($im);
-?>
diff --git a/frontends/php/trends.php b/frontends/php/trends.php
deleted file mode 100644
index 9eaea8d9..00000000
--- a/frontends/php/trends.php
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-/*
-** Zabbix
-** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**/
-?>
-<?php
- include "include/config.inc.php";
- $page["title"] = "Latest values";
- $page["file"] = "latest.php";
- show_header($page["title"],0,0);
-?>
-
-<?php
- if(!check_right("Item","R",$_GET["itemid"]))
- {
- show_table_header("<font color=\"AA0000\">No permissions !</font>");
- show_footer();
- exit;
- }
-?>
-
-<?php
- show_table_header_begin();
- $result=DBselect("select i.description,h.host,h.hostid from items i,hosts h where i.hostid=h.hostid and i.itemid=".$_GET["itemid"]);
- $description=DBget_field($result,0,0);
- $host=DBget_field($result,0,1);
- $hostid=DBget_field($result,0,2);
-
- echo "<A HREF='latest.php?hostid=$hostid'>$host</A> : <a href='compare.php?action=showhistory&itemid=".$_GET["itemid"]."'>$description</a>";
-
- show_table_v_delimiter();
-
- if(isset($_GET["type"])&&$_GET["type"]=="12hours")
- {
- echo "<b>[<a href='trends.php?itemid=".$_GET["itemid"]."&type=12hours'>12hours</a>]</b> ";
- }
- else
- {
- echo "<a href='trends.php?itemid=".$_GET["itemid"]."&type=12hours'>12hours</a> ";
- }
- if(isset($_GET["type"])&&$_GET["type"]=="4hours")
- {
- echo "<b>[<a href='trends.php?itemid=".$_GET["itemid"]."&type=4hours'>4hours</a>]</b> ";
- }
- else
- {
- echo "<a href='trends.php?itemid=".$_GET["itemid"]."&type=4hours'>4hours</a> ";
- }
- if(isset($_GET["type"])&&$_GET["type"]=="hour")
- {
- echo "<b>[<a href='trends.php?itemid=".$_GET["itemid"]."&type=hour'>hour</a>]</b> ";
- }
- else
- {
- echo "<a href='trends.php?itemid=".$_GET["itemid"]."&type=hour'>hour</a> ";
- }
- if(isset($_GET["type"])&&$_GET["type"]=="30min")
- {
- echo "<b>[<a href='trends.php?itemid=".$_GET["itemid"]."&type=30min'>30min</a>]</b> ";
- }
- else
- {
- echo "<a href='trends.php?itemid=".$_GET["itemid"]."&type=30min'>30min</a> ";
- }
- if(isset($_GET["type"])&&$_GET["type"]=="15min")
- {
- echo "<b>[<a href='trends.php?itemid=".$_GET["itemid"]."&type=15min'>15min</a>]</b> ";
- }
- else
- {
- echo "<a href='trends.php?itemid=".$_GET["itemid"]."&type=15min'>15min</a> ";
- }
- echo "</font>";
-
-
- if(isset($_GET["type"]))
- {
- show_table_v_delimiter();
- if(isset($_GET["trendavg"]))
- {
- echo "<a href='trends.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."'>ALL</a> ";
- }
- else
- {
- echo "<a href='trends.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."&trendavg=1'>AVG</a> ";
- }
- }
-
- show_table_header_end();
- echo "<br>";
-?>
-
-<?php
- if(isset($_GET["itemid"])&&isset($_GET["type"]))
- {
- show_table_header(strtoupper($_GET["type"]));
- }
- else
- {
- show_table_header("Select type of trend");
- }
- echo "<TABLE BORDER=0 COLS=4 align=center WIDTH=100% BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
- echo "<TR BGCOLOR=#EEEEEE>";
- echo "<TR BGCOLOR=#DDDDDD>";
- echo "<TD ALIGN=CENTER>";
- if(isset($_GET["itemid"])&&isset($_GET["type"]))
- {
- if(isset($_GET["trendavg"]))
- {
- echo "<script language=\"JavaScript\">";
- echo "if (navigator.appName == \"Microsoft Internet Explorer\")";
- echo "{";
- echo " document.write(\"<IMG SRC='trend.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."&trendavg=1&width=\"+(document.body.clientWidth-108)+\"'>\")";
- echo "}";
- echo "else if (navigator.appName == \"Netscape\")";
- echo "{";
- echo " document.write(\"<IMG SRC='trend.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."&trendavg=1&width=\"+(document.width-108)+\"'>\")";
- echo "}";
- echo "else";
- echo "{";
- echo " document.write(\"<IMG SRC='trend.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."&trendavg=1'>\")";
- echo "}";
- echo "</script>";
- }
- else
- {
- echo "<script language=\"JavaScript\">";
- echo "if (navigator.appName == \"Microsoft Internet Explorer\")";
- echo "{";
- echo " document.write(\"<IMG SRC='trend.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."&width=\"+(document.body.clientWidth-108)+\"'>\")";
- echo "}";
- echo "else if (navigator.appName == \"Netscape\")";
- echo "{";
- echo " document.write(\"<IMG SRC='trend.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."&width=\"+(document.width-108)+\"'>\")";
- echo "}";
- echo "else";
- echo "{";
- echo " document.write(\"<IMG SRC='trend.php?itemid=".$_GET["itemid"]."&type=".$_GET["type"]."'>\")";
- echo "}";
- echo "</script>";
- }
- }
- else
- {
- echo "...";
- }
- echo "</TD>";
- echo "</TR>";
- echo "</TABLE>";
-
-?>
-
-<?php
- show_footer();
-?>
diff --git a/frontends/php/triggers.php b/frontends/php/triggers.php
index 6721de74..965b7789 100644
--- a/frontends/php/triggers.php
+++ b/frontends/php/triggers.php
@@ -257,7 +257,23 @@
$description=expand_trigger_description($row["triggerid"]);
// }
echo "<TD><INPUT TYPE=\"CHECKBOX\" class=\"biginput\" NAME=\"".$row["triggerid"]."\"> ".$row["triggerid"]."</TD>";
- echo "<TD>$description</TD>";
+ echo "<TD>";
+ echo $description;
+ $sql="select t.triggerid,t.description from triggers t,trigger_depends d where t.triggerid=d.triggerid_up and d.triggerid_down=".$row["triggerid"];
+ $result1=DBselect($sql);
+ if(DBnum_rows($result1)>0)
+ {
+ echo "<p><strong>".S_DEPENDS_ON."</strong>:&nbsp;<br>";
+ for($i=0;$i<DBnum_rows($result1);$i++)
+ {
+ $depid=DBget_field($result1,$i,0);
+ $depdescr=expand_trigger_description($depid);
+ echo "$depdescr<br>";
+ }
+ echo "</p>";
+ }
+ echo "</TD>";
+
echo "<TD>".explode_exp($row["expression"],1)."</TD>";
diff --git a/include/md5.c b/include/md5.c
new file mode 100644
index 00000000..2c9c2fcd
--- /dev/null
+++ b/include/md5.c
@@ -0,0 +1,381 @@
+/*
+ Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved.
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ L. Peter Deutsch
+ ghost@aladdin.com
+
+ */
+/* $Id$ */
+/*
+ Independent implementation of MD5 (RFC 1321).
+
+ This code implements the MD5 Algorithm defined in RFC 1321, whose
+ text is available at
+ http://www.ietf.org/rfc/rfc1321.txt
+ The code is derived from the text of the RFC, including the test suite
+ (section A.5) but excluding the rest of Appendix A. It does not include
+ any code or documentation that is identified in the RFC as being
+ copyrighted.
+
+ The original and principal author of md5.c is L. Peter Deutsch
+ <ghost@aladdin.com>. Other authors are noted in the change history
+ that follows (in reverse chronological order):
+
+ 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order
+ either statically or dynamically; added missing #include <string.h>
+ in library.
+ 2002-03-11 lpd Corrected argument list for main(), and added int return
+ type, in test program and T value program.
+ 2002-02-21 lpd Added missing #include <stdio.h> in test program.
+ 2000-07-03 lpd Patched to eliminate warnings about "constant is
+ unsigned in ANSI C, signed in traditional"; made test program
+ self-checking.
+ 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
+ 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
+ 1999-05-03 lpd Original version.
+ */
+
+#include "md5.h"
+#include <string.h>
+
+#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
+#ifdef ARCH_IS_BIG_ENDIAN
+# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
+#else
+# define BYTE_ORDER 0
+#endif
+
+#define T_MASK ((md5_word_t)~0)
+#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87)
+#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9)
+#define T3 0x242070db
+#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111)
+#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050)
+#define T6 0x4787c62a
+#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec)
+#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe)
+#define T9 0x698098d8
+#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850)
+#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e)
+#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841)
+#define T13 0x6b901122
+#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c)
+#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71)
+#define T16 0x49b40821
+#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d)
+#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf)
+#define T19 0x265e5a51
+#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855)
+#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2)
+#define T22 0x02441453
+#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e)
+#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437)
+#define T25 0x21e1cde6
+#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829)
+#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278)
+#define T28 0x455a14ed
+#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa)
+#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07)
+#define T31 0x676f02d9
+#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375)
+#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd)
+#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e)
+#define T35 0x6d9d6122
+#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3)
+#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb)
+#define T38 0x4bdecfa9
+#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f)
+#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f)
+#define T41 0x289b7ec6
+#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805)
+#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a)
+#define T44 0x04881d05
+#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6)
+#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a)
+#define T47 0x1fa27cf8
+#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a)
+#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb)
+#define T50 0x432aff97
+#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58)
+#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6)
+#define T53 0x655b59c3
+#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d)
+#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82)
+#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e)
+#define T57 0x6fa87e4f
+#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f)
+#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb)
+#define T60 0x4e0811a1
+#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d)
+#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca)
+#define T63 0x2ad7d2bb
+#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
+
+
+static void
+md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
+{
+ md5_word_t
+ a = pms->abcd[0], b = pms->abcd[1],
+ c = pms->abcd[2], d = pms->abcd[3];
+ md5_word_t t;
+#if BYTE_ORDER > 0
+ /* Define storage only for big-endian CPUs. */
+ md5_word_t X[16];
+#else
+ /* Define storage for little-endian or both types of CPUs. */
+ md5_word_t xbuf[16];
+ const md5_word_t *X;
+#endif
+
+ {
+#if BYTE_ORDER == 0
+ /*
+ * Determine dynamically whether this is a big-endian or
+ * little-endian machine, since we can use a more efficient
+ * algorithm on the latter.
+ */
+ static const int w = 1;
+
+ if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
+#endif
+#if BYTE_ORDER <= 0 /* little-endian */
+ {
+ /*
+ * On little-endian machines, we can process properly aligned
+ * data without copying it.
+ */
+ if (!((data - (const md5_byte_t *)0) & 3)) {
+ /* data are properly aligned */
+ X = (const md5_word_t *)data;
+ } else {
+ /* not aligned */
+ memcpy(xbuf, data, 64);
+ X = xbuf;
+ }
+ }
+#endif
+#if BYTE_ORDER == 0
+ else /* dynamic big-endian */
+#endif
+#if BYTE_ORDER >= 0 /* big-endian */
+ {
+ /*
+ * On big-endian machines, we must arrange the bytes in the
+ * right order.
+ */
+ const md5_byte_t *xp = data;
+ int i;
+
+# if BYTE_ORDER == 0
+ X = xbuf; /* (dynamic only) */
+# else
+# define xbuf X /* (static only) */
+# endif
+ for (i = 0; i < 16; ++i, xp += 4)
+ xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
+ }
+#endif
+ }
+
+#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
+
+ /* Round 1. */
+ /* Let [abcd k s i] denote the operation
+ a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
+#define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + F(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 0, 7, T1);
+ SET(d, a, b, c, 1, 12, T2);
+ SET(c, d, a, b, 2, 17, T3);
+ SET(b, c, d, a, 3, 22, T4);
+ SET(a, b, c, d, 4, 7, T5);
+ SET(d, a, b, c, 5, 12, T6);
+ SET(c, d, a, b, 6, 17, T7);
+ SET(b, c, d, a, 7, 22, T8);
+ SET(a, b, c, d, 8, 7, T9);
+ SET(d, a, b, c, 9, 12, T10);
+ SET(c, d, a, b, 10, 17, T11);
+ SET(b, c, d, a, 11, 22, T12);
+ SET(a, b, c, d, 12, 7, T13);
+ SET(d, a, b, c, 13, 12, T14);
+ SET(c, d, a, b, 14, 17, T15);
+ SET(b, c, d, a, 15, 22, T16);
+#undef SET
+
+ /* Round 2. */
+ /* Let [abcd k s i] denote the operation
+ a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
+#define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + G(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 1, 5, T17);
+ SET(d, a, b, c, 6, 9, T18);
+ SET(c, d, a, b, 11, 14, T19);
+ SET(b, c, d, a, 0, 20, T20);
+ SET(a, b, c, d, 5, 5, T21);
+ SET(d, a, b, c, 10, 9, T22);
+ SET(c, d, a, b, 15, 14, T23);
+ SET(b, c, d, a, 4, 20, T24);
+ SET(a, b, c, d, 9, 5, T25);
+ SET(d, a, b, c, 14, 9, T26);
+ SET(c, d, a, b, 3, 14, T27);
+ SET(b, c, d, a, 8, 20, T28);
+ SET(a, b, c, d, 13, 5, T29);
+ SET(d, a, b, c, 2, 9, T30);
+ SET(c, d, a, b, 7, 14, T31);
+ SET(b, c, d, a, 12, 20, T32);
+#undef SET
+
+ /* Round 3. */
+ /* Let [abcd k s t] denote the operation
+ a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
+#define H(x, y, z) ((x) ^ (y) ^ (z))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + H(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 5, 4, T33);
+ SET(d, a, b, c, 8, 11, T34);
+ SET(c, d, a, b, 11, 16, T35);
+ SET(b, c, d, a, 14, 23, T36);
+ SET(a, b, c, d, 1, 4, T37);
+ SET(d, a, b, c, 4, 11, T38);
+ SET(c, d, a, b, 7, 16, T39);
+ SET(b, c, d, a, 10, 23, T40);
+ SET(a, b, c, d, 13, 4, T41);
+ SET(d, a, b, c, 0, 11, T42);
+ SET(c, d, a, b, 3, 16, T43);
+ SET(b, c, d, a, 6, 23, T44);
+ SET(a, b, c, d, 9, 4, T45);
+ SET(d, a, b, c, 12, 11, T46);
+ SET(c, d, a, b, 15, 16, T47);
+ SET(b, c, d, a, 2, 23, T48);
+#undef SET
+
+ /* Round 4. */
+ /* Let [abcd k s t] denote the operation
+ a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
+#define I(x, y, z) ((y) ^ ((x) | ~(z)))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + I(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 0, 6, T49);
+ SET(d, a, b, c, 7, 10, T50);
+ SET(c, d, a, b, 14, 15, T51);
+ SET(b, c, d, a, 5, 21, T52);
+ SET(a, b, c, d, 12, 6, T53);
+ SET(d, a, b, c, 3, 10, T54);
+ SET(c, d, a, b, 10, 15, T55);
+ SET(b, c, d, a, 1, 21, T56);
+ SET(a, b, c, d, 8, 6, T57);
+ SET(d, a, b, c, 15, 10, T58);
+ SET(c, d, a, b, 6, 15, T59);
+ SET(b, c, d, a, 13, 21, T60);
+ SET(a, b, c, d, 4, 6, T61);
+ SET(d, a, b, c, 11, 10, T62);
+ SET(c, d, a, b, 2, 15, T63);
+ SET(b, c, d, a, 9, 21, T64);
+#undef SET
+
+ /* Then perform the following additions. (That is increment each
+ of the four registers by the value it had before this block
+ was started.) */
+ pms->abcd[0] += a;
+ pms->abcd[1] += b;
+ pms->abcd[2] += c;
+ pms->abcd[3] += d;
+}
+
+void
+md5_init(md5_state_t *pms)
+{
+ pms->count[0] = pms->count[1] = 0;
+ pms->abcd[0] = 0x67452301;
+ pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
+ pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301;
+ pms->abcd[3] = 0x10325476;
+}
+
+void
+md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
+{
+ const md5_byte_t *p = data;
+ int left = nbytes;
+ int offset = (pms->count[0] >> 3) & 63;
+ md5_word_t nbits = (md5_word_t)(nbytes << 3);
+
+ if (nbytes <= 0)
+ return;
+
+ /* Update the message length. */
+ pms->count[1] += nbytes >> 29;
+ pms->count[0] += nbits;
+ if (pms->count[0] < nbits)
+ pms->count[1]++;
+
+ /* Process an initial partial block. */
+ if (offset) {
+ int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
+
+ memcpy(pms->buf + offset, p, copy);
+ if (offset + copy < 64)
+ return;
+ p += copy;
+ left -= copy;
+ md5_process(pms, pms->buf);
+ }
+
+ /* Process full blocks. */
+ for (; left >= 64; p += 64, left -= 64)
+ md5_process(pms, p);
+
+ /* Process a final partial block. */
+ if (left)
+ memcpy(pms->buf, p, left);
+}
+
+void
+md5_finish(md5_state_t *pms, md5_byte_t digest[16])
+{
+ static const md5_byte_t pad[64] = {
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ md5_byte_t data[8];
+ int i;
+
+ /* Save the length before padding. */
+ for (i = 0; i < 8; ++i)
+ data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
+ /* Pad to 56 bytes mod 64. */
+ md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
+ /* Append the length. */
+ md5_append(pms, data, 8);
+ for (i = 0; i < 16; ++i)
+ digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
+}
diff --git a/include/md5.h b/include/md5.h
new file mode 100644
index 00000000..37855ebb
--- /dev/null
+++ b/include/md5.h
@@ -0,0 +1,93 @@
+/*
+ Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved.
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ L. Peter Deutsch
+ ghost@aladdin.com
+
+ */
+/* $Id$ */
+/*
+ Independent implementation of MD5 (RFC 1321).
+
+ This code implements the MD5 Algorithm defined in RFC 1321, whose
+ text is available at
+ http://www.ietf.org/rfc/rfc1321.txt
+ The code is derived from the text of the RFC, including the test suite
+ (section A.5) but excluding the rest of Appendix A. It does not include
+ any code or documentation that is identified in the RFC as being
+ copyrighted.
+
+ The original and principal author of md5.h is L. Peter Deutsch
+ <ghost@aladdin.com>. Other authors are noted in the change history
+ that follows (in reverse chronological order):
+
+ 2002-04-13 lpd Removed support for non-ANSI compilers; removed
+ references to Ghostscript; clarified derivation from RFC 1321;
+ now handles byte order either statically or dynamically.
+ 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
+ 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
+ added conditionalization for C++ compilation from Martin
+ Purschke <purschke@bnl.gov>.
+ 1999-05-03 lpd Original version.
+ */
+
+#ifndef md5_INCLUDED
+# define md5_INCLUDED
+
+/*
+ * This package supports both compile-time and run-time determination of CPU
+ * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be
+ * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is
+ * defined as non-zero, the code will be compiled to run only on big-endian
+ * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to
+ * run on either big- or little-endian CPUs, but will run slightly less
+ * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined.
+ */
+
+#define MD5_DIGEST_SIZE 16
+
+typedef unsigned char md5_byte_t; /* 8-bit byte */
+typedef unsigned int md5_word_t; /* 32-bit word */
+
+/* Define the state of the MD5 Algorithm. */
+typedef struct md5_state_s {
+ md5_word_t count[2]; /* message length in bits, lsw first */
+ md5_word_t abcd[4]; /* digest buffer */
+ md5_byte_t buf[64]; /* accumulate block */
+} md5_state_t;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Initialize the algorithm. */
+void md5_init(md5_state_t *pms);
+
+/* Append a string to the message. */
+void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
+
+/* Finish the message and return the digest. */
+void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif
+
+#endif /* md5_INCLUDED */
diff --git a/misc/conf/zabbix_agentd.conf b/misc/conf/zabbix_agentd.conf
index af4c7661..aff57c07 100644
--- a/misc/conf/zabbix_agentd.conf
+++ b/misc/conf/zabbix_agentd.conf
@@ -7,9 +7,9 @@
Server=127.0.0.1
-# Listen port. Default is 10000
+# Listen port. Default is 10050
-ListenPort=10000
+#ListenPort=10050
# IP address to bind agent
# If missing, bind to all available IPs
diff --git a/misc/conf/zabbix_trapperd.conf b/misc/conf/zabbix_trapperd.conf
index b2c0628e..82f84c07 100644
--- a/misc/conf/zabbix_trapperd.conf
+++ b/misc/conf/zabbix_trapperd.conf
@@ -13,7 +13,7 @@ StartTrappers=5
# Listen port. Default port number is 10001. This parameter
# must be between 1024 and 32767
-ListenPort=10001
+#ListenPort=10051
# Specifies debug level
# 0 - debug is not created
diff --git a/src/zabbix_agent/Makefile.in b/src/zabbix_agent/Makefile.in
index 9d5eb759..825eb82e 100644
--- a/src/zabbix_agent/Makefile.in
+++ b/src/zabbix_agent/Makefile.in
@@ -2,8 +2,8 @@
all:
- @CC@ -o ../../bin/zabbix_agent @CFLAGS@ -I../../include zabbix_agent.c sysinfo.c ../../include/log.c ../../include/cfg.c ../../include/security.c ../../include/snprintf.c -Wall @LIBS@
- @CC@ -o ../../bin/zabbix_agentd @CFLAGS@ -I../../include zabbix_agentd.c sysinfo.c stats.c interfaces.c diskdevices.c ../../include/log.c ../../include/cfg.c ../../include/security.c ../../include/pid.c ../../include/snprintf.c -Wall @LIBS@
+ @CC@ -o ../../bin/zabbix_agent @CFLAGS@ -I../../include zabbix_agent.c sysinfo.c ../../include/log.c ../../include/cfg.c ../../include/security.c ../../include/snprintf.c ../../include/md5.c -Wall @LIBS@
+ @CC@ -o ../../bin/zabbix_agentd @CFLAGS@ -I../../include zabbix_agentd.c sysinfo.c stats.c interfaces.c diskdevices.c ../../include/log.c ../../include/cfg.c ../../include/security.c ../../include/pid.c ../../include/snprintf.c ../../include/md5.c -Wall @LIBS@
clean:
rm -f *.o
diff --git a/src/zabbix_agent/sysinfo.c b/src/zabbix_agent/sysinfo.c
index 8bec9760..08ffdc68 100644
--- a/src/zabbix_agent/sysinfo.c
+++ b/src/zabbix_agent/sysinfo.c
@@ -119,6 +119,8 @@
#include "common.h"
#include "sysinfo.h"
+#include "md5.h"
+
void forward_request(char *proxy,char *command,int port,char *value);
COMMAND commands[AGENT_MAX_USER_COMMANDS]=
@@ -147,6 +149,8 @@ COMMAND commands[AGENT_MAX_USER_COMMANDS]=
{"cksum[*]" ,CKSUM, 0, "/etc/services"},
+ {"md5sum[*]" ,0, MD5SUM, "/etc/services"},
+
{"filesize[*]" ,FILESIZE, 0, "/etc/passwd"},
{"netloadin1[*]" ,NETLOADIN1, 0, "lo"},
@@ -287,8 +291,8 @@ void process(char *command,char *value)
double result=0;
int i;
char *n,*l,*r;
- double (*function)();
- char *(*function_str)() = NULL;
+ int (*function)();
+ int (*function_str)();
char *parameter = NULL;
char key[MAX_STRING_LEN];
char proxy[MAX_STRING_LEN];
@@ -298,6 +302,7 @@ void process(char *command,char *value)
char cmd[1024];
char *res2 = NULL;
int ret_str=0;
+ double value_double;
for( p=command+strlen(command)-1; p>command && ( *p=='\r' || *p =='\n' || *p == ' ' ); --p );
@@ -333,7 +338,7 @@ void process(char *command,char *value)
{
if(0 == port[0])
{
- port_int=10000;
+ port_int=10050;
}
else
{
@@ -346,6 +351,7 @@ void process(char *command,char *value)
for(i=0;;i++)
{
+ /* End of array? */
if( commands[i].key == 0)
{
function=0;
@@ -378,6 +384,7 @@ void process(char *command,char *value)
if(function==0)
{
function_str=commands[i].function_str;
+ /* Command returns string, not double */
ret_str=1;
}
#ifdef TEST_PARAMETERS
@@ -408,8 +415,7 @@ void process(char *command,char *value)
{
if(function != 0)
{
- result = function(parameter);
- if( result == FAIL )
+ if(SYSINFO_RET_FAIL == function(command,parameter,&value_double))
{
result = NOTSUPPORTED;
}
@@ -421,13 +427,13 @@ void process(char *command,char *value)
}
else
{
- res2=function_str(parameter);
- if(res2==NULL)
+ i=function_str(command,parameter,&res2);
+ if(i==SYSINFO_RET_FAIL)
{
result = NOTSUPPORTED;
}
/* (int) to avoid compiler's warning */
- else if((int)res2==TIMEOUT_ERROR)
+ else if(i==SYSINFO_RET_TIMEOUT)
{
result = TIMEOUT_ERROR;
}
@@ -447,16 +453,67 @@ void process(char *command,char *value)
{
if(ret_str==0)
{
- snprintf(value,MAX_STRING_LEN-1,"%f",result);
+ snprintf(value,MAX_STRING_LEN-1,"%f",value_double);
}
else
{
snprintf(value,MAX_STRING_LEN-1,"%s",res2);
+ free(res2);
}
}
}
+/* MD5 sum calculation */
+
+int MD5SUM(const char *cmd, const char *filename, char **value)
+{
+ int fd;
+ int i,nr;
+ struct stat buf_stat;
+
+ md5_state_t state;
+ u_char buf[16 * 1024];
+
+ unsigned char hashText[MD5_DIGEST_SIZE*2+1];
+ unsigned char hash[MD5_DIGEST_SIZE];
+
+ if(stat(filename,&buf_stat) != 0)
+ {
+ /* Cannot stat() file */
+ return SYSINFO_RET_FAIL;
+ }
+
+ if(buf_stat.st_size > 64*1024*1024)
+ {
+ /* Will not calculate MD5 for files larger than 64M */
+ return SYSINFO_RET_FAIL;
+ }
+
+ fd=open(filename,O_RDONLY);
+ if(fd == -1)
+ {
+ return SYSINFO_RET_FAIL;
+ }
+
+ md5_init(&state);
+ while ((nr = read(fd, buf, sizeof(buf))) > 0)
+ {
+ md5_append(&state,(const md5_byte_t *)buf,nr);
+ }
+ md5_finish(&state,(md5_byte_t *)hash);
+
+ close(fd);
+
+/* Convert MD5 hash to text form */
+ for(i=0;i<MD5_DIGEST_SIZE;i++)
+ sprintf(&hashText[i<<1],"%02x",hash[i]);
+
+ *value=strdup(hashText);
+
+ return SYSINFO_RET_OK;
+}
+
/* Code for cksum is based on code from cksum.c */
static u_long crctab[] = {
@@ -523,7 +580,7 @@ static u_long crctab[] = {
* on failure. Errno is set on failure.
*/
-double CKSUM(const char * filename)
+int CKSUM(const char *cmd, const char *filename,double *value)
{
register u_char *p;
register int nr;
@@ -535,7 +592,7 @@ double CKSUM(const char * filename)
fd=open(filename,O_RDONLY);
if(fd == -1)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
#define COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)]
@@ -552,7 +609,7 @@ double CKSUM(const char * filename)
if (nr < 0)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
clen = len;
@@ -564,7 +621,9 @@ double CKSUM(const char * filename)
cval = ~crc;
- return (double)cval;
+ *value=(double)cval;
+
+ return SYSINFO_RET_OK;
}
int
@@ -653,19 +712,19 @@ point them all to the same buffer */
#endif
#endif
-double FILESIZE(const char * filename)
+int FILESIZE(const char *cmd, const char *filename,double *value)
{
struct stat buf;
if(stat(filename,&buf) == 0)
{
- return buf.st_size;
+ *value=(double)buf.st_size;
+ return SYSINFO_RET_OK;
}
-
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
-double SENSOR_TEMP1(void)
+int SENSOR_TEMP1(const char *cmd, const char *param,double *value)
{
DIR *dir;
struct dirent *entries;
@@ -679,7 +738,7 @@ double SENSOR_TEMP1(void)
dir=opendir("/proc/sys/dev/sensors");
if(NULL == dir)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
while((entries=readdir(dir))!=NULL)
@@ -701,20 +760,21 @@ double SENSOR_TEMP1(void)
if(sscanf(line,"%lf\t%lf\t%lf\n",&d1, &d2, &d3) == 3)
{
closedir(dir);
- return d3;
+ *value=d3;
+ return SYSINFO_RET_OK;
}
else
{
closedir(dir);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
}
}
closedir(dir);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
-double SENSOR_TEMP2(void)
+int SENSOR_TEMP2(const char *cmd, const char *param,double *value)
{
DIR *dir;
struct dirent *entries;
@@ -728,7 +788,7 @@ double SENSOR_TEMP2(void)
dir=opendir("/proc/sys/dev/sensors");
if(NULL == dir)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
while((entries=readdir(dir))!=NULL)
@@ -750,20 +810,21 @@ double SENSOR_TEMP2(void)
if(sscanf(line,"%lf\t%lf\t%lf\n",&d1, &d2, &d3) == 3)
{
closedir(dir);
- return d3;
+ *value=d3;
+ return SYSINFO_RET_OK;
}
else
{
closedir(dir);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
}
}
closedir(dir);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
-double SENSOR_TEMP3(void)
+int SENSOR_TEMP3(const char *cmd, const char *param,double *value)
{
DIR *dir;
struct dirent *entries;
@@ -777,7 +838,7 @@ double SENSOR_TEMP3(void)
dir=opendir("/proc/sys/dev/sensors");
if(NULL == dir)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
while((entries=readdir(dir))!=NULL)
@@ -799,20 +860,21 @@ double SENSOR_TEMP3(void)
if(sscanf(line,"%lf\t%lf\t%lf\n",&d1, &d2, &d3) == 3)
{
closedir(dir);
- return d3;
+ *value=d3;
+ return SYSINFO_RET_OK;
}
else
{
closedir(dir);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
}
}
closedir(dir);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
-double PROCCNT(const char * procname)
+int PROCCNT(const char *cmd, const char *procname,double *value)
{
#ifdef HAVE_PROC_0_PSINFO
DIR *dir;
@@ -829,7 +891,7 @@ double PROCCNT(const char * procname)
dir=opendir("/proc");
if(NULL == dir)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
while((entries=readdir(dir))!=NULL)
@@ -846,7 +908,7 @@ double PROCCNT(const char * procname)
if (read (fd, &psinfo, sizeof(psinfo)) == -1)
{
closedir(dir);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
else
{
@@ -864,7 +926,8 @@ double PROCCNT(const char * procname)
}
}
closedir(dir);
- return (double)proccount;
+ *value=(double)proccount;
+ return SYSINFO_RET_OK;
#else
#ifdef HAVE_PROC_1_STATUS
DIR *dir;
@@ -882,7 +945,7 @@ double PROCCNT(const char * procname)
dir=opendir("/proc");
if(NULL == dir)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
while((entries=readdir(dir))!=NULL)
@@ -926,25 +989,26 @@ double PROCCNT(const char * procname)
/* else
{
closedir(dir);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}*/
}
else
{
closedir(dir);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
}
}
closedir(dir);
- return (double)proccount;
+ *value=(double)proccount;
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
#endif
}
-double get_stat(const char *key)
+int get_stat(const char *key, double *value)
{
FILE *f;
char line[MAX_STRING_LEN];
@@ -954,7 +1018,7 @@ double get_stat(const char *key)
f=fopen("/tmp/zabbix_agentd.tmp","r");
if(f==NULL)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
while(fgets(line,MAX_STRING_LEN,f))
{
@@ -963,189 +1027,191 @@ double get_stat(const char *key)
if(strcmp(name1,key) == 0)
{
fclose(f);
- return atof(name2);
+ *value=atof(name2);
+ return SYSINFO_RET_OK;
}
}
}
fclose(f);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
-double DISKREADOPS1(char *device)
+int DISKREADOPS1(const char *cmd, const char *device,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"disk_read_ops1[%s]",device);
- return get_stat(key);
+ return get_stat(key,value);
}
-double DISKREADOPS5(char *device)
+int DISKREADOPS5(const char *cmd, const char *device,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"disk_read_ops5[%s]",device);
- return get_stat(key);
+ return get_stat(key,value);
}
-double DISKREADOPS15(char *device)
+int DISKREADOPS15(const char *cmd, const char *device,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"disk_read_ops15[%s]",device);
- return get_stat(key);
+ return get_stat(key,value);
}
-double DISKREADBLKS1(char *device)
+int DISKREADBLKS1(const char *cmd, const char *device,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"disk_read_blks1[%s]",device);
- return get_stat(key);
+ return get_stat(key,value);
}
-double DISKREADBLKS5(char *device)
+int DISKREADBLKS5(const char *cmd, const char *device,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"disk_read_blks5[%s]",device);
- return get_stat(key);
+ return get_stat(key,value);
}
-double DISKREADBLKS15(char *device)
+int DISKREADBLKS15(const char *cmd, const char *device,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"disk_read_blks15[%s]",device);
- return get_stat(key);
+ return get_stat(key,value);
}
-double DISKWRITEOPS1(char *device)
+int DISKWRITEOPS1(const char *cmd, const char *device,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"disk_write_ops1[%s]",device);
- return get_stat(key);
+ return get_stat(key,value);
}
-double DISKWRITEOPS5(char *device)
+int DISKWRITEOPS5(const char *cmd, const char *device,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"disk_write_ops5[%s]",device);
- return get_stat(key);
+ return get_stat(key,value);
}
-double DISKWRITEOPS15(char *device)
+int DISKWRITEOPS15(const char *cmd, const char *device,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"disk_write_ops15[%s]",device);
- return get_stat(key);
+ return get_stat(key,value);
}
-double DISKWRITEBLKS1(char *device)
+int DISKWRITEBLKS1(const char *cmd, const char *device,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"disk_write_blks1[%s]",device);
- return get_stat(key);
+ return get_stat(key,value);
}
-double DISKWRITEBLKS5(char *device)
+int DISKWRITEBLKS5(const char *cmd, const char *device,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"disk_write_blks5[%s]",device);
- return get_stat(key);
+ return get_stat(key,value);
}
-double DISKWRITEBLKS15(char *device)
+int DISKWRITEBLKS15(const char *cmd, const char *device,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"disk_write_blks15[%s]",device);
- return get_stat(key);
+ return get_stat(key,value);
}
-double NETLOADIN1(char *interface)
+int NETLOADIN1(const char *cmd, const char *interface,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"netloadin1[%s]",interface);
- return get_stat(key);
+ return get_stat(key,value);
}
-double NETLOADIN5(char *interface)
+int NETLOADIN5(const char *cmd, const char *interface,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"netloadin5[%s]",interface);
- return get_stat(key);
+ return get_stat(key,value);
}
-double NETLOADIN15(char *interface)
+int NETLOADIN15(const char *cmd, const char *interface,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"netloadin15[%s]",interface);
- return get_stat(key);
+ return get_stat(key,value);
}
-double NETLOADOUT1(char *interface)
+int NETLOADOUT1(const char *cmd, const char *interface,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"netloadout1[%s]",interface);
- return get_stat(key);
+ return get_stat(key,value);
}
-double NETLOADOUT5(char *interface)
+int NETLOADOUT5(const char *cmd, const char *interface,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"netloadout5[%s]",interface);
- return get_stat(key);
+ return get_stat(key,value);
}
-double NETLOADOUT15(char *interface)
+int NETLOADOUT15(const char *cmd, const char *interface,double *value)
{
char key[MAX_STRING_LEN];
snprintf(key,sizeof(key)-1,"netloadout15[%s]",interface);
- return get_stat(key);
+ return get_stat(key,value);
}
-double INODE(const char * mountPoint)
+int INODE(const char *cmd, const char *mountPoint,double *value)
{
#ifdef HAVE_SYS_STATVFS_H
struct statvfs s;
if ( statvfs( (char *)mountPoint, &s) != 0 )
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
- return s.f_favail;
+ *value=s.f_favail;
+ return SYSINFO_RET_OK;
#else
struct statfs s;
long blocks_used;
@@ -1153,7 +1219,7 @@ double INODE(const char * mountPoint)
if ( statfs( (char *)mountPoint, &s) != 0 )
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
if ( s.f_blocks > 0 ) {
@@ -1169,24 +1235,26 @@ double INODE(const char * mountPoint)
,blocks_percent_used
,mountPoint);
*/
- return s.f_ffree;
+ *value=s.f_ffree;
+ return SYSINFO_RET_OK;
}
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double INODETOTAL(const char * mountPoint)
+int INODETOTAL(const char *cmd, const char *mountPoint,double *value)
{
#ifdef HAVE_SYS_STATVFS_H
struct statvfs s;
if ( statvfs( (char *)mountPoint, &s) != 0 )
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
- return s.f_files;
+ *value=s.f_files;
+ return SYSINFO_RET_OK;
#else
struct statfs s;
long blocks_used;
@@ -1194,7 +1262,7 @@ double INODETOTAL(const char * mountPoint)
if ( statfs( (char *)mountPoint, &s) != 0 )
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
if ( s.f_blocks > 0 ) {
@@ -1210,25 +1278,27 @@ double INODETOTAL(const char * mountPoint)
,blocks_percent_used
,mountPoint);
*/
- return s.f_files;
+ *value=s.f_files;
+ return SYSINFO_RET_OK;
}
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double DISKFREE(const char * mountPoint)
+int DISKFREE(const char *cmd, const char *mountPoint,double *value)
{
#ifdef HAVE_SYS_STATVFS_H
struct statvfs s;
if ( statvfs( (char *)mountPoint, &s) != 0 )
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
/* return s.f_bavail * (s.f_bsize / 1024.0);*/
- return s.f_bavail * (s.f_frsize / 1024.0);
+ *value=s.f_bavail * (s.f_frsize / 1024.0);
+ return SYSINFO_RET_OK;
#else
struct statfs s;
long blocks_used;
@@ -1236,7 +1306,7 @@ double DISKFREE(const char * mountPoint)
if ( statfs( (char *)mountPoint, &s) != 0 )
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
if ( s.f_blocks > 0 ) {
@@ -1252,26 +1322,28 @@ double DISKFREE(const char * mountPoint)
,blocks_percent_used
,mountPoint);
*/
- return s.f_bavail * (s.f_bsize / 1024.0);
+ *value=s.f_bavail * (s.f_bsize / 1024.0);
+ return SYSINFO_RET_OK;
}
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double DISKUSED(const char * mountPoint)
+int DISKUSED(const char *cmd, const char *mountPoint,double *value)
{
#ifdef HAVE_SYS_STATVFS_H
struct statvfs s;
if ( statvfs( (char *)mountPoint, &s) != 0 )
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
/* return (s.f_blocks-s.f_bavail) * (s.f_bsize / 1024.0);*/
- return (s.f_blocks-s.f_bavail) * (s.f_frsize / 1024.0);
+ *value=(s.f_blocks-s.f_bavail) * (s.f_frsize / 1024.0);
+ return SYSINFO_RET_OK;
#else
struct statfs s;
long blocks_used;
@@ -1279,7 +1351,7 @@ double DISKUSED(const char * mountPoint)
if ( statfs( (char *)mountPoint, &s) != 0 )
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
if ( s.f_blocks > 0 ) {
@@ -1295,22 +1367,23 @@ double DISKUSED(const char * mountPoint)
,blocks_percent_used
,mountPoint);
*/
- return blocks_used * (s.f_bsize / 1024.0);
+ *value=blocks_used * (s.f_bsize / 1024.0);
+ return SYSINFO_RET_OK;
}
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double DISKTOTAL(const char * mountPoint)
+int DISKTOTAL(const char *cmd, const char *mountPoint,double *value)
{
#ifdef HAVE_SYS_STATVFS_H
struct statvfs s;
if ( statvfs( (char *)mountPoint, &s) != 0 )
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
/* return s.f_blocks * (s.f_bsize / 1024.0);*/
@@ -1322,7 +1395,7 @@ double DISKTOTAL(const char * mountPoint)
if ( statfs( (char *)mountPoint, &s) != 0 )
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
if ( s.f_blocks > 0 ) {
@@ -1338,15 +1411,16 @@ double DISKTOTAL(const char * mountPoint)
,blocks_percent_used
,mountPoint);
*/
- return s.f_blocks * (s.f_bsize / 1024.0);
+ *value=s.f_blocks * (s.f_bsize / 1024.0);
+ return SYSINFO_RET_OK;
}
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double TCP_LISTEN(const char *porthex)
+int TCP_LISTEN(const char *cmd, const char *porthex,double *value)
{
#ifdef HAVE_PROC
FILE *f;
@@ -1360,7 +1434,7 @@ double TCP_LISTEN(const char *porthex)
f=fopen("/proc/net/tcp","r");
if(NULL == f)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
while (NULL!=fgets(c,MAX_STRING_LEN,f))
@@ -1368,19 +1442,21 @@ double TCP_LISTEN(const char *porthex)
if(NULL != strstr(c,pattern))
{
fclose(f);
- return 1;
+ *value=1;
+ return SYSINFO_RET_OK;
}
}
fclose(f);
- return 0;
+ *value=0;
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
#ifdef HAVE_PROC
-double getPROC(char *file,int lineno,int fieldno)
+int getPROC(char *file,int lineno,int fieldno, double *value)
{
FILE *f;
char *t;
@@ -1391,7 +1467,7 @@ double getPROC(char *file,int lineno,int fieldno)
f=fopen(file,"r");
if(NULL == f)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
for(i=1;i<=lineno;i++)
{
@@ -1406,11 +1482,12 @@ double getPROC(char *file,int lineno,int fieldno)
sscanf(t, "%lf", &result );
- return result;
+ *value=result;
+ return SYSINFO_RET_OK;
}
#endif
-double CACHEDMEM(void)
+int CACHEDMEM(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_PROC
/* Get CACHED memory in bytes */
@@ -1420,12 +1497,12 @@ double CACHEDMEM(void)
FILE *f;
char *t;
char c[MAX_STRING_LEN];
- double result = FAIL;
+ double result = SYSINFO_RET_FAIL;
f=fopen("/proc/meminfo","r");
if(NULL == f)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
while(NULL!=fgets(c,MAX_STRING_LEN,f))
{
@@ -1439,13 +1516,14 @@ double CACHEDMEM(void)
}
fclose(f);
- return result;
+ *value=result;
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double BUFFERSMEM(void)
+int BUFFERSMEM(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_SYSINFO_BUFFERRAM
struct sysinfo info;
@@ -1453,21 +1531,22 @@ double BUFFERSMEM(void)
if( 0 == sysinfo(&info))
{
#ifdef HAVE_SYSINFO_MEM_UNIT
- return (double)info.bufferram * (double)info.mem_unit;
+ *value=(double)info.bufferram * (double)info.mem_unit;
#else
- return (double)info.bufferram;
+ *value=(double)info.bufferram;
#endif
+ return SYSINFO_RET_OK;
}
else
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double SHAREDMEM(void)
+int SHAREDMEM(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_SYSINFO_SHAREDRAM
struct sysinfo info;
@@ -1475,14 +1554,15 @@ double SHAREDMEM(void)
if( 0 == sysinfo(&info))
{
#ifdef HAVE_SYSINFO_MEM_UNIT
- return (double)info.sharedram * (double)info.mem_unit;
+ *value=(double)info.sharedram * (double)info.mem_unit;
#else
- return (double)info.sharedram;
+ *value=(double)info.sharedram;
#endif
+ return SYSINFO_RET_OK;
}
else
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
#else
#ifdef HAVE_SYS_VMMETER_VMTOTAL
@@ -1495,18 +1575,20 @@ double SHAREDMEM(void)
sysctl(mib,2,&v,&len,NULL,0);
- return (double)(v.t_armshr<<2);
+ *value=(double)(v.t_armshr<<2);
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
#endif
}
-double TOTALMEM(void)
+int TOTALMEM(const char *cmd, const char *parameter,double *value)
{
/* Solaris */
#ifdef HAVE_UNISTD_SYSCONF
- return (double)sysconf(_SC_PHYS_PAGES)*sysconf(_SC_PAGESIZE);
+ *value=(double)sysconf(_SC_PHYS_PAGES)*sysconf(_SC_PAGESIZE);
+ return SYSINFO_RET_OK;
#else
#ifdef HAVE_SYS_PSTAT_H
struct pst_static pst;
@@ -1514,14 +1596,15 @@ double TOTALMEM(void)
if(pstat_getstatic(&pst, sizeof(pst), (size_t)1, 0) == -1)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
else
{
/* Get page size */
page = pst.page_size;
/* Total physical memory in bytes */
- return page*pst.physical_memory;
+ *value=page*pst.physical_memory;
+ return SYSINFO_RET_OK;
}
#else
#ifdef HAVE_SYSINFO_TOTALRAM
@@ -1530,14 +1613,15 @@ double TOTALMEM(void)
if( 0 == sysinfo(&info))
{
#ifdef HAVE_SYSINFO_MEM_UNIT
- return (double)info.totalram * (double)info.mem_unit;
+ *value=(double)info.totalram * (double)info.mem_unit;
#else
- return (double)info.totalram;
+ *value=(double)info.totalram;
#endif
+ return SYSINFO_RET_OK;
}
else
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
#else
#ifdef HAVE_SYS_VMMETER_VMTOTAL
@@ -1550,20 +1634,22 @@ double TOTALMEM(void)
sysctl(mib,2,&v,&len,NULL,0);
- return (double)(v.t_rm<<2);
+ *value=(double)(v.t_rm<<2);
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
#endif
#endif
#endif
}
-double FREEMEM(void)
+int FREEMEM(const char *cmd, const char *parameter,double *value)
{
/* Solaris */
#ifdef HAVE_UNISTD_SYSCONF
- return (double)sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PAGESIZE);
+ *value=(double)sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PAGESIZE);
+ return SYSINFO_RET_OK;
#else
#ifdef HAVE_SYS_PSTAT_H
struct pst_static pst;
@@ -1572,7 +1658,7 @@ double FREEMEM(void)
if(pstat_getstatic(&pst, sizeof(pst), (size_t)1, 0) == -1)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
else
{
@@ -1582,7 +1668,7 @@ double FREEMEM(void)
if (pstat_getdynamic(&dyn, sizeof(dyn), 1, 0) == -1)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
else
{
@@ -1598,7 +1684,8 @@ double FREEMEM(void)
*/
/* Free memory in bytes */
- return dyn.psd_free * page;
+ *value=dyn.psd_free * page;
+ return SYSINFO_RET_OK;
}
}
#else
@@ -1608,14 +1695,15 @@ double FREEMEM(void)
if( 0 == sysinfo(&info))
{
#ifdef HAVE_SYSINFO_MEM_UNIT
- return (double)info.freeram * (double)info.mem_unit;
+ *value=(double)info.freeram * (double)info.mem_unit;
#else
- return (double)info.freeram;
+ *value=(double)info.freeram;
#endif
+ return SYSINFO_RET_OK;
}
else
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
#else
#ifdef HAVE_SYS_VMMETER_VMTOTAL
@@ -1628,16 +1716,17 @@ double FREEMEM(void)
sysctl(mib,2,&v,&len,NULL,0);
- return (double)(v.t_free<<2);
+ *value=(double)(v.t_free<<2);
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
#endif
#endif
#endif
}
-double KERNEL_MAXFILES(void)
+int KERNEL_MAXFILES(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES
int mib[2],len;
@@ -1650,16 +1739,17 @@ double KERNEL_MAXFILES(void)
if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
- return (double)(maxfiles);
+ *value=(double)(maxfiles);
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double KERNEL_MAXPROC(void)
+int KERNEL_MAXPROC(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXPROC
int mib[2],len;
@@ -1672,28 +1762,30 @@ double KERNEL_MAXPROC(void)
if(sysctl(mib,2,&maxproc,(size_t *)&len,NULL,0) != 0)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
/* printf("Errno [%m]");*/
}
- return (double)(maxproc);
+ *value=(double)(maxproc);
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double UPTIME(void)
+int UPTIME(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_SYSINFO_UPTIME
struct sysinfo info;
if( 0 == sysinfo(&info))
{
- return (double)info.uptime;
+ *value=(double)info.uptime;
+ return SYSINFO_RET_OK;
}
else
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
#else
#ifdef HAVE_FUNCTION_SYSCTL_KERN_BOOTTIME
@@ -1708,13 +1800,14 @@ double UPTIME(void)
if(sysctl(mib,2,&uptime,(size_t *)&len,NULL,0) != 0)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
/* printf("Errno [%m]\n");*/
}
now=time(NULL);
- return (double)(now-uptime.tv_sec);
+ *value=(double)(now-uptime.tv_sec);
+ return SYSINFO_RET_OK;
#else
/* Solaris */
#ifdef HAVE_KSTAT_H
@@ -1731,7 +1824,7 @@ double UPTIME(void)
kc = kstat_open();
if (0 == kc)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
/* read uptime counter */
@@ -1739,44 +1832,47 @@ double UPTIME(void)
if (0 == kp)
{
kstat_close(kc);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
if(-1 == kstat_read(kc, kp, 0))
{
kstat_close(kc);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
kn = (kstat_named_t*)kstat_data_lookup(kp, "clk_intr");
secs = kn->value.ul / hz;
/* close kstat */
kstat_close(kc);
- return (double)secs;
+ *value=(double)secs;
+ reutrn SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
#endif
#endif
}
-double PING(void)
+int PING(const char *cmd, const char *parameter,double *value)
{
- return 1;
+ *value=1;
+ return SYSINFO_RET_OK;
}
-double PROCLOAD(void)
+int PROCLOAD(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_GETLOADAVG
double load[3];
if(getloadavg(load, 3))
{
- return load[0];
+ *value=load[0];
+ return SYSINFO_RET_OK;
}
else
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
#else
#ifdef HAVE_SYS_PSTAT_H
@@ -1784,15 +1880,16 @@ double PROCLOAD(void)
if (pstat_getdynamic(&dyn, sizeof(dyn), 1, 0) == -1)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
else
{
- return dyn.psd_avg_1_min;
+ *value=(double)dyn.psd_avg_1_min;
+ return SYSINFO_RET_OK;
}
#else
#ifdef HAVE_PROC_LOADAVG
- return getPROC("/proc/loadavg",1,1);
+ return getPROC("/proc/loadavg",1,1,value);
#else
#ifdef HAVE_KSTAT_H
static kstat_ctl_t *kc = NULL;
@@ -1801,35 +1898,37 @@ double PROCLOAD(void)
if (!kc && !(kc = kstat_open()))
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
if (!(ks = kstat_lookup(kc, "unix", 0, "system_misc")) ||
kstat_read(kc, ks, 0) == -1 ||
!(kn = kstat_data_lookup(ks,"avenrun_1min")))
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
- return kn->value.ul/256.0;
+ *value=(double)kn->value.ul/256.0;
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
#endif
#endif
#endif
}
-double PROCLOAD5(void)
+int PROCLOAD5(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_GETLOADAVG
double load[3];
if(getloadavg(load, 3))
{
- return load[1];
+ *value=load[1];
+ return SYSINFO_RET_OK;
}
else
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
#else
#ifdef HAVE_SYS_PSTAT_H
@@ -1837,15 +1936,16 @@ double PROCLOAD5(void)
if (pstat_getdynamic(&dyn, sizeof(dyn), 1, 0) == -1)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
else
{
- return dyn.psd_avg_5_min;
+ *value=(double)dyn.psd_avg_5_min;
+ return SYSINFO_RET_OK;
}
#else
#ifdef HAVE_PROC_LOADAVG
- return getPROC("/proc/loadavg",1,2);
+ return getPROC("/proc/loadavg",1,2,value);
#else
#ifdef HAVE_KSTAT_H
static kstat_ctl_t *kc = NULL;
@@ -1854,35 +1954,37 @@ double PROCLOAD5(void)
if (!kc && !(kc = kstat_open()))
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
if (!(ks = kstat_lookup(kc, "unix", 0, "system_misc")) ||
kstat_read(kc, ks, 0) == -1 ||
!(kn = kstat_data_lookup(ks,"avenrun_5min")))
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
- return kn->value.ul/256.0;
+ *value=(double)kn->value.ul/256.0;
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
#endif
#endif
#endif
}
-double PROCLOAD15(void)
+int PROCLOAD15(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_GETLOADAVG
double load[3];
if(getloadavg(load, 3))
{
- return load[2];
+ *value=load[2];
+ return SYSINFO_RET_OK;
}
else
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
#else
#ifdef HAVE_SYS_PSTAT_H
@@ -1890,15 +1992,16 @@ double PROCLOAD15(void)
if (pstat_getdynamic(&dyn, sizeof(dyn), 1, 0) == -1)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
else
{
- return dyn.psd_avg_15_min;
+ *value=(double)dyn.psd_avg_15_min;
+ return SYSINFO_RET_OK;
}
#else
#ifdef HAVE_PROC_LOADAVG
- return getPROC("/proc/loadavg",1,3);
+ return getPROC("/proc/loadavg",1,3,value);
#else
#ifdef HAVE_KSTAT_H
static kstat_ctl_t *kc = NULL;
@@ -1907,24 +2010,25 @@ double PROCLOAD15(void)
if (!kc && !(kc = kstat_open()))
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
if (!(ks = kstat_lookup(kc, "unix", 0, "system_misc")) ||
kstat_read(kc, ks, 0) == -1 ||
!(kn = kstat_data_lookup(ks,"avenrun_15min")))
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
- return kn->value.ul/256.0;
+ *value=(double)kn->value.ul/256.0;
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
#endif
#endif
#endif
}
-double SWAPFREE(void)
+int SWAPFREE(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_SYSINFO_FREESWAP
struct sysinfo info;
@@ -1932,14 +2036,15 @@ double SWAPFREE(void)
if( 0 == sysinfo(&info))
{
#ifdef HAVE_SYSINFO_MEM_UNIT
- return (double)info.freeswap * (double)info.mem_unit;
+ *value=(double)info.freeswap * (double)info.mem_unit;
#else
- return (double)info.freeswap;
+ *value=(double)info.freeswap;
#endif
+ return SYSINFO_RET_OK;
}
else
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
/* Solaris */
#else
@@ -1948,25 +2053,27 @@ double SWAPFREE(void)
get_swapinfo(&swaptotal,&swapfree);
- return swapfree;
+ *value=swapfree;
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
#endif
}
-double PROCCOUNT(void)
+int PROCCOUNT(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_SYSINFO_PROCS
struct sysinfo info;
if( 0 == sysinfo(&info))
{
- return info.procs;
+ *value=(double)info.procs;
+ return SYSINFO_RET_OK;
}
else
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
#else
#ifdef HAVE_PROC_0_PSINFO
@@ -1984,7 +2091,7 @@ double PROCCOUNT(void)
dir=opendir("/proc");
if(NULL == dir)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
while((entries=readdir(dir))!=NULL)
@@ -2001,7 +2108,7 @@ double PROCCOUNT(void)
if (read (fd, &psinfo, sizeof(psinfo)) == -1)
{
closedir(dir);
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
else
{
@@ -2016,7 +2123,8 @@ double PROCCOUNT(void)
}
}
closedir(dir);
- return (double)proccount;
+ *value=(double)proccount;
+ return SYSINFO_RET_OK;
#else
#ifdef HAVE_PROC_1_STATUS
DIR *dir;
@@ -2032,7 +2140,7 @@ double PROCCOUNT(void)
dir=opendir("/proc");
if(NULL == dir)
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
while((entries=readdir(dir))!=NULL)
@@ -2057,15 +2165,16 @@ double PROCCOUNT(void)
}
}
closedir(dir);
- return (double)proccount;
+ *value=(double)proccount;
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
#endif
#endif
}
-double SWAPTOTAL(void)
+int SWAPTOTAL(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_SYSINFO_TOTALSWAP
struct sysinfo info;
@@ -2073,14 +2182,15 @@ double SWAPTOTAL(void)
if( 0 == sysinfo(&info))
{
#ifdef HAVE_SYSINFO_MEM_UNIT
- return (double)info.totalswap * (double)info.mem_unit;
+ *value=(double)info.totalswap * (double)info.mem_unit;
#else
- return (double)info.totalswap;
+ *value=(double)info.totalswap;
#endif
+ return SYSINFO_RET_OK;
}
else
{
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
/* Solaris */
#else
@@ -2089,66 +2199,68 @@ double SWAPTOTAL(void)
get_swapinfo(&swaptotal,&swapfree);
- return swaptotal;
+ *value=(double)swaptotal;
+ return SYSINFO_RET_OK;
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
#endif
}
-double DISK_IO(void)
+int DISK_IO(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_PROC
- return getPROC("/proc/stat",2,2);
+ return getPROC("/proc/stat",2,2,value);
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double DISK_RIO(void)
+int DISK_RIO(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_PROC
- return getPROC("/proc/stat",3,2);
+ return getPROC("/proc/stat",3,2,value);
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double DISK_WIO(void)
+int DISK_WIO(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_PROC
- return getPROC("/proc/stat",4,2);
+ return getPROC("/proc/stat",4,2,value);
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double DISK_RBLK(void)
+int DISK_RBLK(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_PROC
- return getPROC("/proc/stat",5,2);
+ return getPROC("/proc/stat",5,2,value);
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-double DISK_WBLK(void)
+int DISK_WBLK(const char *cmd, const char *parameter,double *value)
{
#ifdef HAVE_PROC
- return getPROC("/proc/stat",6,2);
+ return getPROC("/proc/stat",6,2,value);
#else
- return FAIL;
+ return SYSINFO_RET_FAIL;
#endif
}
-char *VERSION(void)
+int VERSION(const char *cmd, const char *parameter,char **value)
{
static char version[]="1.1alpha1\n";
- return version;
+ *value=strdup(version);
+ return SYSINFO_RET_OK;
}
-char *EXECUTE_STR(char *command)
+int EXECUTE_STR(const char *cmd, const char *command,char **value)
{
FILE *f;
static char c[MAX_STRING_LEN];
@@ -2160,9 +2272,9 @@ char *EXECUTE_STR(char *command)
{
case EINTR:
/* (char *) to avoid compiler warning */
- return (char *)TIMEOUT_ERROR;
+ return SYSINFO_RET_TIMEOUT;
default:
- return NULL;
+ return SYSINFO_RET_FAIL;
}
}
@@ -2173,10 +2285,10 @@ char *EXECUTE_STR(char *command)
case EINTR:
pclose(f);
/* (char *) to avoid compiler warning */
- return (char *)TIMEOUT_ERROR;
+ return SYSINFO_RET_TIMEOUT;
default:
pclose(f);
- return NULL;
+ return SYSINFO_RET_FAIL;
}
}
@@ -2186,16 +2298,17 @@ char *EXECUTE_STR(char *command)
{
case EINTR:
/* (char *) to avoid compiler warning */
- return (char *)TIMEOUT_ERROR;
+ return SYSINFO_RET_TIMEOUT;
default:
- return NULL;
+ return SYSINFO_RET_FAIL;
}
}
- return c;
+ *value=strdup(c);
+ return SYSINFO_RET_OK;
}
-double EXECUTE(char *command)
+int EXECUTE(const char *cmd, const char *command,double *value)
{
FILE *f;
double result;
@@ -2207,9 +2320,9 @@ double EXECUTE(char *command)
switch (errno)
{
case EINTR:
- return TIMEOUT_ERROR;
+ return SYSINFO_RET_TIMEOUT;
default:
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
}
@@ -2219,9 +2332,9 @@ double EXECUTE(char *command)
switch (errno)
{
case EINTR:
- return TIMEOUT_ERROR;
+ return SYSINFO_RET_TIMEOUT;
default:
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
}
@@ -2230,15 +2343,16 @@ double EXECUTE(char *command)
switch (errno)
{
case EINTR:
- return TIMEOUT_ERROR;
+ return SYSINFO_RET_TIMEOUT;
default:
- return FAIL;
+ return SYSINFO_RET_FAIL;
}
}
sscanf(c, "%lf", &result );
- return result;
+ *value=result;
+ return SYSINFO_RET_OK;
}
void forward_request(char *proxy,char *command,int port,char *value)
@@ -2306,7 +2420,7 @@ void forward_request(char *proxy,char *command,int port,char *value)
* 0 - NOT OK
* 1 - OK
* */
-int tcp_expect(char *hostname, short port, char *expect,char *sendtoclose)
+int tcp_expect(char *hostname, short port, char *expect,char *sendtoclose, int *value_int)
{
char *haddr;
char c[1024];
@@ -2321,7 +2435,8 @@ int tcp_expect(char *hostname, short port, char *expect,char *sendtoclose)
host = gethostbyname(hostname);
if(host == NULL)
{
- return 0;
+ *value_int = 0;
+ return SYSINFO_RET_OK;
}
haddr=host->h_addr;
@@ -2337,19 +2452,22 @@ int tcp_expect(char *hostname, short port, char *expect,char *sendtoclose)
if (s == -1)
{
close(s);
- return 0;
+ *value_int = 0;
+ return SYSINFO_RET_OK;
}
if (connect(s, (struct sockaddr *) &addr, addrlen) == -1)
{
close(s);
- return 0;
+ *value_int = 0;
+ return SYSINFO_RET_OK;
}
if( expect == NULL)
{
close(s);
- return 1;
+ *value_int = 1;
+ return SYSINFO_RET_OK;
}
memset(&c, 0, 1024);
@@ -2358,21 +2476,23 @@ int tcp_expect(char *hostname, short port, char *expect,char *sendtoclose)
{
send(s,sendtoclose,strlen(sendtoclose),0);
close(s);
- return 1;
+ *value_int = 1;
+ return SYSINFO_RET_OK;
}
else
{
send(s,sendtoclose,strlen(sendtoclose),0);
close(s);
- return 0;
+ *value_int = 0;
+ return SYSINFO_RET_OK;
}
}
/*
- * 0 - NOT OK
- * 1 - OK
+ * 0- NOT OK
+ * 1 - OK
* */
-int check_ssh(char *hostname, short port)
+int check_ssh(char *hostname, short port, int *value)
{
char *haddr;
char c[MAX_STRING_LEN];
@@ -2390,7 +2510,8 @@ int check_ssh(char *hostname, short port)
host = gethostbyname(hostname);
if(host == NULL)
{
- return 0;
+ *value=0;
+ return SYSINFO_RET_OK;
}
haddr=host->h_addr;
@@ -2405,13 +2526,15 @@ int check_ssh(char *hostname, short port)
if (s == -1)
{
close(s);
- return 0;
+ *value=0;
+ return SYSINFO_RET_OK;
}
if (connect(s, (struct sockaddr *) &addr, addrlen) == -1)
{
close(s);
- return 0;
+ *value=0;
+ return SYSINFO_RET_OK;
}
memset(&c, 0, 1024);
@@ -2430,19 +2553,21 @@ int check_ssh(char *hostname, short port)
/* printf("[%s]\n",out);*/
close(s);
- return 1;
+ *value=1;
+ return SYSINFO_RET_OK;
}
else
{
send(s,"0\n",2,0);
close(s);
- return 0;
+ *value=0;
+ return SYSINFO_RET_OK;
}
}
/* Example check_service[ssh], check_service[smtp,29],check_service[ssh,127.0.0.1,22]*/
/* check_service[ssh,127.0.0.1,ssh] */
-double CHECK_SERVICE_PERF(char *service_and_ip_and_port)
+int CHECK_SERVICE_PERF(const char *cmd, const char *service_and_ip_and_port,double *value)
{
char *c,*c1;
int port=0;
@@ -2454,6 +2579,7 @@ double CHECK_SERVICE_PERF(char *service_and_ip_and_port)
struct timezone tz1,tz2;
int result;
+ int value_int;
long exec_time;
@@ -2497,65 +2623,67 @@ double CHECK_SERVICE_PERF(char *service_and_ip_and_port)
if(strcmp(service,"ssh") == 0)
{
if(port == 0) port=22;
- result=check_ssh(ip,port);
+ result=check_ssh(ip,port,&value_int);
}
else if(strcmp(service,"smtp") == 0)
{
if(port == 0) port=25;
- result=tcp_expect(ip,port,"220","QUIT\n");
+ result=tcp_expect(ip,port,"220","QUIT\n",&value_int);
}
else if(strcmp(service,"ftp") == 0)
{
if(port == 0) port=21;
- result=tcp_expect(ip,port,"220","");
+ result=tcp_expect(ip,port,"220","",&value_int);
}
else if(strcmp(service,"http") == 0)
{
if(port == 0) port=80;
- result=tcp_expect(ip,port,NULL,"");
+ result=tcp_expect(ip,port,NULL,"",&value_int);
}
else if(strcmp(service,"pop") == 0)
{
if(port == 0) port=110;
- result=tcp_expect(ip,port,"+OK","");
+ result=tcp_expect(ip,port,"+OK","",&value_int);
}
else if(strcmp(service,"nntp") == 0)
{
if(port == 0) port=119;
/* 220 is incorrect */
/* result=tcp_expect(ip,port,"220","");*/
- result=tcp_expect(ip,port,"200","");
+ result=tcp_expect(ip,port,"200","",&value_int);
}
else if(strcmp(service,"imap") == 0)
{
if(port == 0) port=143;
- result=tcp_expect(ip,port,"* OK","a1 LOGOUT\n");
+ result=tcp_expect(ip,port,"* OK","a1 LOGOUT\n",&value_int);
}
else if(strcmp(service,"tcp") == 0)
{
if(port == 0) port=80;
- result=tcp_expect(ip,port,NULL,"");
+ result=tcp_expect(ip,port,NULL,"",&value_int);
}
else
{
- result=0;
+ return SYSINFO_RET_FAIL;
}
- if(1 == result)
+ if(1 == value_int)
{
gettimeofday(&t2,&tz2);
exec_time=(t2.tv_sec - t1.tv_sec) * 1000000 + (t2.tv_usec - t1.tv_usec);
- return (double)exec_time/1000000;
+ *value=(double)exec_time/1000000;
+ return SYSINFO_RET_OK;
}
else
{
- return (double)result;
+ *value=0;
+ return SYSINFO_RET_OK;
}
}
/* Example check_service[ssh], check_service[smtp,29],check_service[ssh,127.0.0.1,22]*/
/* check_service[ssh,127.0.0.1,ssh] */
-double CHECK_SERVICE(char *service_and_ip_and_port)
+int CHECK_SERVICE(const char *cmd, const char *service_and_ip_and_port,double *value)
{
int port=0;
char service[MAX_STRING_LEN];
@@ -2565,6 +2693,7 @@ double CHECK_SERVICE(char *service_and_ip_and_port)
char *s;
int result;
+ int value_int;
/* Default IP address */
strscpy(ip,"127.0.0.1");
@@ -2648,57 +2777,61 @@ double CHECK_SERVICE(char *service_and_ip_and_port)
if(strcmp(service,"ssh") == 0)
{
if(port == 0) port=22;
- result=check_ssh(ip,port);
+ result=check_ssh(ip,port,&value_int);
}
else if(strcmp(service,"smtp") == 0)
{
if(port == 0) port=25;
- result=tcp_expect(ip,port,"220","QUIT\n");
+ result=tcp_expect(ip,port,"220","QUIT\n",&value_int);
}
else if(strcmp(service,"ftp") == 0)
{
if(port == 0) port=21;
- result=tcp_expect(ip,port,"220","");
+ result=tcp_expect(ip,port,"220","",&value_int);
}
else if(strcmp(service,"http") == 0)
{
if(port == 0) port=80;
- result=tcp_expect(ip,port,NULL,"");
+ result=tcp_expect(ip,port,NULL,"",&value_int);
}
else if(strcmp(service,"pop") == 0)
{
if(port == 0) port=110;
- result=tcp_expect(ip,port,"+OK","");
+ result=tcp_expect(ip,port,"+OK","",&value_int);
}
else if(strcmp(service,"nntp") == 0)
{
if(port == 0) port=119;
/* 220 is incorrect */
/* result=tcp_expect(ip,port,"220","");*/
- result=tcp_expect(ip,port,"200","");
+ result=tcp_expect(ip,port,"200","",&value_int);
}
else if(strcmp(service,"imap") == 0)
{
if(port == 0) port=143;
- result=tcp_expect(ip,port,"* OK","a1 LOGOUT\n");
+ result=tcp_expect(ip,port,"* OK","a1 LOGOUT\n",&value_int);
}
else if(strcmp(service,"tcp") == 0)
{
if(port == 0) port=80;
- result=tcp_expect(ip,port,NULL,"");
+ result=tcp_expect(ip,port,NULL,"",&value_int);
}
else
{
- result=FAIL;
+ result=SYSINFO_RET_FAIL;
}
- return (double)result;
+ *value=(double)value_int;
+
+ return result;
}
-double CHECK_PORT(char *ip_and_port)
+int CHECK_PORT(const char *cmd, const char *ip_and_port,double *value)
{
char *c;
int port=0;
+ int value_int;
+ int result;
char ip[MAX_STRING_LEN];
c=strchr(ip_and_port,',');
@@ -2715,5 +2848,7 @@ double CHECK_PORT(char *ip_and_port)
strcpy(ip,"127.0.0.1");
}
- return tcp_expect(ip,port,NULL,"");
+ result = tcp_expect(ip,port,NULL,"",&value_int);
+ *value = (double)value_int;
+ return result;
}
diff --git a/src/zabbix_agent/sysinfo.h b/src/zabbix_agent/sysinfo.h
index 1592c34b..efd986de 100644
--- a/src/zabbix_agent/sysinfo.h
+++ b/src/zabbix_agent/sysinfo.h
@@ -22,79 +22,90 @@
#define ZABBIX_SYSINFO_H
/* #define TEST_PARAMETERS */
+
+#define SYSINFO_RET_OK 0
+#define SYSINFO_RET_FAIL 1
+#define SYSINFO_RET_TIMEOUT 2
void process(char *command, char *value);
void add_user_parameter(char *key,char *command);
void test_parameters(void);
-double getPROC(char *file,int lineno,int fieldno);
-
-double BUFFERSMEM(void);
-double CACHEDMEM(void);
-double CKSUM(const char * filename);
-double FILESIZE(const char * filename);
-double DISKFREE(const char * mountPoint);
-double DISKTOTAL(const char * mountPoint);
-double DISKUSED(const char * mountPoint);
-double DISK_IO(void);
-double DISK_RIO(void);
-double DISK_WIO(void);
-double DISK_RBLK(void);
-double DISK_WBLK(void);
-double FREEMEM(void);
-double INODE(const char * mountPoint);
-double INODETOTAL(const char * mountPoint);
-double KERNEL_MAXPROC(void);
-double KERNEL_MAXFILES(void);
-double NETLOADIN1(char *interface);
-double NETLOADIN5(char *interface);
-double NETLOADIN15(char *interface);
-double NETLOADOUT1(char *interface);
-double NETLOADOUT5(char *interface);
-double NETLOADOUT15(char *interface);
-double DISKREADOPS1(char *device);
-double DISKREADOPS5(char *device);
-double DISKREADOPS15(char *device);
-double DISKREADBLKS1(char *device);
-double DISKREADBLKS5(char *device);
-double DISKREADBLKS15(char *device);
-double DISKWRITEOPS1(char *device);
-double DISKWRITEOPS5(char *device);
-double DISKWRITEOPS15(char *device);
-double DISKWRITEBLKS1(char *device);
-double DISKWRITEBLKS5(char *device);
-double DISKWRITEBLKS15(char *device);
-double PING(void);
-double SHAREDMEM(void);
-double TOTALMEM(void);
-double PROCCNT(const char *procname);
-double PROCCOUNT(void);
-double PROCLOAD(void);
-double PROCLOAD5(void);
-double PROCLOAD15(void);
-double SENSOR_TEMP1(void);
-double SENSOR_TEMP2(void);
-double SENSOR_TEMP3(void);
-double SWAPFREE(void);
-double SWAPTOTAL(void);
-double TCP_LISTEN(const char *porthex);
-double UPTIME(void);
-
-double EXECUTE(char *command);
-char *EXECUTE_STR(char *command);
-char *VERSION(void);
-
-double CHECK_SERVICE(char *service);
-double CHECK_SERVICE_PERF(char *service);
-
-double CHECK_PORT(char *ip_and_port);
+int getPROC(char *file,int lineno,int fieldno, double *value);
+
+int BUFFERSMEM(const char *cmd, const char *parameter,double *value);
+int CACHEDMEM(const char *cmd, const char *parameter,double *value);
+int CKSUM(const char *cmd, const char *filename,double *value);
+int FILESIZE(const char *cmd, const char *filename,double *value);
+int DISKFREE(const char *cmd, const char *mountPoint,double *value);
+int DISKTOTAL(const char *cmd, const char *mountPoint,double *value);
+int DISKUSED(const char *cmd, const char *mountPoint,double *value);
+
+int DISK_IO(const char *cmd, const char *parameter,double *value);
+int DISK_RIO(const char *cmd, const char *parameter,double *value);
+int DISK_WIO(const char *cmd, const char *parameter,double *value);
+int DISK_RBLK(const char *cmd, const char *parameter,double *value);
+int DISK_WBLK(const char *cmd, const char *parameter,double *value);
+int FREEMEM(const char *cmd, const char *parameter,double *value);
+
+int INODE(const char *cmd, const char *mountPoint,double *value);
+int INODETOTAL(const char *cmd, const char *mountPoint,double *value);
+
+int KERNEL_MAXFILES(const char *cmd, const char *parameter,double *value);
+int KERNEL_MAXPROC(const char *cmd, const char *parameter,double *value);
+int NETLOADIN1(const char *cmd, const char *interface,double *value);
+int NETLOADIN5(const char *cmd, const char *interface,double *value);
+int NETLOADIN15(const char *cmd, const char *interface,double *value);
+int NETLOADOUT1(const char *cmd, const char *interface,double *value);
+int NETLOADOUT5(const char *cmd, const char *interface,double *value);
+int NETLOADOUT15(const char *cmd, const char *interface,double *value);
+int DISKREADOPS1(const char *cmd, const char *interface,double *value);
+int DISKREADOPS5(const char *cmd, const char *interface,double *value);
+int DISKREADOPS15(const char *cmd, const char *interface,double *value);
+int DISKREADBLKS1(const char *cmd, const char *interface,double *value);
+int DISKREADBLKS5(const char *cmd, const char *interface,double *value);
+int DISKREADBLKS15(const char *cmd, const char *interface,double *value);
+int DISKWRITEOPS1(const char *cmd, const char *interface,double *value);
+int DISKWRITEOPS5(const char *cmd, const char *interface,double *value);
+int DISKWRITEOPS15(const char *cmd, const char *interface,double *value);
+int DISKWRITEBLKS1(const char *cmd, const char *interface,double *value);
+int DISKWRITEBLKS5(const char *cmd, const char *interface,double *value);
+int DISKWRITEBLKS15(const char *cmd, const char *interface,double *value);
+int PING(const char *cmd, const char *parameter,double *value);
+int SHAREDMEM(const char *cmd, const char *parameter,double *value);
+int TOTALMEM(const char *cmd, const char *parameter,double *value);
+int PROCCNT(const char *cmd, const char *parameter,double *value);
+int PROCCOUNT(const char *cmd, const char *parameter,double *value);
+int PROCLOAD(const char *cmd, const char *parameter,double *value);
+int PROCLOAD5(const char *cmd, const char *parameter,double *value);
+int PROCLOAD15(const char *cmd, const char *parameter,double *value);
+
+int SENSOR_TEMP1(const char *cmd, const char *parameter,double *value);
+int SENSOR_TEMP2(const char *cmd, const char *parameter,double *value);
+int SENSOR_TEMP3(const char *cmd, const char *parameter,double *value);
+
+int SWAPFREE(const char *cmd, const char *parameter,double *value);
+int SWAPTOTAL(const char *cmd, const char *parameter,double *value);
+int UPTIME(const char *cmd, const char *parameter,double *value);
+
+int TCP_LISTEN(const char *cmd, const char *porthex,double *value);
+
+int EXECUTE(const char *cmd, const char *command,double *value);
+int EXECUTE_STR(const char *cmd, const char *command,char **value);
+int VERSION(const char *cmd, const char *command,char **value);
+
+int MD5SUM(const char *cmd, const char *filename, char **value);
+
+int CHECK_SERVICE(const char *cmd, const char *service,double *value);
+int CHECK_SERVICE_PERF(const char *cmd, const char *service,double *value);
+int CHECK_PORT(const char *cmd, const char *ip_and_port,double *value);
#define COMMAND struct command_type
COMMAND
{
char *key;
- double (*function)();
- char *(*function_str)();
+ int (*function)();
+ int (*function_str)();
char *parameter;
};
diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c
index cfaae601..d8dd4bba 100644
--- a/src/zabbix_agent/zabbix_agentd.c
+++ b/src/zabbix_agent/zabbix_agentd.c
@@ -73,7 +73,7 @@ static char *CONFIG_LOG_FILE = NULL;
static int CONFIG_AGENTD_FORKS = AGENTD_FORKS;
static int CONFIG_NOTIMEWAIT = 0;
static int CONFIG_TIMEOUT = AGENT_TIMEOUT;
-static int CONFIG_LISTEN_PORT = 10000;
+static int CONFIG_LISTEN_PORT = 10050;
static char *CONFIG_LISTEN_IP = NULL;
static int CONFIG_LOG_LEVEL = LOG_LEVEL_WARNING;
diff --git a/src/zabbix_agent_win32/main.cpp b/src/zabbix_agent_win32/main.cpp
index 0e6b5b16..e70a4f7e 100644
--- a/src/zabbix_agent_win32/main.cpp
+++ b/src/zabbix_agent_win32/main.cpp
@@ -34,7 +34,7 @@ HANDLE eventCollectorStarted;
DWORD dwFlags=AF_USE_EVENT_LOG;
char confFile[MAX_PATH]="C:\\zabbix_agentd.conf";
char logFile[MAX_PATH]="{EventLog}";
-WORD confListenPort=10000;
+WORD confListenPort=10050; // Alexei: New defailt port 10000 -> 10050
DWORD confServerAddr[MAX_SERVERS];
DWORD confServerCount=0;
DWORD confTimeout=3000; // 3 seconds default timeout
diff --git a/src/zabbix_sucker/Makefile.in b/src/zabbix_sucker/Makefile.in
index 4b79f15c..980208ef 100644
--- a/src/zabbix_sucker/Makefile.in
+++ b/src/zabbix_sucker/Makefile.in
@@ -5,7 +5,7 @@ LIBS = @LIBS@ @MYSQL_LFLAGS@ @PGSQL_LFLAGS@ @SNMP_LFLAGS@
all:
- @CC@ -o ../../bin/zabbix_suckerd @CFLAGS@ -I../../include $(INCLUDE) zabbix_sucker.c ../../include/db.c ../../include/functions.c ../../include/expression.c ../../include/cfg.c ../../include/log.c ../../include/security.c ../../include/pid.c ../../include/email.c ../../include/snprintf.c ../zabbix_agent/sysinfo.c alerter.c pinger.c housekeeper.c checks_simple.c checks_snmp.c checks_agent.c checks_internal.c -Wall $(LIBS)
+ @CC@ -o ../../bin/zabbix_suckerd @CFLAGS@ -I../../include $(INCLUDE) zabbix_sucker.c ../../include/db.c ../../include/functions.c ../../include/expression.c ../../include/cfg.c ../../include/log.c ../../include/security.c ../../include/pid.c ../../include/email.c ../../include/snprintf.c ../zabbix_agent/sysinfo.c ../../include/md5.c alerter.c pinger.c housekeeper.c checks_simple.c checks_snmp.c checks_agent.c checks_internal.c -Wall $(LIBS)
clean:
rm -f *.o
diff --git a/src/zabbix_sucker/pinger.c b/src/zabbix_sucker/pinger.c
index 34a4d63c..74437fec 100644
--- a/src/zabbix_sucker/pinger.c
+++ b/src/zabbix_sucker/pinger.c
@@ -270,6 +270,8 @@ int do_ping(void)
while(NULL!=fgets(ip,MAX_STRING_LEN,f))
{
+/* zabbix_log( LOG_LEVEL_WARNING, "PING: [%s]", ip);*/
+
ip[strlen(ip)-1]=0;
zabbix_log( LOG_LEVEL_DEBUG, "Update IP [%s]", ip);
diff --git a/src/zabbix_sucker/zabbix_sucker.c b/src/zabbix_sucker/zabbix_sucker.c
index 56308c77..1c7c7437 100644
--- a/src/zabbix_sucker/zabbix_sucker.c
+++ b/src/zabbix_sucker/zabbix_sucker.c
@@ -288,7 +288,7 @@ void init_config(void)
#endif
{"HousekeepingFrequency",&CONFIG_HOUSEKEEPING_FREQUENCY,0,TYPE_INT,PARM_OPT,1,24},
{"SenderFrequency",&CONFIG_SENDER_FREQUENCY,0,TYPE_INT,PARM_OPT,5,3600},
- {"PingerFrequency",&CONFIG_PINGER_FREQUENCY,0,TYPE_INT,PARM_OPT,30,3600},
+ {"PingerFrequency",&CONFIG_PINGER_FREQUENCY,0,TYPE_INT,PARM_OPT,1,3600},
{"FpingLocation",&CONFIG_FPING_LOCATION,0,TYPE_STRING,PARM_OPT,0,0},
{"Timeout",&CONFIG_TIMEOUT,0,TYPE_INT,PARM_OPT,1,30},
{"NoTimeWait",&CONFIG_NOTIMEWAIT,0,TYPE_INT,PARM_OPT,0,1},
diff --git a/src/zabbix_trapper/zabbix_trapperd.c b/src/zabbix_trapper/zabbix_trapperd.c
index e3c8fa18..1d6133e8 100644
--- a/src/zabbix_trapper/zabbix_trapperd.c
+++ b/src/zabbix_trapper/zabbix_trapperd.c
@@ -57,7 +57,7 @@ static pid_t *pids;
int parent=0;
int CONFIG_TRAPPERD_FORKS = TRAPPERD_FORKS;
-int CONFIG_LISTEN_PORT = 10001;
+int CONFIG_LISTEN_PORT = 10051;
int CONFIG_TIMEOUT = TRAPPER_TIMEOUT;
int CONFIG_LOG_LEVEL = LOG_LEVEL_WARNING;
int CONFIG_NOTIMEWAIT = 0;
diff --git a/upgrades/dbpatches/1.0_to_1.1alpha1/mysql/patch.sql b/upgrades/dbpatches/1.0_to_1.1alpha1/mysql/patch.sql
index 2b1f2b2e..2fb18bd3 100644
--- a/upgrades/dbpatches/1.0_to_1.1alpha1/mysql/patch.sql
+++ b/upgrades/dbpatches/1.0_to_1.1alpha1/mysql/patch.sql
@@ -34,6 +34,22 @@ update items set formula="1073741824" where multiplier=3;
update items set multiplier=1 where multiplier!=0;
+--
+-- Table structure for table 'audit'
+--
+
+CREATE TABLE audit (
+ auditid int(4) NOT NULL auto_increment,
+ userid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ action int(4) DEFAULT '0' NOT NULL,
+ resource int(4) DEFAULT '0' NOT NULL,
+ details varchar(128) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (auditid),
+ UNIQUE (userid,clock),
+ KEY (clock)
+) type=InnoDB;
+
insert into images values(1,1,"Hub",load_file("../data/images/Hub.png"));
insert into images values(2,1,"Hub (small)",load_file("../data/images/Hub_small.png"));
insert into images values(3,1,"Network",load_file("../data/images/Network.png"));
diff --git a/upgrades/dbpatches/1.0_to_1.1alpha1/postgresql/patch.sql b/upgrades/dbpatches/1.0_to_1.1alpha1/postgresql/patch.sql
index 27499494..9b7a35e2 100644
--- a/upgrades/dbpatches/1.0_to_1.1alpha1/postgresql/patch.sql
+++ b/upgrades/dbpatches/1.0_to_1.1alpha1/postgresql/patch.sql
@@ -38,6 +38,23 @@ update items set formula="1073741824" where multiplier=3;
update items set multiplier=1 where multiplier!=0;
+--
+-- Table structure for table 'audit'
+--
+
+CREATE TABLE audit (
+ auditid serial,
+ userid int4 DEFAULT '0' NOT NULL,
+ clock int4 DEFAULT '0' NOT NULL,
+ action int4 DEFAULT '0' NOT NULL,
+ resource int4 DEFAULT '0' NOT NULL,
+ details varchar(128) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (auditid)
+);
+
+CREATE UNIQUE INDEX audit_userid_clock on audit (userid,clock);
+CREATE INDEX audit_clock on audit (clock);
+
insert into images values(1,1,"Hub",load_file("../data/images/Hub.png"));
insert into images values(2,1,"Hub (small)",load_file("../data/images/Hub_small.png"));
insert into images values(3,1,"Network",load_file("../data/images/Network.png"));