PDA

View Full Version : CVS Patch incorporating Various Fixes


James Wells
27-08-2005, 05:45
Greetings,

Below is a patch I have compiled from the forums here and a few minor changes to correct the mis-labeled Zabbix version displays.

Thanx to LinuxDR, Karkinjub Marakint, and Simon Matter for making my life a whole lot easier at work lately. ;)

Index: zabbix/frontends/php/include/config.inc.php
================================================== =================
RCS file: /cvsroot/zabbix/zabbix/frontends/php/include/config.inc.php,v
retrieving revision 1.261
diff -r1.261 config.inc.php
1599a1600
> $host_template=get_host_by_hostid($host_templateid );
1645a1647
> $message=str_replace("{".$host_template["host"].":", "{".$host["host"].":", $message);
Index: zabbix/frontends/php/include/triggers.inc.php
================================================== =================
RCS file: /cvsroot/zabbix/zabbix/frontends/php/include/triggers.inc.php,v
retrieving revision 1.9
diff -r1.9 triggers.inc.php
340c340
< $expression_old=$trigger["expression"];
---
> //$expression_old=$trigger["expression"];
359c359
< $sql="insert into triggers (description,priority,status,comments,url,value,ex pression) values ('".addslashes($trigger["description"])."',".$trigger["priority"].",".$trigger["status"].",'".addslashes($trigger["comments"])."','".addslashes($trigger["url"])."',2,'$expression_old')";
---
> $sql="insert into triggers (description,priority,status,comments,url,value,ex pression) values ('".addslashes($trigger["description"])."',".$trigger["priority"].",".$trigger["status"].",'".addslashes($trigger["comments"])."','".addslashes($trigger["url"])."',2,'".$trigger["expression"]."')";
365a366,367
>
> $time_temp=1;
386c388
< $sql="update triggers set expression='$expression_old' where triggerid=$triggerid_new";
---
> $sql="update triggers set expression='".$trigger["expression"]."' where triggerid=$triggerid_new";
388,389c390,394
< $expression=str_replace("{".$row2["functionid"]."}","{".$functionid."}",$expression_old);
< $expression_old=$expression;
---
> if( $time_temp == 1 )
> $expression=str_replace("{".$row2["functionid"]."}","{".$functionid."}",$trigger["expression"]);
> else
> $expression=str_replace("{".$row2["functionid"]."}","{".$functionid."}",$expression);
> //$expression_old=$expression;
394a400
> $time_temp++;
Index: zabbix/frontends/php/include/locales/en_gb.inc.php
================================================== =================
RCS file: /cvsroot/zabbix/zabbix/frontends/php/include/locales/en_gb.inc.php,v
retrieving revision 1.9
diff -r1.9 en_gb.inc.php
32c32
< "S_INFORMATION_ABOUT_ZABBIX"=> "Information about ZABBIX (v1.1alpha11)",
---
> "S_INFORMATION_ABOUT_ZABBIX"=> "Information about ZABBIX (v1.1alpha12)",
218c218
< "S_ZABBIX_VER"=> "ZABBIX 1.1alpha11",
---
> "S_ZABBIX_VER"=> "ZABBIX 1.1alpha12",
Index: zabbix/frontends/php/include/locales/fr_fr.inc.php
================================================== =================
RCS file: /cvsroot/zabbix/zabbix/frontends/php/include/locales/fr_fr.inc.php,v
retrieving revision 1.1
diff -r1.1 fr_fr.inc.php
32c32
< "S_INFORMATION_ABOUT_ZABBIX"=> "Informations à propos de ZABBIX (v1.1alpha11)",
---
> "S_INFORMATION_ABOUT_ZABBIX"=> "Informations à propos de ZABBIX (v1.1alpha12)",
218c218
< "S_ZABBIX_VER"=> "ZABBIX 1.1alpha13",
---
> "S_ZABBIX_VER"=> "ZABBIX 1.1alpha12",
Index: zabbix/frontends/php/include/locales/it_it.inc.php
================================================== =================
RCS file: /cvsroot/zabbix/zabbix/frontends/php/include/locales/it_it.inc.php,v
retrieving revision 1.1
diff -r1.1 it_it.inc.php
34c34
< "S_INFORMATION_ABOUT_ZABBIX"=> "Informazioni su ZABBIX (v1.1alpha11)",
---
> "S_INFORMATION_ABOUT_ZABBIX"=> "Informazioni su ZABBIX (v1.1alpha12)",
220c220
< "S_ZABBIX_VER"=> "ZABBIX 1.1alpha11",
---
> "S_ZABBIX_VER"=> "ZABBIX 1.1alpha12",
Index: zabbix/frontends/php/include/locales/lv_lv.inc.php
================================================== =================
RCS file: /cvsroot/zabbix/zabbix/frontends/php/include/locales/lv_lv.inc.php,v
retrieving revision 1.1
diff -r1.1 lv_lv.inc.php
32c32
< "S_INFORMATION_ABOUT_ZABBIX"=> "Information about ZABBIX (v1.1alpha11)",
---
> "S_INFORMATION_ABOUT_ZABBIX"=> "Information about ZABBIX (v1.1alpha12)",
218c218
< "S_ZABBIX_VER"=> "ZABBIX 1.1alpha11",
---
> "S_ZABBIX_VER"=> "ZABBIX 1.1alpha12",
Index: zabbix/frontends/php/include/locales/ru_ru.inc.php
================================================== =================
RCS file: /cvsroot/zabbix/zabbix/frontends/php/include/locales/ru_ru.inc.php,v
retrieving revision 1.1
diff -r1.1 ru_ru.inc.php
32c32
< "S_INFORMATION_ABOUT_ZABBIX"=> "Information about ZABBIX (v1.1alpha11)",
---
> "S_INFORMATION_ABOUT_ZABBIX"=> "Information about ZABBIX (v1.1alpha12)",
218c218
< "S_ZABBIX_VER"=> "ZABBIX 1.1alpha11",
---
> "S_ZABBIX_VER"=> "ZABBIX 1.1alpha12",
Index: zabbix/frontends/php/include/locales/sp_sp.inc.php
================================================== =================
RCS file: /cvsroot/zabbix/zabbix/frontends/php/include/locales/sp_sp.inc.php,v
retrieving revision 1.1
diff -r1.1 sp_sp.inc.php
32c32
< "S_INFORMATION_ABOUT_ZABBIX"=> "Información acerca de ZABBIX (v1.1alpha11)",
---
> "S_INFORMATION_ABOUT_ZABBIX"=> "Información acerca de ZABBIX (v1.1alpha12)",
218c218
< "S_ZABBIX_VER"=> "ZABBIX 1.1alpha11",
---
> "S_ZABBIX_VER"=> "ZABBIX 1.1alpha12",
Index: zabbix/include/security.c
================================================== =================
RCS file: /cvsroot/zabbix/zabbix/include/security.c,v
retrieving revision 1.8
diff -r1.8 security.c
55d54
< char *sname;
58c57,58
< char *s;
---
> char *sip, *s;
> struct hostent *hp
60c60
< char tmp[MAX_STRING_LEN];
---
> char tmp[MAX_STRING_LEN], sname[MAX_STRING_LEN];
76c76
< sname=inet_ntoa(name.sin_addr);
---
> strcpy(sname,inet_ntoa(name.sin_addr);
84c84,85
< if(strcmp(sname, s)==0)
---
> /* Allow IP addresses or DNS names for authorization */
> if((hp = gethostbyname(s)) == 0)
86c87,95
< return SUCCEED;
---
> zabbix_log( LOG_LEVEL_WARNING, "Error gethostbyname, can not resolve [%s]",s);
> }
> else
> {
> sip=inet_ntoa(*((struct in_addr *)hp->h_addr));
> if(strcmp(sname, sip)==0)
> {
> return SUCCEED;
> }

Alexei
27-08-2005, 08:25
Please, give me an idea what the patch is about? I'm especially interested in changes of function check_security() . Why? The rest seems to be quite straight forward.

James Wells
27-08-2005, 17:55
DOH!!! I knew I had forgotton something when I posted it.

I'm especially interested in changes of function check_security() . Why?
The change to check_security allows you to use either hostname, either short or FQDN, or IP address for the Server entry in the zabbix_agentd.conf file. This was based on a patch submitted by Simon Matter.

The changes to the locales files are simply putting them all on 1.1alpha12, as some of them were listing 1.1alpha11 and one was listed as 1.1alpha13.

Additionally, included in this is a change to create linked triggers correctly. This change was posted several weeks ago by LinuxDR in response to gyratedotorg's testing of the creation of linked triggers. With this chnge, if you create a trigger on a template, all of the children will get a trigger added to them specific to their own items.

Finally, I included Karkinjub Marakint's patch, which creates linked actions correctly. With this change, if you create an action on a template, the contents of the message, gets pushed to the children using items specific to themselves.