diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2004-09-18 08:15:56 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2004-09-18 08:15:56 +0000 |
| commit | 984e8708f85679aefd3d0029383e8fefbaf647a0 (patch) | |
| tree | 5c01c40c2f38bbd525942ecce7e21bcb77366787 /frontends/php | |
| parent | 44e8cd98347176a8c79a470c5a0b7e6d236991e0 (diff) | |
| download | zabbix-984e8708f85679aefd3d0029383e8fefbaf647a0.tar.gz zabbix-984e8708f85679aefd3d0029383e8fefbaf647a0.tar.xz zabbix-984e8708f85679aefd3d0029383e8fefbaf647a0.zip | |
Better audit support.
git-svn-id: svn://svn.zabbix.com/trunk@1428 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
| -rw-r--r-- | frontends/php/actions.php | 14 | ||||
| -rw-r--r-- | frontends/php/audit.php | 12 | ||||
| -rw-r--r-- | frontends/php/graph.php | 20 | ||||
| -rw-r--r-- | frontends/php/graphs.php | 13 | ||||
| -rw-r--r-- | frontends/php/hosts.php | 5 | ||||
| -rw-r--r-- | frontends/php/include/config.inc.php | 19 | ||||
| -rw-r--r-- | frontends/php/include/defines.inc.php | 3 |
7 files changed, 85 insertions, 1 deletions
diff --git a/frontends/php/actions.php b/frontends/php/actions.php index dbd74529..0e6240f0 100644 --- a/frontends/php/actions.php +++ b/frontends/php/actions.php @@ -42,17 +42,31 @@ { $result=add_action( $_GET["triggerid"], $_GET["userid"], $_GET["good"], $_GET["delay"], $_GET["subject"], $_GET["message"],$_GET["scope"],$_GET["severity"],$_GET["recipient"],$_GET["usrgrpid"]); show_messages($result,S_ACTION_ADDED,S_CANNOT_ADD_ACTION); + if($result) + { + $user=get_user_by_userid($_GET["userid"]); + add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_ACTION,"User [".$user["alias"]."] when [".$_GET["good"]."] subject [".$_GET["subject"]."]"); + } } if($_GET["register"]=="update") { $result=update_action( $_GET["actionid"], $_GET["triggerid"], $_GET["userid"], $_GET["good"], $_GET["delay"], $_GET["subject"], $_GET["message"],$_GET["scope"],$_GET["severity"],$_GET["recipient"],$_GET["usrgrpid"]); show_messages($result,S_ACTION_UPDATED,S_CANNOT_UPATE_ACTION); + if($result) + { + $user=get_user_by_userid($_GET["userid"]); + add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_ACTION,"User [".$user["alias"]."] when [".$_GET["good"]."] subject [".$_GET["subject"]."]"); + } unset($_GET["actionid"]); } if($_GET["register"]=="delete") { $result=delete_action($_GET["actionid"]); show_messages($result,S_ACTION_DELETED,S_CANNOT_DELETE_ACTION); + if($result) + { + add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_ACTION,"When [".$_GET["good"]."] subject [".$_GET["subject"]."]"); + } unset($_GET["actionid"]); } } diff --git a/frontends/php/audit.php b/frontends/php/audit.php index 16ee5faa..8a2340ee 100644 --- a/frontends/php/audit.php +++ b/frontends/php/audit.php @@ -130,6 +130,18 @@ { echo S_HOST; } + else if($row["resource"]==AUDIT_RESOURCE_ACTION) + { + echo S_ACTION; + } + else if($row["resource"]==AUDIT_RESOURCE_GRAPH) + { + echo S_GRAPH; + } + else if($row["resource"]==AUDIT_RESOURCE_GRAPH_ELEMENT) + { + echo S_GRAPH_ELEMENT; + } else { echo S_UNKNOWN_RESOURCE; diff --git a/frontends/php/graph.php b/frontends/php/graph.php index ac090c7f..36f72f71 100644 --- a/frontends/php/graph.php +++ b/frontends/php/graph.php @@ -45,16 +45,36 @@ if($_GET["register"]=="add") { $result=add_item_to_graph($_GET["graphid"],$_GET["itemid"],$_GET["color"],$_GET["drawtype"],$_GET["sortorder"]); + if($result) + { + $graph=get_graph_by_graphid($_GET["graphid"]); + $item=get_item_by_itemid($_GET["itemid"]); + add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_GRAPH_ELEMENT,"Graph ID [".$_GET["graphid"]."] Name [".$graph["name"]."] Added [".$item["name"]."]"); + } show_messages($result,S_ITEM_ADDED, S_CANNOT_ADD_ITEM); } if($_GET["register"]=="update") { $result=update_graph_item($_GET["gitemid"],$_GET["itemid"],$_GET["color"],$_GET["drawtype"],$_GET["sortorder"]); + if($result) + { + $graphitem=get_graphitem_by_gitemid($_GET["gitemid"]); + $graph=get_graph_by_graphid($graphitem["graphid"]); + $item=get_item_by_itemid($graphitemid["itemid"]); + add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_GRAPH_ELEMENT,"Graph ID [".$graphitem["graphid"]."] Name [".$graph["name"]."] Updated [".$item["name"]."]"); + } show_messages($result, S_ITEM_UPDATED, S_CANNOT_UPDATE_ITEM); } if($_GET["register"]=="delete") { + $graphitem=get_graphitem_by_gitemid($_GET["gitemid"]); $result=delete_graphs_item($_GET["gitemid"]); + if($result) + { + $graph=get_graph_by_graphid($graphitem["graphid"]); + $item=get_item_by_itemid($graphitemid["itemid"]); + add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_GRAPH_ELEMENT,"Graph ID [".$graphitem["graphid"]."] Name [".$graph["name"]."] Deleted [".$item["name"]."]"); + } show_messages($result, S_ITEM_DELETED, S_CANNOT_DELETE_ITEM); unset($_GET["gitemid"]); } diff --git a/frontends/php/graphs.php b/frontends/php/graphs.php index 3f6421b8..49472e95 100644 --- a/frontends/php/graphs.php +++ b/frontends/php/graphs.php @@ -47,16 +47,29 @@ if($_GET["register"]=="add") { $result=add_graph($_GET["name"],$_GET["width"],$_GET["height"],$_GET["yaxistype"],$_GET["yaxismin"],$_GET["yaxismax"]); + if($result) + { + add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_GRAPH,"Graph [".addslashes($_GET["name"])."]"); + } show_messages($result, S_GRAPH_ADDED, S_CANNOT_ADD_GRAPH); } if($_GET["register"]=="update") { $result=update_graph($_GET["graphid"],$_GET["name"],$_GET["width"],$_GET["height"],$_GET["yaxistype"],$_GET["yaxismin"],$_GET["yaxismax"]); + if($result) + { + add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_GRAPH,"Graph ID [".$_GET["graphid"]."] Graph [".addslashes($_GET["name"])."]"); + } show_messages($result, S_GRAPH_UPDATED, S_CANNOT_UPDATE_GRAPH); } if($_GET["register"]=="delete") { + $graph=get_graph_by_graphid($_GET["graphid"]); $result=delete_graph($_GET["graphid"]); + if($result) + { + add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_GRAPH,"Graph [".addslashes($graph["name"])."]"); + } show_messages($result, S_GRAPH_DELETED, S_CANNOT_DELETE_GRAPH); unset($_GET["graphid"]); } diff --git a/frontends/php/hosts.php b/frontends/php/hosts.php index d7d08f4d..673c84f4 100644 --- a/frontends/php/hosts.php +++ b/frontends/php/hosts.php @@ -74,7 +74,12 @@ } if($_GET["register"]=="delete") { + $host-get_host_by_hostid($_GET["hostid"]); $result=delete_host($_GET["hostid"]); + if($result) + { + add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_HOST,"Host [".addslashes($host["name"])."]"); + } show_messages($result, S_HOST_DELETED, S_CANNOT_DELETE_HOST); unset($_GET["hostid"]); } diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index 34c67db0..a7e551ad 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -666,6 +666,23 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; } + function get_graphitem_by_gitemid($gitemid) + { + global $ERROR_MSG; + + $sql="select * from graphs_items where gitemid=$gitemid"; + $result=DBselect($sql); + if(DBnum_rows($result) == 1) + { + return DBfetch($result); + } + else + { + $ERROR_MSG="No graph item with gitemid=[$gitemid]"; + } + return $result; + } + function get_graph_by_graphid($graphid) { global $ERROR_MSG; @@ -680,7 +697,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; { $ERROR_MSG="No graph with graphid=[$graphid]"; } - return $graph; + return $result; } function get_image_by_name($imagetype,$name) diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php index 24c10940..e1a7f93d 100644 --- a/frontends/php/include/defines.inc.php +++ b/frontends/php/include/defines.inc.php @@ -30,6 +30,9 @@ define("AUDIT_RESOURCE_ZABBIX_CONFIG", 2); define("AUDIT_RESOURCE_MEDIA_TYPE", 3); define("AUDIT_RESOURCE_HOST", 4); + define("AUDIT_RESOURCE_ACTION", 5); + define("AUDIT_RESOURCE_GRAPH", 6); + define("HOST_STATUS_MONITORED", 0); |
