"; else echo "
"; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.__('Name'); echo ''; echo '
'.__('Plugin command'); echo ''; echo '
'.__('Plugin type'); echo ''; $fields[0]= __("Standard"); $fields[1]= __("Nagios"); print_select ($fields, "form_plugin_type", $form_plugin_type); echo '
'.__('Max. timeout'); echo ''; echo '
'.__('IP address option'); echo ''; echo '
'.__('Port option'); echo ''; echo '
'.__('User option'); echo ''; echo '
'.__('Password option'); echo ''; echo '
'.__('Description').'
'; echo ''; echo '
'; if ($create != ""){ echo ""; } else { echo ""; } echo '
'; } else { print_page_header (__('Plugins registered in Pandora FMS'), "", false, "", true); // Update plugin if (isset($_GET["update_plugin"])){ // if modified any parameter $plugin_id = get_parameter ("update_plugin", 0); $plugin_name = get_parameter ("form_name", ""); $plugin_description = get_parameter ("form_description", ""); $plugin_max_timeout = get_parameter ("form_max_timeout", ""); $plugin_execute = get_parameter ("form_execute", ""); $plugin_net_dst_opt = get_parameter ("form_net_dst_opt", ""); $plugin_net_port_opt = get_parameter ("form_net_port_opt", ""); $plugin_user_opt = get_parameter ("form_user_opt", ""); $plugin_pass_opt = get_parameter ("form_pass_opt", ""); $plugin_plugin_type = get_parameter ("form_plugin_type", "0"); $sql_update ="UPDATE tplugin SET name = '$plugin_name', description = '$plugin_description', max_timeout = '$plugin_max_timeout', execute = '$plugin_execute', net_dst_opt = '$plugin_net_dst_opt', net_port_opt = '$plugin_net_port_opt', user_opt = '$plugin_user_opt', plugin_type = '$plugin_plugin_type', pass_opt = '$plugin_pass_opt' WHERE id = $plugin_id"; $result=mysql_query($sql_update); if (! $result) { echo "

".__('Problem updating plugin')."

"; } else { echo "

".__('Plugin updated successfully')."

"; } } // Create plugin if (isset($_GET["create_plugin"])){ $plugin_name = get_parameter ("form_name", ""); $plugin_description = get_parameter ("form_description", ""); $plugin_max_timeout = get_parameter ("form_max_timeout", ""); $plugin_execute = get_parameter ("form_execute", ""); $plugin_net_dst_opt = get_parameter ("form_net_dst_opt", ""); $plugin_net_port_opt = get_parameter ("form_net_port_opt", ""); $plugin_user_opt = get_parameter ("form_user_opt", ""); $plugin_pass_opt = get_parameter ("form_pass_opt", ""); $plugin_plugin_type = get_parameter ("form_plugin_type", "0"); $sql_insert ="INSERT tplugin (name, description, max_timeout, execute, net_dst_opt, net_port_opt, user_opt, pass_opt, plugin_type) VALUES ('$plugin_name', '$plugin_description', '$plugin_max_timeout', '$plugin_execute', '$plugin_net_dst_opt', '$plugin_net_port_opt', '$plugin_user_opt', '$plugin_pass_opt', $plugin_plugin_type)"; $result=mysql_query($sql_insert); if (! $result){ echo "

".__('Problem creating plugin')."

"; echo $sql_insert; } else { echo "

".__('Plugin created successfully')."

"; } } if (isset($_GET["kill_plugin"])){ // if delete alert $plugin_id = get_parameter ("kill_plugin", 0); $sql_delete= "DELETE FROM tplugin WHERE id= ".$plugin_id; $result=mysql_query($sql_delete); if (! $result){ echo "

".__('Problem deleting plugin')."

"; } else { echo "

".__('Plugin deleted successfully')."

"; } if ($plugin_id != 0){ $sql_delete2 ="DELETE FROM tagente_modulo WHERE id_plugin = ".$plugin_id; $result=mysql_query($sql_delete2); } } // If not edition or insert, then list available plugins $sql1='SELECT * FROM tplugin ORDER BY name'; $result=mysql_query($sql1); if (mysql_num_rows($result) > 0){ echo ''; echo ""; echo ""; echo ""; echo ""; $color = 0; while ($row=mysql_fetch_array($result)){ if ($color == 1){ $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } echo ""; echo ""; echo ""; } echo "
".__('Name')."".__('Type')."".__('Command')."".__('Delete')."
"; echo ""; echo $row["name"]; echo ""; if ($row["plugin_type"] == 0) echo __('Standard'); else echo __('Nagios'); echo ""; echo $row["execute"]; echo ""; echo ""; echo "
"; } else { echo '
'. __('There are no plugins in the system'); echo "
"; } echo ""; echo "
"; echo "
"; echo ""; echo "
"; } ?>