summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2003-07-20 18:15:21 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2003-07-20 18:15:21 +0000
commitedb44e0293222987bcbaf6409c021c767c6faeec (patch)
treebaee5dd84d6b408971e24c1ba72e6ec6bb2411bb /src
parent960f15d24df774d5853ad8e8cbcaf81f0c61d56d (diff)
downloadzabbix-edb44e0293222987bcbaf6409c021c767c6faeec.tar.gz
zabbix-edb44e0293222987bcbaf6409c021c767c6faeec.tar.xz
zabbix-edb44e0293222987bcbaf6409c021c767c6faeec.zip
- support for changing of graph items (Alexei)
- menu will not require more than three lines (Alexei) - fixed dividion by zero in chart2.php (Alexei) - period and start of interval are preserved in full-screen mode (Alexei) - added units in graph legends (Alexei) - table-like legend for user graphs (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@853 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/zabbix_sucker/pinger.c10
-rw-r--r--src/zabbix_sucker/zabbix_sucker.c25
2 files changed, 24 insertions, 11 deletions
diff --git a/src/zabbix_sucker/pinger.c b/src/zabbix_sucker/pinger.c
index a8a23ffb..d780992b 100644
--- a/src/zabbix_sucker/pinger.c
+++ b/src/zabbix_sucker/pinger.c
@@ -118,9 +118,13 @@ int do_ping(void)
int update_items(void)
{
+ int ret = SUCCEED;
char sql[MAX_STRING_LEN+1];
int i,now;
+ DB_HOST host;
+ DB_RESULT *result;
+
now=time(NULL);
sprintf(sql,"select h.useip,h.ip,h.host from hosts h where (h.status=%d or (h.status=%d and h.disable_until<=%d))", HOST_STATUS_MONITORED, HOST_STATUS_UNREACHABLE, now);
result = DBselect(sql);
@@ -131,16 +135,18 @@ int update_items(void)
host.ip=DBget_field(result,i,1);
host.host=DBget_field(result,i,2);
- if(HOST_USE_IP == host.useip)
+/* if(HOST_USE_IP == host.useip)
{
fprintf(f,"%s\n",host.ip);
}
else
{
fprintf(f,"%s\n",host.host);
- }
+ }*/
}
DBfree_result(result);
+
+ return ret;
}
int main_pinger_loop(void)
diff --git a/src/zabbix_sucker/zabbix_sucker.c b/src/zabbix_sucker/zabbix_sucker.c
index ddd9ac32..915b61a6 100644
--- a/src/zabbix_sucker/zabbix_sucker.c
+++ b/src/zabbix_sucker/zabbix_sucker.c
@@ -155,12 +155,6 @@ void daemon_init(void)
exit(FAIL);
}
- if( (setgid(pwd->pw_gid) ==-1) || (setuid(pwd->pw_uid) == -1) )
- {
- fprintf(stderr,"Cannot setgid or setuid to zabbix");
- exit(FAIL);
- }
-
#ifdef HAVE_FUNCTION_SETEUID
if( (setegid(pwd->pw_gid) ==-1) || (seteuid(pwd->pw_uid) == -1) )
{
@@ -169,6 +163,13 @@ void daemon_init(void)
}
#endif
+ if( (setgid(pwd->pw_gid) ==-1) || (setuid(pwd->pw_uid) == -1) )
+ {
+ fprintf(stderr,"Cannot setgid or setuid to zabbix");
+ exit(FAIL);
+ }
+
+
}
if( (pid = fork()) != 0 )
@@ -437,7 +438,7 @@ int get_value_SIMPLE(double *result,char *result_str,DB_ITEM *item)
{
strncpy(s,item->key,MAX_STRING_LEN);
t=strstr(item->key,"_perf");
- s[t]=0;
+ t[0]=0;
if(item->useip==1)
{
@@ -1266,7 +1267,7 @@ int main(int argc, char **argv)
}
}
- zabbix_log( LOG_LEVEL_WARNING, "zabbix_suckerd #%d started",sucker_num);
+/* zabbix_log( LOG_LEVEL_WARNING, "zabbix_suckerd #%d started",sucker_num);*/
#ifdef HAVE_SNMP
init_snmp("zabbix_suckerd");
@@ -1275,25 +1276,31 @@ int main(int argc, char **argv)
if( sucker_num == 0)
{
/* First instance of zabbix_suckerd performs housekeeping procedures */
+ zabbix_log( LOG_LEVEL_WARNING, "zabbix_suckerd #%d started. Housekeeper.",sucker_num);
main_housekeeping_loop();
}
else if(sucker_num == 1)
{
/* Second instance of zabbix_suckerd sends alerts to users */
+ zabbix_log( LOG_LEVEL_WARNING, "zabbix_suckerd #%d started. Alerter.",sucker_num);
main_alerter_loop();
}
else if(sucker_num == 2)
{
/* Third instance of zabbix_suckerd periodically re-calculates 'nodata' functions */
+ zabbix_log( LOG_LEVEL_WARNING, "zabbix_suckerd #%d started. nodata() calculator.",sucker_num);
main_nodata_loop();
}
else if(sucker_num == 3)
{
/* Fourth instance of zabbix_suckerd periodically pings hosts */
- main_pinger_loop();
+ zabbix_log( LOG_LEVEL_WARNING, "zabbix_suckerd #%d started. ICMP pinger.",sucker_num);
+ for(;;) sleep(3600);
+/* main_pinger_loop();*/
}
else
{
+ zabbix_log( LOG_LEVEL_WARNING, "zabbix_suckerd #%d started. Sucker.",sucker_num);
main_sucker_loop();
}