我想知道人们用于管理服务器库存的不同做法。我指的inventory of servers
是跟踪服务器基本信息(如主机名、操作系统类型、管理 IP 地址)的数据库。
我能想到的一些解决方案
- 电子表格
- 微软访问
还有什么其他解决方案?这些解决方案的优缺点是什么?
答案1
这很简单,使用可以为你做到这一点的软件,根据我的经验,我已经使用过胃肠道疾病,它包含了您可能需要的所有详细信息,甚至更多。
您可以输入有关服务器的所有详细信息,例如 RAM、CPU、磁盘等,并为其添加参考 ID、其网络配置是什么、谁使用该服务器。
您可以创建用户帐户,通过提交支持单来提醒用户计算机是否出现问题,管理员将通过电子邮件收到通知,以便他可以立即答复或解决问题。并且您将拥有与计算机相关的所有问题的历史记录。
GLPI 是免费的开源软件,它有一个简单的网络界面,即使非技术人员也可以轻松使用它。
答案2
我使用过小型数据库甚至 csv 文件,并根据需要添加前端界面。例如,在 MySQL 数据库中添加一些表,并在前面添加一些 python 或 php 代码,以提供用户友好的搜索和修改界面。
当然,这一切都需要管理员熟悉这些工具,但这意味着其余用户群不必 a) 了解这些工具,b) 可以直接访问数据存储,或 c) 以与您相同的方式查看数据。您可以创建只读视图、添加身份验证、允许远程访问数据等。或者您可以什么都不做,只需让一个人维护一个 csv 文件。数据库更好,因为您可以在需要时添加字段,而无需对接口代码进行大幅度更改。
答案3
请尝试在服务器上使用以下 Visual Basic 脚本,并在 .csv 文件中提取主机名、品牌、型号、BIOS 版本、操作系统、序列号、CPU、内存和磁盘驱动器等信息。复制代码并将其保存为 .vbs 文件。您需要做的就是使用相应的路径修改第 6 行和第 7 行。文本文件必须具有要执行该脚本的服务器的主机名或 FQDN 名称。
希望这可以帮助。
Option Explicit
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Const PATH_TO_INPUT = "D:\MachineName.txt"
Const PATH_TO_OUTPUT = "D:\MachineInventory.csv"
Dim fso
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Dim shl
Set shl = WScript.CreateObject("WScript.Shell")
Dim input
Set input = fso.OpenTextFile(PATH_TO_INPUT)
Dim output
Set output = fso.CreateTextFile(PATH_TO_OUTPUT, True)
output.WriteLine "Hostname,Serial Number,Make,Model,BIOS Version,Operating System,CPU,Memory (MB),Disk Drives"
Dim wmiService
Dim wmiResults
Dim hostname
Dim make
Dim model
Dim biosversion
Dim operatingSystem
Dim serialNumber
Dim cpu
Dim memory
Dim drives
Dim line
Dim exec
Dim pingResults
While Not input.AtEndOfStream
line = input.ReadLine
hostname = ""
make = ""
model = ""
biosversion = ""
operatingSystem = ""
serialNumber = ""
cpu = ""
memory = ""
drives = ""
Set exec = shl.Exec("ping -n 2 -w 1000 " & line)
pingResults = LCase(exec.StdOut.ReadAll)
If InStr(pingResults, "reply from") Then
On Error Resume Next
Set wmiService = GetObject("winmgmts:\\" & line & "\root\CIMV2")
If Not Err.Number = 0 Then
output.WriteLine line & ",Error: " & Err.Description
WScript.Echo line & ",Error: " & Err.Description
On Error GoTo 0
Else
On Error GoTo 0
hostname = line
Set wmiResults = wmiService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
Dim item
For Each item In wmiResults
serialNumber = Trim(item.SerialNumber)
biosversion = Trim(item.SMBIOSBIOSVersion)
Next
Set wmiResults = wmiService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each item In wmiResults
make = Trim(item.Manufacturer)
model = Trim(item.Model)
Next
Set wmiResults = wmiService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each item In wmiResults
operatingSystem = Trim(item.Name)
operatingSystem = Split(operatingSystem, "|")(0)
memory = Round(Trim(item.TotalVisibleMemorySize) / 1024, 2)
Next
Set wmiResults = wmiService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each item In wmiResults
cpu = Trim(item.Name)
Next
Set wmiResults = wmiService.ExecQuery("SELECT * FROM Win32_LogicalDisk WHERE DriveType=3", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each item In wmiResults
drives = drives & Trim(item.DeviceID) & "" & Round(Trim(item.Size) / (1024^2), 2) & "; "
Next
output.WriteLine hostname & "," & serialNumber & "," & make & "," & model & "," & biosversion & "," & operatingSystem & "," & cpu & "," & memory & "," & drives
End If
Else
output.WriteLine line & ",No Response"
WScript.Echo line & ",No Response"
End If
Wend
output.Close
input.Close
Set wmiService = Nothing
Set wmiresults = Nothing