summaryrefslogtreecommitdiffstats
path: root/frontends/php/nodes.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-10-25 07:21:56 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-10-25 07:21:56 +0000
commitd23332dbc5dabb29dfec400d2d9ba782b46b5615 (patch)
tree21d5823c2940c9ada032bc3650fac8423b266365 /frontends/php/nodes.php
parent28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89 (diff)
downloadzabbix-d23332dbc5dabb29dfec400d2d9ba782b46b5615.tar.gz
zabbix-d23332dbc5dabb29dfec400d2d9ba782b46b5615.tar.xz
zabbix-d23332dbc5dabb29dfec400d2d9ba782b46b5615.zip
- developed node manager (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3379 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/nodes.php')
-rw-r--r--frontends/php/nodes.php64
1 files changed, 60 insertions, 4 deletions
diff --git a/frontends/php/nodes.php b/frontends/php/nodes.php
index d40662e5..89e78a28 100644
--- a/frontends/php/nodes.php
+++ b/frontends/php/nodes.php
@@ -21,6 +21,7 @@
<?php
require_once "include/config.inc.php";
require_once "include/forms.inc.php";
+ require_once "include/nodes.inc.php";
$page["title"] = "S_NODES";
$page["file"] = "nodes.php";
@@ -35,6 +36,13 @@ include_once "include/page_header.php";
// media form
"nodeid"=> array(T_ZBX_INT, O_NO, null, DB_ID, '{form}=="update"'),
+
+ "name"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'),
+ "timezone"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(-12,+13),'isset({save})'),
+ "ip"=> array(T_ZBX_STR, O_OPT, null, DB_ID, 'isset({save})'),
+ "port"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(1,65535),'isset({save})'),
+ "slave_history"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,65535),'isset({save})'),
+ "slave_trends"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,65535),'isset({save})'),
/* actions */
"save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
"delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
@@ -43,7 +51,7 @@ include_once "include/page_header.php";
"form"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL),
"form_refresh"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL)
);
-
+
check_fields($fields);
$accessible_nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST);
@@ -54,6 +62,47 @@ include_once "include/page_header.php";
}
?>
<?php
+ if(isset($_REQUEST['save']))
+ {
+ $result = false;
+ if(isset($_REQUEST['nodeid']))
+ { /* update */
+ $audit_action = AUDIT_ACTION_UPDATE;
+ $result = update_node($_REQUEST['nodeid'],
+ $_REQUEST['name'], $_REQUEST['timezone'], $_REQUEST['ip'], $_REQUEST['port'],
+ $_REQUEST['slave_history'], $_REQUEST['slave_trends']);
+ $nodeid = $_REQUEST['nodeid'];
+ show_messages($result, S_NODE_UPDATED, S_CANNOT_UPDATE_NODE);
+ }
+ else
+ { /* add */
+ $audit_action = AUDIT_ACTION_ADD;
+ $result = add_node(
+ $_REQUEST['name'], $_REQUEST['timezone'], $_REQUEST['ip'], $_REQUEST['port'],
+ $_REQUEST['slave_history'], $_REQUEST['slave_trends']);
+ $nodeid = $result;
+
+ show_messages($result, S_NODE_ADDED, S_CANNOT_ADD_NODE);
+ }
+ add_audit_if($result,$audit_action,AUDIT_RESOURCE_NODE,'Node ['.$_REQUEST['name'].'] id ['.$nodeid.']');
+ if($result)
+ {
+ unset($_REQUEST['form']);
+ }
+ }
+ elseif(isset($_REQUEST['delete']))
+ {
+ $node_data = get_node_by_nodeid($_REQUEST['nodeid']);
+ $result = delete_node($_REQUEST['nodeid']);
+ show_messages($result, S_NODE_DELETED, S_CANNOT_DELETE_NODE);
+ add_audit_if($result,AUDIT_ACTION_DELETE,'Node ['.$node_data['name'].'] id ['.$node_data['nodeid'].']');
+ if($result)
+ {
+ unset($_REQUEST['form'],$node_data);
+ }
+ }
+?>
+<?php
if(isset($_REQUEST["form"]))
{
insert_node_form();
@@ -65,16 +114,23 @@ include_once "include/page_header.php";
show_table_header(S_NODES_BIG,$form);
$table=new CTableInfo(S_NO_NODES_DEFINED);
- $table->SetHeader(array(S_NAME));
+ $table->SetHeader(array(S_NAME,S_TYPE,S_TIME_ZONE,S_IP.':'.S_PORT));
$db_nodes = DBselect('select * from nodes where nodeid in ('.
get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST).') '.
- ' order by name ');
+ ' order by nodetype desc,name ');
while($row=DBfetch($db_nodes))
{
$table->AddRow(array(
- new CLink($row["name"],"?&form=update&nodeid=".$row["nodeid"],'action'),
+ array(
+ get_node_path($row['masterid']),
+ new CLink(
+ ($row['nodetype'] ? new CSpan($row["name"], 'bold') : $row["name"]),
+ "?&form=update&nodeid=".$row["nodeid"],'action')),
+ $row['nodetype'] ? new CSpan(S_LOCAL,'bold') : S_REMOTE,
+ new CSpan("GMT".sprintf("%+03d:00", $row['timezone']), $row['nodetype'] ? 'bold' : null),
+ new CSpan($row['ip'].':'.$row['port'], $row['nodetype'] ? 'bold' : null)
));
}
$table->Show();