diff options
| author | sasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-10-24 10:39:43 +0000 |
|---|---|---|
| committer | sasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-10-24 10:39:43 +0000 |
| commit | f41d50841de55c6e2a14d9c4df9bcc3d6830d887 (patch) | |
| tree | 39fd069054f81339faea67a25f5de33c54a9f801 /frontends | |
| parent | 196f05691a8b11aca754a36ce64421c34148f733 (diff) | |
| download | zabbix-f41d50841de55c6e2a14d9c4df9bcc3d6830d887.tar.gz zabbix-f41d50841de55c6e2a14d9c4df9bcc3d6830d887.tar.xz zabbix-f41d50841de55c6e2a14d9c4df9bcc3d6830d887.zip | |
- [DEV-48] Support of Ping and Traceroute in Status of Triggers screen
git-svn-id: svn://svn.zabbix.com/trunk@4908 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends')
| -rw-r--r-- | frontends/php/include/forms.inc.php | 4 | ||||
| -rw-r--r-- | frontends/php/include/locales/en_gb.inc.php | 25 | ||||
| -rw-r--r-- | frontends/php/include/scripts.inc.php | 25 | ||||
| -rw-r--r-- | frontends/php/scripts.php | 4 | ||||
| -rw-r--r-- | frontends/php/tr_status.php | 6 |
5 files changed, 46 insertions, 18 deletions
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index ef0e0881..4ae1db02 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -4871,8 +4871,8 @@ include_once 'include/discovery.inc.php'; $script_info = DBfetch(DBselect("select name from scripts where scriptid=$scriptid")); - $frmResult = new CFormTable(S_COMMENTS." ".$script_info["name"]); - $frmResult->AddRow(S_COMMENTS,new CTextArea("message",$result["message"],100,25)); + $frmResult = new CFormTable($script_info["name"].': '.script_make_command($scriptid,$hostid)); + $frmResult->AddRow(S_RESULT,new CTextArea("message",$result["message"],100,25)); $frmResult->AddItemToBottomRow(new CButtonCancel(null,'close_window();')); $frmResult->Show(); diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php index fd6d464d..c4dc6843 100644 --- a/frontends/php/include/locales/en_gb.inc.php +++ b/frontends/php/include/locales/en_gb.inc.php @@ -1291,21 +1291,22 @@ 'S_SCRIPTS'=> 'Scripts', 'S_SCRIPT'=> 'Script', 'S_COMMAND'=> 'Command', - 'S_PERMISSIONS_SMALL'=> 'permissions', + 'S_PERMISSIONS_SMALL'=> 'permissions', 'S_REQUIRED_HOST'=> 'Required host', - 'S_READ'=> 'Read', - 'S_WRITE'=> 'Write', - 'S_NO_SCRIPTS_DEFINED'=> 'No scripts defined', + 'S_READ'=> 'Read', + 'S_WRITE'=> 'Write', + 'S_NO_SCRIPTS_DEFINED'=> 'No scripts defined', 'S_HOST_ACCESS'=> 'Host access', - 'S_DELETE_SELECTED_SCRIPTS_Q'=> 'Delete selected scripts?', + 'S_DELETE_SELECTED_SCRIPTS_Q'=> 'Delete selected scripts?', 'S_ADD_SCRIPT'=> 'Add script', 'S_SCRIPT_ADDED'=> 'Script added', - 'S_CANNOT_ADD_SCRIPT'=> 'Cannot add script', - 'S_SCRIPT_UPDATED'=> 'Script updated', - 'S_CANNOT_UPDATE_SCRIPT'=> 'Cannot update script', - 'S_SCRIPT_DELETED'=> 'Script deleted', - 'S_CANNOT_DELETE_SCRIPT'=> 'Cannot delete script', - 'S_TOOLS'=> 'Tools', + 'S_CANNOT_ADD_SCRIPT'=> 'Cannot add script', + 'S_SCRIPT_UPDATED'=> 'Script updated', + 'S_CANNOT_UPDATE_SCRIPT'=> 'Cannot update script', + 'S_SCRIPT_DELETED'=> 'Script deleted', + 'S_CANNOT_DELETE_SCRIPT'=> 'Cannot delete script', + 'S_TOOLS'=> 'Tools', + 'S_RESULT'=> 'Result', // audit.php @@ -1321,7 +1322,7 @@ 'S_MEDIA_TYPE'=> 'Media type', 'S_GRAPH_ELEMENT'=> 'Graph element', 'S_UNKNOWN_RESOURCE'=> 'Unknown resource', - 'S_ALREADY_EXISTS_SMALL'=> 'alredy exists', + 'S_ALREADY_EXISTS_SMALL'=> 'already exists', // profile.php 'S_USER_PROFILE_BIG'=> 'USER PROFILE', diff --git a/frontends/php/include/scripts.inc.php b/frontends/php/include/scripts.inc.php index 8ff9018e..66639a12 100644 --- a/frontends/php/include/scripts.inc.php +++ b/frontends/php/include/scripts.inc.php @@ -39,10 +39,33 @@ function update_script($scriptid,$name,$command,$access){ return $result; } +function script_make_command($scriptid,$hostid) +{ + $host_db = DBfetch(DBselect("select dns,useip,ip from hosts where hostid=$hostid")); + $script_db = DBfetch(DBselect("select command from scripts where scriptid=$scriptid")); + if($host_db && $script_db) + { + $command = $script_db["command"]; + $command = str_replace("{HOST.DNS}", $host_db["dns"],$command); + $command = str_replace("{IPADDRESS}", $host_db["ip"],$command); + $command = ($host_db["useip"]==0)? + str_replace("{HOST.CONN}", $host_db["dns"],$command): + str_replace("{HOST.CONN}", $host_db["ip"],$command); + } + else + { + $command = FALSE; + } + return $command; +} + function execute_script($scriptid,$hostid){ $res = array(); $res["flag"]=1; + $command = script_make_command($scriptid,$hostid); + $nodeid = id2nodeid($hostid); + $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if(!$socket) { @@ -54,7 +77,7 @@ function execute_script($scriptid,$hostid){ } if($res) { - $send = "Command\255$scriptid\255$hostid\n"; + $send = "Command\255$nodeid\255$command\n"; socket_write($socket,$send); } if($res) diff --git a/frontends/php/scripts.php b/frontends/php/scripts.php index 531e371e..84dd2b0d 100644 --- a/frontends/php/scripts.php +++ b/frontends/php/scripts.php @@ -58,7 +58,7 @@ if(isset($_REQUEST['action'])){ if(isset($_REQUEST['save'])){ $cond = (isset($_REQUEST['scriptid']))?(' AND scriptid<>'.$_REQUEST['scriptid']):(''); - $scripts = DBfetch(DBselect('SELECT count(scriptid) as cnt FROM scripts WHERE name='.zbx_dbstr($_REQUEST['name']).$cond,1)); + $scripts = DBfetch(DBselect('SELECT count(scriptid) as cnt FROM scripts WHERE name='.zbx_dbstr($_REQUEST['name']).$cond.' and '.DBin_node('scriptid', get_current_nodeid(false)),1)); if($scripts && $scripts['cnt']>0){ error(S_SCRIPT.SPACE.'['.htmlspecialchars($_REQUEST['name']).']'.SPACE.S_ALREADY_EXISTS_SMALL); @@ -202,4 +202,4 @@ else { ?> <?php include_once "include/page_footer.php"; -?>
\ No newline at end of file +?> diff --git a/frontends/php/tr_status.php b/frontends/php/tr_status.php index f586df6a..b957be03 100644 --- a/frontends/php/tr_status.php +++ b/frontends/php/tr_status.php @@ -504,7 +504,11 @@ include_once "include/page_header.php"; SPACE, $description, $value, - SPACE, + new CCol( + get_severity_description($row["priority"]), + get_severity_style($row["priority"]) + ), +// SPACE, new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS,$row["lastchange"]),"tr_events.php?triggerid=".$row["triggerid"],"action"), $actions, ($config['ack_enable'])?$ack:NULL, |
