summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2001-08-11 10:22:11 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2001-08-11 10:22:11 +0000
commitb19b5e7b00b34e439b7f6934603ef3feb8a94a8f (patch)
tree3053cc068566140604428647771f3f4ea4b40d28
parentbcad0d8ff2049311f84d6727190601999d63d4bd (diff)
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@161 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog4
-rw-r--r--Makefile.in7
-rw-r--r--configure.in12
-rw-r--r--create/data/data.sql10
-rw-r--r--create/mysql/schema.sql4
-rw-r--r--create/postgresql/schema.sql4
-rw-r--r--doc/manual.txt7
-rw-r--r--frontends/php/actions.html23
-rw-r--r--frontends/php/alerts.html2
-rw-r--r--frontends/php/chart2.html4
-rw-r--r--frontends/php/include/config.inc2
-rw-r--r--frontends/php/latestalarms.html2
-rw-r--r--frontends/php/trend.html2
-rw-r--r--frontends/php/triggers.html2
-rw-r--r--src/zabbix_agent/sysinfo.c36
-rw-r--r--src/zabbix_agent/sysinfo.h5
-rw-r--r--src/zabbix_agent/zabbix_agentd.c37
-rw-r--r--src/zabbix_sucker/zabbix_sucker.c2
-rw-r--r--upgrades/dbpatches/1.0alpha7_to_1.0alpha8/mysql/patch.sql3
19 files changed, 125 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index 24029a63..43fd4149 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,10 @@
Changes for 1.0alpha8:
+ - changed type of actions.message and alerts.message to blob(text)
+ - added new parameters: io[disk_*]
+
- zabbix_sucker renamed to zabbix_suckerd
- new high performance zabbix_agentd
-
- connect using IP address became possible
- new columns - useip,ip were added to table hosts
- added bin/
diff --git a/Makefile.in b/Makefile.in
index e1e404fa..8d1cdbeb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -61,7 +61,12 @@ CC = @CC@
PACKAGE = @PACKAGE@
VERSION = @VERSION@
-SUBDIRS = src/zabbix_agent src/zabbix_sender src/zabbix_sucker src/zabbix_trapper
+HAVE_MYSQL = @HAVE_MYSQL@
+HAVE_PGSQL = @HAVE_PGSQL@
+
+SUBDIRS = @SUBDIRS@
+#SUBDIRS = src/zabbix_agent src/zabbix_sender src/zabbix_sucker src/zabbix_trapper
+
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ./src/config.h ./src/config.h
CONFIG_CLEAN_FILES =
diff --git a/configure.in b/configure.in
index 17fffdd7..5e1b4641 100644
--- a/configure.in
+++ b/configure.in
@@ -133,13 +133,19 @@ AC_SUBST(PGSQL_LFLAGS)
AC_SUBST(PGSQL_INCLUDE)
if test "$have_db" != "yes"; then
- { echo "configure: error: No database selected! Use --with-XXX where XXX is your preferred database type" 1>&2; exit 1; }
-echo
+ echo "configure: No database selected! Use --with-XXX where XXX is your preferred database type";
+ echo "configure: Server processer (zabbix_suckerd and zabbix_trpper) will not be created !";
+
+ SUBDIRS="src/zabbix_agent src/zabbix_sender"
+else
+ SUBDIRS="src/zabbix_agent src/zabbix_sender src/zabbix_sucker src/zabbix_trapper"
fi
+AC_SUBST(SUBDIRS)
+
AC_CONFIG_HEADER(include/config.h)
AC_OUTPUT(Makefile src/zabbix_sender/Makefile src/zabbix_agent/Makefile \
- src/zabbix_sucker/Makefile src/zabbix_trapper/Makefile)
+ src/zabbix_sucker/Makefile src/zabbix_trapper/Makefile)
echo
echo "***********************************************************"
diff --git a/create/data/data.sql b/create/data/data.sql
index 4d09c223..6f9e5725 100644
--- a/create/data/data.sql
+++ b/create/data/data.sql
@@ -115,6 +115,16 @@ insert into items_template (itemtemplateid,description,key_,delay)
values (47,'Checksum of /usr/bin/ssh','cksum[/usr/bin/ssh]', 600);
insert into items_template (itemtemplateid,description,key_,delay)
values (48,'Checksum of /etc/services','cksum[/etc/services]', 600);
+insert into items_template (itemtemplateid,description,key_,delay)
+ values (49,'Number of disks read/write operations','io[disk_io]', 30);
+insert into items_template (itemtemplateid,description,key_,delay)
+ values (50,'Number of disks read operations','io[disk_rio]', 30);
+insert into items_template (itemtemplateid,description,key_,delay)
+ values (51,'Number of disks write operations','io[disk_wio]', 30);
+insert into items_template (itemtemplateid,description,key_,delay)
+ values (52,'Number of block read from disks','io[disk_rblk]', 30);
+insert into items_template (itemtemplateid,description,key_,delay)
+ values (53,'Number of block written to disks','io[disk_wblk]', 30);
--
-- Data for table triggers_template
diff --git a/create/mysql/schema.sql b/create/mysql/schema.sql
index 017cf659..4ee6586b 100644
--- a/create/mysql/schema.sql
+++ b/create/mysql/schema.sql
@@ -98,7 +98,7 @@ CREATE TABLE alerts (
type varchar(10) DEFAULT '' NOT NULL,
sendto varchar(100) DEFAULT '' NOT NULL,
subject varchar(255) DEFAULT '' NOT NULL,
- message varchar(255) DEFAULT '' NOT NULL,
+ message blob DEFAULT '' NOT NULL,
PRIMARY KEY (alertid),
INDEX (actionid),
KEY clock (clock)
@@ -115,7 +115,7 @@ CREATE TABLE actions (
good int(4) DEFAULT '0' NOT NULL,
delay int(4) DEFAULT '0' NOT NULL,
subject varchar(255) DEFAULT '' NOT NULL,
- message varchar(255) DEFAULT '' NOT NULL,
+ message blob DEFAULT '' NOT NULL,
nextcheck int(4) DEFAULT '0' NOT NULL,
PRIMARY KEY (actionid),
KEY (triggerid)
diff --git a/create/postgresql/schema.sql b/create/postgresql/schema.sql
index 46f4bf50..651d734b 100644
--- a/create/postgresql/schema.sql
+++ b/create/postgresql/schema.sql
@@ -112,7 +112,7 @@ CREATE TABLE actions (
good int4 DEFAULT '0' NOT NULL,
delay int4 DEFAULT '0' NOT NULL,
subject varchar(255) DEFAULT '' NOT NULL,
- message varchar(255) DEFAULT '' NOT NULL,
+ message text DEFAULT '' NOT NULL,
nextcheck int4 DEFAULT '0' NOT NULL,
PRIMARY KEY (actionid),
FOREIGN KEY (triggerid) REFERENCES triggers,
@@ -130,7 +130,7 @@ CREATE TABLE alerts (
type varchar(10) DEFAULT '' NOT NULL,
sendto varchar(100) DEFAULT '' NOT NULL,
subject varchar(255) DEFAULT '' NOT NULL,
- message varchar(255) DEFAULT '' NOT NULL,
+ message text DEFAULT '' NOT NULL,
PRIMARY KEY (alertid),
FOREIGN KEY (actionid) REFERENCES actions
);
diff --git a/doc/manual.txt b/doc/manual.txt
index 2f85f3dd..5035fc01 100644
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -408,6 +408,11 @@ Change the following parameters:
./configure --with-pgsql # for PostgreSQL
make
+If you want to compile client binaries only, run:
+
+./configure
+make
+
4.2.6 Copy created binaries from bin/ to /opt/zabbix/bin or any other directory.
4.2.7 Configure /etc/services
@@ -423,7 +428,7 @@ Add the following line to /etc/inetd.conf:
zabbix_trap stream tcp nowait.3600 zabbix /opt/zabbix/bin/zabbix_trapper
-If you plan to use zabbix_agent (zabbix_agentd does not require this!), the following line must be added as well:
+If you plan to use zabbix_agent (zabbix_agentd does not require this!), the following line must be added:
zabbix_agent stream tcp nowait.3600 zabbix /opt/zabbix/bin/zabbix_agent
diff --git a/frontends/php/actions.html b/frontends/php/actions.html
index a3888967..138bc4d9 100644
--- a/frontends/php/actions.html
+++ b/frontends/php/actions.html
@@ -124,10 +124,27 @@
}
else
{
+ $sql="select description from triggers where triggerid=$triggerid";
+ $result=DBselect($sql);
+ $description=DBget_field($result,0,0);
+
$good=1;
$delay=30;
$subject=$description;
- $message="";
+
+ $sql="select i.description, h.host, i.key_ from hosts h, items i,functions f where f.triggerid=$triggerid and h.hostid=i.hostid and f.itemid=i.itemid order by i.description";
+ $result=DBselect($sql);
+ $message="<INSERT YOUR MESSAGE HERE>\n\n------Latest data------\n\n";
+ for($i=0;$i<DBnum_rows($result);$i++)
+ {
+ $description=DBget_field($result,$i,0);
+ $host=DBget_field($result,$i,1);
+ $key=DBget_field($result,$i,2);
+ $message=$message."$description: \{$host:$key.last(0)} (latest value)\n";
+ $message=$message."$description: \{$host:$key.max(300)} (maxumum value for latest 5 min)\n";
+ $message=$message."$description: \{$host:$key.min(300)} (minimum value for last 5 min)\n\n";
+ }
+ $message=$message."---------End--------\n";
}
echo "<br>";
show_table2_header_begin();
@@ -177,12 +194,12 @@
show_table2_v_delimiter();
echo "Subject";
show_table2_h_delimiter();
- echo "<input name=\"subject\" value=\"$subject\" size=50>";
+ echo "<input name=\"subject\" value=\"$subject\" size=70>";
show_table2_v_delimiter();
echo "Message";
show_table2_h_delimiter();
- echo "<textarea name=\"message\" cols=50 ROWS=\"5\" wrap=\"soft\">$message</TEXTAREA>";
+ echo "<textarea name=\"message\" cols=70 ROWS=\"7\" wrap=\"soft\">$message</TEXTAREA>";
show_table2_v_delimiter2();
echo "<input type=\"submit\" name=\"register\" value=\"add\">";
diff --git a/frontends/php/alerts.html b/frontends/php/alerts.html
index d01a885b..08e61fa9 100644
--- a/frontends/php/alerts.html
+++ b/frontends/php/alerts.html
@@ -2,7 +2,7 @@
include "include/config.inc";
$page["title"] = "Alerts";
$page["file"] = "alerts.html";
- show_header($page["title"],0,0);
+ show_header($page["title"],30,0);
?>
<?
diff --git a/frontends/php/chart2.html b/frontends/php/chart2.html
index b906d2f6..0796fcf1 100644
--- a/frontends/php/chart2.html
+++ b/frontends/php/chart2.html
@@ -142,8 +142,8 @@
{
ImageLine($im,$shiftX,$shiftYup+$sizeY/2,$sizeX+$shiftX,$shiftYup+$sizeY/2,$colors[$color[$item]]);
}
- ImageFilledRectangle($im,$shiftX+150*$item,$sizeY+$shiftYup+19,$shiftX+150*$item+5,$sizeY+$shiftYup+15+9,$colors[$color[$item]]);
- ImageString($im, 2,$shiftX+150*$item+9,$sizeY+$shiftYup+15, $desc[$item], $gray);
+ ImageFilledRectangle($im,$shiftX+200*$item,$sizeY+$shiftYup+19,$shiftX+200*$item+5,$sizeY+$shiftYup+15+9,$colors[$color[$item]]);
+ ImageString($im, 2,$shiftX+200*$item+9,$sizeY+$shiftYup+15, $desc[$item], $gray);
}
if($nodata == 0)
diff --git a/frontends/php/include/config.inc b/frontends/php/include/config.inc
index f913238c..20e97988 100644
--- a/frontends/php/include/config.inc
+++ b/frontends/php/include/config.inc
@@ -1766,7 +1766,7 @@
show_table2_v_delimiter();
echo "Comments";
show_table2_h_delimiter();
- echo "<TEXTAREA NAME=\"comments\" COLS=54 ROWS=\"5\" WRAP=\"SOFT\">$comments</TEXTAREA>";
+ echo "<TEXTAREA NAME=\"comments\" COLS=70 ROWS=\"7\" WRAP=\"SOFT\">$comments</TEXTAREA>";
show_table2_v_delimiter();
echo "Disabled";
diff --git a/frontends/php/latestalarms.html b/frontends/php/latestalarms.html
index 741a914e..d6473ece 100644
--- a/frontends/php/latestalarms.html
+++ b/frontends/php/latestalarms.html
@@ -3,7 +3,7 @@
$page["file"] = "latestalarms.html";
include "include/config.inc";
- show_header($page["title"],10,0);
+ show_header($page["title"],30,0);
?>
<?
diff --git a/frontends/php/trend.html b/frontends/php/trend.html
index 81fa4f3d..3c9d259c 100644
--- a/frontends/php/trend.html
+++ b/frontends/php/trend.html
@@ -119,7 +119,7 @@
$y2=$sizeY-$y2;
ImageLine($im,$x1+$shiftX,$y1+$shiftY,$x2+$shiftX,$y2+$shiftY,$red);
-
+
$x1=$sizeX*($i-$minX)/($maxX-$minX);
$y1=$sizeY*($avg[$i]-$minY)/($maxY-$minY);
$x2=$x1;
diff --git a/frontends/php/triggers.html b/frontends/php/triggers.html
index 1f03b286..08bf94ca 100644
--- a/frontends/php/triggers.html
+++ b/frontends/php/triggers.html
@@ -160,7 +160,7 @@
if(DBget_field($result,0,0)>0)
{
echo "<a name=\"form\"></a>";
- insert_trigger_form($hostid,$triggerid);
+ @insert_trigger_form($hostid,$triggerid);
}
?>
diff --git a/src/zabbix_agent/sysinfo.c b/src/zabbix_agent/sysinfo.c
index c58805e9..59edf757 100644
--- a/src/zabbix_agent/sysinfo.c
+++ b/src/zabbix_agent/sysinfo.c
@@ -71,13 +71,16 @@ COMMAND commands[]=
{"swap[in]" ,EXECUTE, "vmstat -n 1 2|tail -1|cut -b37-40"},
{"swap[out]" ,EXECUTE, "vmstat -n 1 2|tail -1|cut -b41-44"},
- {"io[in]" ,EXECUTE, "vmstat -n 1 2|tail -1|cut -b45-50"},
- {"io[out]" ,EXECUTE, "vmstat -n 1 2|tail -1|cut -b51-56"},
-
{"system[interrupts]" ,EXECUTE, "vmstat -n 1 2|tail -1|cut -b57-61"},
{"system[switches]" ,EXECUTE, "vmstat -n 1 2|tail -1|cut -b62-67"},
***************************************/
+ {"io[disk_io]" ,DISK_IO, 0},
+ {"io[disk_rio]" ,DISK_RIO, 0},
+ {"io[disk_wio]" ,DISK_WIO, 0},
+ {"io[disk_rblk]" ,DISK_RBLK, 0},
+ {"io[disk_wblk]" ,DISK_WBLK, 0},
+
{"system[procload]" ,PROCLOAD, 0},
{"system[procload5]" ,PROCLOAD5, 0},
{"system[procload15]" ,PROCLOAD15, 0},
@@ -89,8 +92,6 @@ COMMAND commands[]=
{"ping" ,PING, 0},
{"tcp_count" ,EXECUTE, "netstat -tn|grep EST|wc -l"},
-/* {"net[listen_21]" ,EXECUTE, "netstat -lnt|grep -v grep|grep ':21 '|wc -l"}, */
-/* {"net[listen_21]" ,EXECUTE, "cat /proc/net/tcp|grep '0015 00000000:0000 0A'|wc -l"}, */
{"net[listen_21]" ,TCP_LISTEN, "0015"},
{"net[listen_22]" ,TCP_LISTEN, "0016"},
{"net[listen_23]" ,TCP_LISTEN, "0017"},
@@ -486,6 +487,31 @@ float SWAPTOTAL(void)
return getPROC("/proc/meminfo",9,2);
}
+float DISK_IO(void)
+{
+ return getPROC("/proc/stat",2,2);
+}
+
+float DISK_RIO(void)
+{
+ return getPROC("/proc/stat",3,2);
+}
+
+float DISK_WIO(void)
+{
+ return getPROC("/proc/stat",4,2);
+}
+
+float DISK_RBLK(void)
+{
+ return getPROC("/proc/stat",5,2);
+}
+
+float DISK_WBLK(void)
+{
+ return getPROC("/proc/stat",6,2);
+}
+
float EXECUTE(char *command)
{
FILE *f;
diff --git a/src/zabbix_agent/sysinfo.h b/src/zabbix_agent/sysinfo.h
index 906e3e16..11da0967 100644
--- a/src/zabbix_agent/sysinfo.h
+++ b/src/zabbix_agent/sysinfo.h
@@ -12,6 +12,11 @@ float TOTALMEM(void);
float SHAREDMEM(void);
float BUFFERSMEM(void);
float CACHEDMEM(void);
+float DISK_IO(void);
+float DISK_RIO(void);
+float DISK_WIO(void);
+float DISK_RBLK(void);
+float DISK_WBLK(void);
float PING(void);
float PROCCOUNT(void);
float PROCLOAD(void);
diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c
index 61ba4498..6bd97e56 100644
--- a/src/zabbix_agent/zabbix_agentd.c
+++ b/src/zabbix_agent/zabbix_agentd.c
@@ -30,6 +30,8 @@
static pid_t *pids;
+char host_allowed[16];
+
void signal_handler( int sig )
{
if( SIGALRM == sig )
@@ -73,31 +75,34 @@ void daemon_init(void)
}
}
+void init_security(void)
+{
+ int file;
+ int i;
+
+ file=open("/etc/zabbix/zabbix_agent.conf",O_RDONLY);
+ if(file == -1)
+ {
+ syslog( LOG_CRIT, "Cannot open /etc/zabbix/zabbix_agent.conf");
+ exit(1);
+ }
+ i=read(file, host_allowed, 16);
+ host_allowed[i-1]=0;
+ close(file);
+}
int check_security(int sockfd)
{
char *sname;
- char config[16];
struct sockaddr_in name;
int i;
- int file;
if(getpeername(sockfd, (struct sockaddr *)&name, (size_t *)&i) == 0)
{
- file=open("/etc/zabbix/zabbix_agent.conf",O_RDONLY);
- if(file == -1)
- {
- syslog( LOG_CRIT, "Cannot open /etc/zabbix/zabbix_agent.conf");
- exit(1);
- }
- i=read(file, config, 16);
- config[i-1]=0;
- close(file);
-
i=sizeof(struct sockaddr_in);
sname=inet_ntoa(name.sin_addr);
- if(strcmp(sname,config)!=0)
+ if(strcmp(sname, host_allowed)!=0)
{
syslog( LOG_WARNING, "Connection from [%s] rejected",sname);
return FAIL;
@@ -112,7 +117,6 @@ void process_child(int sockfd)
char line[1024];
char result[1024];
double res;
- void *sigfunc;
for(;;)
{
@@ -244,10 +248,7 @@ int main()
signal( SIGTERM, signal_handler );
signal( SIGALRM, signal_handler );
-// if(check_security() == FAIL)
-// {
-// exit(FAIL);
-// }
+ init_security();
openlog("zabbix_agentd",LOG_PID,LOG_USER);
// ret=setlogmask(LOG_UPTO(LOG_DEBUG));
diff --git a/src/zabbix_sucker/zabbix_sucker.c b/src/zabbix_sucker/zabbix_sucker.c
index 9f0fde7c..6bf70297 100644
--- a/src/zabbix_sucker/zabbix_sucker.c
+++ b/src/zabbix_sucker/zabbix_sucker.c
@@ -506,6 +506,8 @@ int main(int argc, char **argv)
{
if(fork() == 0)
{
+ /* Do not start all processes at once */
+ sleep(1);
sucker_num=i;
break;
}
diff --git a/upgrades/dbpatches/1.0alpha7_to_1.0alpha8/mysql/patch.sql b/upgrades/dbpatches/1.0alpha7_to_1.0alpha8/mysql/patch.sql
index fc562faa..3276af68 100644
--- a/upgrades/dbpatches/1.0alpha7_to_1.0alpha8/mysql/patch.sql
+++ b/upgrades/dbpatches/1.0alpha7_to_1.0alpha8/mysql/patch.sql
@@ -5,3 +5,6 @@ alter table users modify passwd char(32) default '' not null;
alter table hosts add useip int1 DEFAULT '0' NOT NULL;
alter table hosts add ip varchar(15) DEFAULT '127.0.0.1' NOT NULL;
+
+alter table actions modify message blob default '' not null;
+alter table alerts modify message blob default '' not null;