diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-12-27 10:59:17 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-12-27 10:59:17 +0000 |
| commit | e6d3bc1a6eae3d6847198856e7e7f57eb8a0c98b (patch) | |
| tree | 9e491d48382cf57960b1bfb949df512a9047f821 /frontends/php/include | |
| parent | b4942b68162cb3606056b71e46ae91d630e10523 (diff) | |
| download | zabbix-e6d3bc1a6eae3d6847198856e7e7f57eb8a0c98b.tar.gz zabbix-e6d3bc1a6eae3d6847198856e7e7f57eb8a0c98b.tar.xz zabbix-e6d3bc1a6eae3d6847198856e7e7f57eb8a0c98b.zip | |
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@2430 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/actions.inc.php | 38 | ||||
| -rw-r--r-- | frontends/php/include/forms.inc.php | 250 | ||||
| -rw-r--r-- | frontends/php/include/locales/en_gb.inc.php | 6 |
3 files changed, 157 insertions, 137 deletions
diff --git a/frontends/php/include/actions.inc.php b/frontends/php/include/actions.inc.php index db6f9f81..fed442eb 100644 --- a/frontends/php/include/actions.inc.php +++ b/frontends/php/include/actions.inc.php @@ -36,7 +36,7 @@ # Update Action - function update_action( $actionid, $triggerid, $userid, $good, $delay, $subject, $message, $scope, $severity, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) + function update_action( $actionid, $filter_triggerid, $userid, $good, $delay, $subject, $message, $severity, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) { if(!check_right_on_trigger("A",$triggerid)) { @@ -55,16 +55,14 @@ $subject=addslashes($subject); $message=addslashes($message); - $sql="update actions set triggerid=$triggerid,userid=$id,good=$good,delay=$delay,nextcheck=0,subject='$subject',message='$message',scope=$scope,severity=$severity,recipient=$recipient,maxrepeats=$maxrepeats,repeatdelay=$repeatdelay where actionid=$actionid"; + $sql="update actions set filter_triggerid=$filter_triggerid,userid=$id,good=$good,delay=$delay,nextcheck=0,subject='$subject',message='$message',severity=$severity,recipient=$recipient,maxrepeats=$maxrepeats,repeatdelay=$repeatdelay where actionid=$actionid"; $result=DBexecute($sql); - $trigger=get_trigger_by_triggerid($triggerid); - info("Action '$subject' for trigger '".$trigger["description"]."' updated"); return $result; } # Add Action - function add_action( $triggerid, $userid, $good, $delay, $subject, $message, $scope, $severity, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) + function add_action( $filter_triggerid, $userid, $good, $delay, $subject, $message, $scope, $severity, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) { if(!check_right_on_trigger("A",$triggerid)) { @@ -81,33 +79,9 @@ $id = $usrgrpid; } - if($scope==2) - { - $sql="insert into actions (triggerid,userid,good,delay,nextcheck,subject,message,scope,severity,recipient,maxrepeats,repeatdelay) values (0,$id,$good,$delay,0,'*Automatically generated*','*Automatically generated*',$scope,$severity,$recipient,$maxrepeats,$repeatdelay)"; - $result=DBexecute($sql); - return DBinsert_id($result,"actions","actionid"); - } - elseif($scope==1) - { - $sql="select h.hostid from triggers t,hosts h,functions f,items i where f.triggerid=t.triggerid and h.hostid=i.hostid and i.itemid=f.itemid and t.triggerid=$triggerid"; -// echo "$sql<br>"; - $result=DBselect($sql); - while($row=DBfetch($result)) - { - $sql="insert into actions (triggerid,userid,good,delay,nextcheck,subject,message,scope,severity,recipient,maxrepeats,repeatdelay) values (".$row["hostid"].",$id,$good,$delay,0,'*Automatically generated*','*Automatically generated*',$scope,$severity,$recipient,$maxrepeats,$repeatdelay)"; -// echo "$sql<br>"; - DBexecute($sql); - } - return TRUE; - } - else - { - $sql="insert into actions (triggerid,userid,good,delay,nextcheck,subject,message,scope,severity,recipient,maxrepeats,repeatdelay) values ($triggerid,$id,$good,$delay,0,'$subject','$message',$scope,$severity,$recipient,$maxrepeats,$repeatdelay)"; - $result=DBexecute($sql); - return DBinsert_id($result,"actions","actionid"); - } - $trigger=get_trigger_by_triggerid($triggerid); - info("Action '$subject' for trigger '".$trigger["description"]."' added"); + $sql="insert into actions (tilter_triggerid,userid,good,delay,nextcheck,subject,message,severity,recipient,maxrepeats,repeatdelay) values ($filter_triggerid,$id,$good,$delay,0,'$subject','$message',$severity,$recipient,$maxrepeats,$repeatdelay)"; + $result=DBexecute($sql); + return DBinsert_id($result,"actions","actionid"); } # Delete Action by userid diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index c63bfd74..bb1e7d38 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -1501,7 +1501,9 @@ $actionid=$action["actionid"]; $actiontype=$action["actiontype"]; - $triggerid=$action["triggerid"]; + $filter_triggerid=$action["filter_triggerid"]; + $filter_groupid=$action["filter_groupid"]; + $filter_hostid=$action["filter_hostid"]; $source=$action["source"]; $filter_trigger_name=$action["filter_trigger_name"]; $good=$action["good"]; @@ -1533,6 +1535,9 @@ $source=0; $actiontype=0; $filter_trigger_name=""; + $filter_triggerid=0; + $filter_groupid=0; + $filter_hostid=0; $description=""; // $delay=30; @@ -1554,6 +1559,9 @@ } } + $filtertype=@iif(isset($_REQUEST["filtertype"]),$_REQUEST["filtertype"],0); + + show_form_begin("actions.action"); echo nbsp(S_NEW_ACTION); $col=0; @@ -1571,129 +1579,161 @@ echo "</SELECT>"; show_table2_v_delimiter($col++); - echo nbsp(S_FILTER_HOST_GROUP); - show_table2_h_delimiter(); - $h2="<select class=\"biginput\" name=\"filter_groupid\">"; - $h2=$h2.form_select("groupid",0,S_ALL_SMALL); - $result=DBselect("select groupid,name from groups order by name"); - while($row=DBfetch($result)) - { - $h2=$h2.form_select("filter_groupid",$row["groupid"],$row["name"]); + echo nbsp("Conditions"); + show_table2_h_delimiter(); + echo "<input type=checkbox name=\"zzz\" \">"."Host: zabbix.com"; + echo "<br>"; + echo "<input type=checkbox name=\"zzz\" \">"."Trigger: Processor load is too high on zabbix.com"; + echo "<br>"; + echo "<input type=checkbox name=\"zzz\" \">"."Trigger description like: \"Processor load is too high\""; + +// show_table2_v_delimiter($col); +// echo nbsp(" "."Condition"); +// show_table2_h_delimiter(); + $h2="<select class=\"biginput\" name=\"filtertype\" onChange=\"submit()\">>"; + $h2=$h2.form_select("filtertype",0,S_HOST_GROUP); + $h2=$h2.form_select("filtertype",1,S_HOST); + $h2=$h2.form_select("filtertype",2,S_TRIGGER); + $h2=$h2.form_select("filtertype",3,S_TRIGGER_NAME); + $h2=$h2.form_select("filtertype",4,S_TRIGGER_SEVERITY); + $h2=$h2.form_select("filtertype",5,S_TRIGGER_VALUE); + $h2=$h2.form_select("filtertype",6,S_TIME_PERIOD); + $h2=$h2."</SELECT>"; +// echo $h2; + + if($filtertype==0) + { + show_table2_v_delimiter($col); + echo nbsp(" Condition"); + show_table2_h_delimiter(); + $h2=$h2." <b>=</b> "."<select class=\"biginput\" name=\"filter_groupid\">"; + $h2=$h2.form_select("groupid",0,S_ALL_SMALL); + $result=DBselect("select groupid,name from groups order by name"); + while($row=DBfetch($result)) + { + $h2=$h2.form_select("filter_groupid",$row["groupid"],$row["name"]); + } + $h2=$h2."</SELECT>"; + echo $h2; } - echo $h2; - echo "</SELECT>"; - - show_table2_v_delimiter($col++); - echo nbsp(S_FILTER_HOST); - show_table2_h_delimiter(); - $h2="<select class=\"biginput\" name=\"filter_hostid\">"; - $h2=$h2.form_select("hostid",0,S_ALL_SMALL); - $result=DBselect("select hostid,host from hosts where status<>".HOST_STATUS_DELETED." order by host"); - while($row=DBfetch($result)) + else { - $h2=$h2.form_select("filter_hostid",$row["hostid"],$row["host"]); - } - echo $h2; - echo "</SELECT>"; + show_table2_v_delimiter($col++); + echo nbsp(S_FILTER_HOST); + show_table2_h_delimiter(); + $h2="<select class=\"biginput\" name=\"filter_hostid\">"; + $h2=$h2.form_select("hostid",0,S_ALL_SMALL); + $result=DBselect("select hostid,host from hosts where status<>".HOST_STATUS_DELETED." order by host"); + while($row=DBfetch($result)) + { + $h2=$h2.form_select("filter_hostid",$row["hostid"],$row["host"]); + } + echo $h2; + echo "</SELECT>"; - show_table2_v_delimiter($col++); - echo S_FILTER_TRIGGER; - show_table2_h_delimiter(); - $h2="<select class=\"biginput\" name=\"groupid\" onChange=\"submit()\">"; - $h2=$h2.form_select("groupid",0,S_ALL_SMALL); - $result=DBselect("select groupid,name from groups order by name"); - while($row=DBfetch($result)) - { -// Check if at least one host with read permission exists for this group - $result2=DBselect("select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid and hg.groupid=".$row["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host"); - $cnt=0; - while($row2=DBfetch($result2)) + show_table2_v_delimiter($col++); + echo S_FILTER_TRIGGER; + show_table2_h_delimiter(); + $h2="<select class=\"biginput\" name=\"groupid\" onChange=\"submit()\">"; + $h2=$h2.form_select("groupid",0,S_ALL_SMALL); + $result=DBselect("select groupid,name from groups order by name"); + while($row=DBfetch($result)) { - if(!check_right("Host","R",$row2["hostid"])) +// Check if at least one host with read permission exists for this group + $result2=DBselect("select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid and hg.groupid=".$row["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host"); + $cnt=0; + while($row2=DBfetch($result2)) { - continue; + if(!check_right("Host","R",$row2["hostid"])) + { + continue; + } + $cnt=1; break; + } + if($cnt!=0) + { + $h2=$h2.form_select("groupid",$row["groupid"],$row["name"]); } - $cnt=1; break; } - if($cnt!=0) + $h2=$h2."</select> "; + + $h2=$h2."<select class=\"biginput\" name=\"hostid\" onChange=\"submit()\">"; + $h2=$h2.form_select("hostid",0,S_SELECT_HOST_DOT_DOT_DOT); + + if(isset($_REQUEST["groupid"])) { - $h2=$h2.form_select("groupid",$row["groupid"],$row["name"]); + $sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid and hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host"; } - } - $h2=$h2."</select> "; - - $h2=$h2."<select class=\"biginput\" name=\"hostid\" onChange=\"submit()\">"; - $h2=$h2.form_select("hostid",0,S_SELECT_HOST_DOT_DOT_DOT); - - if(isset($_REQUEST["groupid"])) - { - $sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid and hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host"; - } - else - { - $sql="select h.hostid,h.host from hosts h,items i where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid group by h.hostid,h.host order by h.host"; - } + else + { + $sql="select h.hostid,h.host from hosts h,items i where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid group by h.hostid,h.host order by h.host"; + } + + $result=DBselect($sql); + while($row=DBfetch($result)) + { + if(!check_right("Host","R",$row["hostid"])) + { + continue; + } + $h2=$h2.form_select("hostid",$row["hostid"],$row["host"]); + } + $h2=$h2."</select> "; + echo $h2; - $result=DBselect($sql); - while($row=DBfetch($result)) - { - if(!check_right("Host","R",$row["hostid"])) + if(isset($_REQUEST["hostid"])) { - continue; + show_table2_v_delimiter($col++); + echo " "; + show_table2_h_delimiter(); + $result=DBselect("select t.triggerid,t.description from triggers t,functions f, hosts h, items i where h.hostid=i.hostid and f.itemid=i.itemid and t.triggerid=f.triggerid and h.hostid=".$_REQUEST["hostid"]." order by t.description"); + echo "<select class=\"biginput\" name=\"filter_triggerid\" size=1>"; + while($row=DBfetch($result)) + { + $triggerid_=$row["triggerid"]; + $description_=expand_trigger_description($triggerid_); + if(isset($triggerid) && ($triggerid==$triggerid_)) + { + echo "<OPTION VALUE='$triggerid_' SELECTED>$description_"; + } + else + { + echo "<OPTION VALUE='$triggerid_'>$description_"; + } + } + echo "</SELECT>"; } - $h2=$h2.form_select("hostid",$row["hostid"],$row["host"]); - } - $h2=$h2."</select> "; - echo $h2; - if(isset($_REQUEST["hostid"])) - { show_table2_v_delimiter($col++); - echo " "; + echo S_FILTER_TRIGGER_NAME; show_table2_h_delimiter(); - $result=DBselect("select t.triggerid,t.description from triggers t,functions f, hosts h, items i where h.hostid=i.hostid and f.itemid=i.itemid and t.triggerid=f.triggerid and h.hostid=".$_REQUEST["hostid"]." order by t.description"); - echo "<select class=\"biginput\" name=\"filter_triggerid\" size=1>"; - while($row=DBfetch($result)) - { - $triggerid_=$row["triggerid"]; - $description_=expand_trigger_description($triggerid_); - if(isset($triggerid) && ($triggerid==$triggerid_)) - { - echo "<OPTION VALUE='$triggerid_' SELECTED>$description_"; - } - else - { - echo "<OPTION VALUE='$triggerid_'>$description_"; - } - } - echo "</SELECT>"; - } + echo "<input class=\"biginput\" name=\"filter_trigger_name\" value=\"$filter_trigger_name\" size=64>"; - show_table2_v_delimiter($col++); - echo S_FILTER_TRIGGER_NAME; - show_table2_h_delimiter(); - echo "<input class=\"biginput\" name=\"filter_trigger_name\" value=\"$filter_trigger_name\" size=64>"; - - show_table2_v_delimiter($col++); - echo nbsp(S_FILTER_TRIGGER_SEVERITY); - show_table2_h_delimiter(); - echo "<select class=\"biginput\" name=\"filter_trigger_severity\" size=1>"; - echo "<OPTION VALUE=\"0\" "; if($severity==0) echo "SELECTED"; echo ">".S_NOT_CLASSIFIED; - echo "<OPTION VALUE=\"1\" "; if($severity==1) echo "SELECTED"; echo ">".S_INFORMATION; - echo "<OPTION VALUE=\"2\" "; if($severity==2) echo "SELECTED"; echo ">".S_WARNING; - echo "<OPTION VALUE=\"3\" "; if($severity==3) echo "SELECTED"; echo ">".S_AVERAGE; - echo "<OPTION VALUE=\"4\" "; if($severity==4) echo "SELECTED"; echo ">".S_HIGH; - echo "<OPTION VALUE=\"5\" "; if($severity==5) echo "SELECTED"; echo ">".S_DISASTER; - echo "</SELECT>"; + show_table2_v_delimiter($col++); + echo nbsp(S_FILTER_TRIGGER_SEVERITY); + show_table2_h_delimiter(); + echo "<select class=\"biginput\" name=\"filter_trigger_severity\" size=1>"; + echo "<OPTION VALUE=\"0\" "; if($severity==0) echo "SELECTED"; echo ">".S_NOT_CLASSIFIED; + echo "<OPTION VALUE=\"1\" "; if($severity==1) echo "SELECTED"; echo ">".S_INFORMATION; + echo "<OPTION VALUE=\"2\" "; if($severity==2) echo "SELECTED"; echo ">".S_WARNING; + echo "<OPTION VALUE=\"3\" "; if($severity==3) echo "SELECTED"; echo ">".S_AVERAGE; + echo "<OPTION VALUE=\"4\" "; if($severity==4) echo "SELECTED"; echo ">".S_HIGH; + echo "<OPTION VALUE=\"5\" "; if($severity==5) echo "SELECTED"; echo ">".S_DISASTER; + echo "</SELECT>"; + show_table2_v_delimiter($col++); + echo nbsp(S_FILTER_WHEN_TRIGGER_BECOMES); + show_table2_h_delimiter(); + echo "<select class=\"biginput\" name=\"good\" size=1>"; + echo "<OPTION VALUE=\"1\""; if($good==1) echo "SELECTED"; echo ">".S_ON; + echo "<OPTION VALUE=\"0\""; if($good==0) echo "SELECTED"; echo ">".S_OFF; + echo "<OPTION VALUE=\"2\""; if($good==2) echo "SELECTED"; echo ">".S_ON_OR_OFF; + echo "</SELECT>"; + } show_table2_v_delimiter($col++); - echo nbsp(S_FILTER_WHEN_TRIGGER_BECOMES); + echo nbsp(" "); show_table2_h_delimiter(); - echo "<select class=\"biginput\" name=\"good\" size=1>"; - echo "<OPTION VALUE=\"1\""; if($good==1) echo "SELECTED"; echo ">".S_ON; - echo "<OPTION VALUE=\"0\""; if($good==0) echo "SELECTED"; echo ">".S_OFF; - echo "<OPTION VALUE=\"2\""; if($good==2) echo "SELECTED"; echo ">".S_ON_OR_OFF; - echo "</SELECT>"; + echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"add condition\">"; show_table2_v_delimiter($col++); echo nbsp(S_ACTION_TYPE); diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php index b9d47e7b..0caaa2e9 100644 --- a/frontends/php/include/locales/en_gb.inc.php +++ b/frontends/php/include/locales/en_gb.inc.php @@ -55,6 +55,12 @@ "S_ACTION_TYPE"=> "Action type", "S_SEND_MESSAGE"=> "Send message", "S_REMOTE_COMMAND"=> "Remote command", + "S_FILTER"=> "Filter", + "S_FILTER_TYPE"=> "Filter type", + "S_TRIGGER_NAME"=> "Trigger name", + "S_TRIGGER_SEVERITY"=> "Trigger severity", + "S_TRIGGER_VALUE"=> "Trigger value", + "S_TIME_PERIOD"=> "Time period", // actions.php "S_ACTIONS"=> "Actions", |
