summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-08-13 19:24:14 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-08-13 19:24:14 +0000
commitb8ddda3dc6813936b03d5bc1e079235d1dec4275 (patch)
tree305ff034ff36fa34feb1e00bd5cfe7280ec45aa5 /frontends/php/include
parent1895e223bb78a2d309cf3a02b356542a8a72c7f5 (diff)
downloadzabbix-b8ddda3dc6813936b03d5bc1e079235d1dec4275.tar.gz
zabbix-b8ddda3dc6813936b03d5bc1e079235d1dec4275.tar.xz
zabbix-b8ddda3dc6813936b03d5bc1e079235d1dec4275.zip
- support for new trigger function: str() (Alexei)
- changed type of functions.parameter to varchar(255) (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@454 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/config.inc.php51
1 files changed, 38 insertions, 13 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 9588d061..a581eccd 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -373,13 +373,20 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
global $ERROR_MSG;
// echo "Validating simple:$expression<br>";
-// if (eregi('^\{([0-9a-zA-Z\_\.]+)\:([0-9a-zA-Z\_]+)\.((diff)|(min)|(max)|(last)|(nodata))\(([0-9\.]+)\)\}$', $expression, &$arr))
- if (eregi('^\{([0-9a-zA-Z[.-.]\_\.]+)\:([]\[0-9a-zA-Z\_\/\.\,]+)\.((diff)|(min)|(max)|(last)|(prev))\(([0-9\.]+)\)\}$', $expression, &$arr))
+// Before str()
+// if (eregi('^\{([0-9a-zA-Z[.-.]\_\.]+)\:([]\[0-9a-zA-Z\_\/\.\,]+)\.((diff)|(min)|(max)|(last)|(prev))\(([0-9\.]+)\)\}$', $expression, &$arr))
+// if (eregi('^\{([0-9a-zA-Z[.-.]\_\.]+)\:([]\[0-9a-zA-Z\_\/\.\,]+)\.((diff)|(min)|(max)|(last)|(prev)|(str))\(([0-9a-zA-Z\.\_\/\,]+)\)\}$', $expression, &$arr))
+ if (eregi('^\{([0-9a-zA-Z[.-.]\_\.]+)\:([]\[0-9a-zA-Z\_\/\.\,]+)\.([a-z]{3,4})\(([0-9a-zA-Z\_\/\.\,]+)\)\}$', $expression, &$arr))
{
$host=$arr[1];
$key=$arr[2];
$function=$arr[3];
- $parameter=$arr[9];
+ $parameter=$arr[4];
+
+// echo $host,"<br>";
+// echo $key,"<br>";
+// echo $function,"<br>";
+// echo $parameter,"<br>";
$sql="select count(*) from hosts h,items i where h.host='$host' and i.key_='$key' and h.hostid=i.hostid";
$result=DBselect($sql);
@@ -389,7 +396,19 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return -1;
}
- if(validate_float($parameter)!=0)
+ if( ($function!="last")&&
+ ($function!="diff")&&
+ ($function!="min") &&
+ ($function!="max") &&
+ ($function!="prev")&&
+ ($function!="str"))
+ {
+ $ERROR_MSG="Unknown function [$function]";
+ return -1;
+ }
+
+
+ if(( $function!="str") && (validate_float($parameter)!=0) )
{
$ERROR_MSG="[$parameter] is not a float";
return -1;
@@ -1133,7 +1152,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
# }
# else
# {
- $sql="insert into functions (itemid,triggerid,function,parameter) values ($itemid,$triggerid,'$function',$parameter)";
+ $sql="insert into functions (itemid,triggerid,function,parameter) values ($itemid,$triggerid,'$function','$parameter')";
# echo $sql,"<Br>";
$res=DBexecute($sql);
if(!$res)
@@ -1456,19 +1475,25 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return 1;
}
+ function is_service_hardlinked($serviceid)
+ {
+ $sql="select count(*) from services_links where servicedownid=$serviceid and soft=0";
+ $result=DBselect($sql);
+ if(DBget_field($result,0,0)>0)
+ {
+ return TRUE;
+ }
+ return FALSE;
+
+ }
+
function add_service_link($servicedownid,$serviceupid,$softlink)
{
// global $ERROR_MSG;
- if($softlink==0)
+ if( ($softlink==0) && (is_service_hardlinked($servicedownid)==TRUE) )
{
- $sql="select count(*) from services_links where servicedownid=$servicedownid and soft=0";
- $result=DBselect($sql);
- if(DBget_field($result,0,0)>0)
- {
-// $ERROR_MSG="The service is already hard-linked";
- return FALSE;
- }
+ return FALSE;
}
$sql="insert into services_links (servicedownid,serviceupid,soft) values ($servicedownid,$serviceupid,$softlink)";