diff options
| author | james_wells <james_wells@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-11-18 03:17:13 +0000 |
|---|---|---|
| committer | james_wells <james_wells@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-11-18 03:17:13 +0000 |
| commit | f7c2b61c66cc33bb15842c4db07b145ace7ba7e9 (patch) | |
| tree | 82d878bee71b96b3ecd66eacfb1bf97788754c7d /frontends/php/bulkloader.php | |
| parent | 715779b96fa92ec73fdb4e5d58791af6bb2e5683 (diff) | |
| download | zabbix-f7c2b61c66cc33bb15842c4db07b145ace7ba7e9.tar.gz zabbix-f7c2b61c66cc33bb15842c4db07b145ace7ba7e9.tar.xz zabbix-f7c2b61c66cc33bb15842c4db07b145ace7ba7e9.zip | |
Added preliminary host and user bulk loader. Still a lot more needs to be added.
zabbix/frontends/php/include/bulkloader.inc.php
zabbix/frontends/php/include/config.inc.php
zabbix/frontends/php/bulkloader.php
Applied SNMPv3 fix
zabbix/src/zabbix_server/poller/poller.c
zabbix/src/zabbix_server/poller/checks_snmp.c
Applied graph dropdown patch
zabbix/frontends/php/charts.php
zabbix/frontends/php/history.php
zabbix/frontends/php/screens.php
zabbix/frontends/php/include/graphs.inc.php
git-svn-id: svn://svn.zabbix.com/trunk@2334 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/bulkloader.php')
| -rw-r--r-- | frontends/php/bulkloader.php | 59 |
1 files changed, 49 insertions, 10 deletions
diff --git a/frontends/php/bulkloader.php b/frontends/php/bulkloader.php index 1a58b51e..bddb58f7 100644 --- a/frontends/php/bulkloader.php +++ b/frontends/php/bulkloader.php @@ -19,6 +19,7 @@ **/ include "include/config.inc.php"; include "include/forms.inc.php"; + include "include/bulkloader.inc.php"; $page["file"] = "bulkloader.php"; $page["title"] = "S_BULKLOADER_MAIN"; $fileuploaded=0; @@ -111,20 +112,19 @@ // Determine which group(s) this host belongs to, create any group(s) necessary; $hostGroups=array(); $groupnum=0; -// $tmpGroupList=explode(',',rtrim(rtrim($tmpHostGroups," "),"\n")); foreach(explode(',',rtrim(rtrim($tmpHostGroups," "),"\n")) as $tmpGroup) { $groupnum++; - $sqlResult=DBSelect("select distinct(groupid) from groups where name='$tmpGroup'"); + $sqlResult=DBselect("select distinct(groupid) from groups where name='$tmpGroup'"); if(DBnum_rows($sqlResult)==0) { // Create new group - $hostGroups=array_merge($hostGroups,array(add_group($tmpGroup))); + $hostGroups=array_merge($hostGroups,array(create_Host_Group($tmpGroup))); } else { // Found Existing Group; - $row=DBFetch($sqlResult); + $row=DBfetch($sqlResult); $hostGroups=array_merge($hostGroups,array($row["groupid"])); } } @@ -135,7 +135,26 @@ DBselect("update hosts set serverid=$hostServer where host='$tmpHost'"); break; case "USER": - echo "Importing Users is not yet implemented"; + list($tmpName,$tmpSurname,$tmpAlias,$tmpPasswd,$tmpURL,$tmpAutologout,$tmpLang,$tmpRefresh,$tmpUserGroups) = explode(",",$tmpField,9); + $autologout=@iif($tmpAutologout==NULL,900,$tmpAutologout); + $lang=@iif($tmpLang==NULL,'en_gb',$tmpLang); + $refresh=@iif($tmpRefresh==NULL,30,$tmpRefresh); + $passwd=@iif($tmpPasswd==NULL,md5($tmpAlias),md5($tmpPasswd)); + $result=@iif($tmpAlias==NULL,0,add_user($tmpName,$tmpSurname,$tmpAlias,$passwd,$tmpURL,$autologout,$lang,$refresh)); + show_messages($result, S_USER_ADDED .': '. $tmpAlias, S_CANNOT_ADD_USER .': '. $tmpAlias); + $row=DBfetch(DBselect("select distinct(userid) from users where alias='$tmpAlias'")); + $tmpUserID=$row["userid"]; + if($tmpUserID) + { + foreach(explode(',',rtrim(rtrim($tmpUserGroups," "),"\n")) as $tmpGroup) + { + $tmpGroupID=create_User_Group($tmpGroup); + add_User_To_Group($tmpGroupID,$tmpUserID); + } + } + break; + case "PERM": + echo "Importing User Permissions is not yet implemented"; break; case "ITEM": echo "Importing Items is not yet implemented"; @@ -157,11 +176,6 @@ } table_begin(); table_row(array( - "Currently, The bulk loader, only loads Host Entries." - ), 0); - table_end(); - table_begin(); - table_row(array( 'Host Entry Format.', 'HOST,<Hostname>,<Host IP>,<Host Port>,<Host Status>,<Template Host>,<Zabbix Server>,<Host Group(s)><BR>'. ' <STRONG>HOST</STRONG>: This is the command to tell the bulk loader that this entry is a host<BR>'. @@ -175,6 +189,31 @@ '' ), 2); + table_row(array( + 'User Entry Format.', + 'USER,<User First Name>,<User Surname>,<Login Name>,<Password>,<URL>,<Auto Logout Time>,<Language>,<Screen Refresh Time>,<Host Group(s)><BR>'. + ' <STRONG>USER</STRONG>: This is the command to tell the bulk loader that this entry is a User<BR>'. + ' <STRONG>User First Name</STRONG>: This is the users first name<BR>'. + ' <STRONG>User Surname</STRONG>: This is the users last name<BR>'. + ' <STRONG>Login Name</STRONG>: This is the name the user will login with. NOTE: User will not be created if this is blank.<BR>'. + ' <STRONG>Password</STRONG>: This is the password that user will login with. If blank, this will default to the login name.<BR>'. + ' <STRONG>URL</STRONG>: This is the URL the user is redirected to upon login.<BR>'. + ' <STRONG>Auto Logout Time</STRONG>: This is the number of seconds before an idle user will be logged off. If blank, this will default to 900 seconds.<BR>'. + ' <STRONG>Language</STRONG>: This is the the language that that Zabbix will display to the user. If blank, this will default to en_gb. Valid Choices are;<BR>'. + ' > en_gb -- English<BR>'. + ' > fr_fr -- French<BR>'. + ' > de_de -- German<BR>'. + ' > it_it -- Itallian<BR>'. + ' > ja_ja -- Japanese<BR>'. + ' > lv_lv -- Latvian<BR>'. + ' > ru_ru -- Russian<BR>'. + ' > sp_sp -- Spanish<BR>'. + ''. + ' <STRONG>Screen Refresh Time</STRONG>: This is the number of seconds before monitoring pages will refresh. If blank, this will default to 30 seconds.<BR>'. + ' <STRONG>User Group(s)</STRONG>: This is a comma separated list of user groups that the user belongs to. If this contains one or more groups that are not in the Zabbix Server, the groups will be created and user added to those groups.<BR>'. + + '' + ), 2); table_end(); table_begin(); table_row(array( |
