如何监控网络系统?
我想使用 c# 监控网络中的系统,下面是监控
- 远程系统状态的列表(登录、注销、关闭)
- 关闭/重新启动/注销远程系统
i would like to monitor my systems in my network using c#, below is the list of things to monitor
- Status of remote system(logged in, logged out, turned off)
- Shutdown/reboot/logoff remote system
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个广泛的问题。您使用 SNMP 吗?如果这些是 Windows 计算机,您可以使用 WMI。这两项都可以通过 WMI 轻松完成。
您可能会发现此链接对于基本 WMI 很有用信息。
此处是 WMI 参考。
本质上,您可以想到您喜欢的任何系统信息,然后搜索如何使用 WMI 检索它。如果您找到 VBScript 的示例(大多数示例可能是针对该示例进行编码的),这并不重要,您可以轻松地将其转换为 C#。
或者,您可以使用 SNMP,它有点复杂并且需要额外的设置。
另一种可能性是编写您自己的代码以使用实际的 API 调用来查询各种信息,其工作量比 WMI 多,但设置比 SNMP 少。这对于大多数事情来说都太过分了,尽可能坚持使用 WMI。
This is a broad question. Are you using SNMP? If these are Windows computers you can use WMI. Both of those items can be done simply with WMI.
You may find this link useful for basic WMI information.
Here is a WMI reference.
Essentially, you can think of any piece of system information you like and then search for how to retrieve it using WMI. It doesn't matter if you find samples for VBScript (which is what most examples probably will be coded for), you can convert that to C# easy.
Alternatively, you can use SNMP, which is a bit more complex and requires extra setup.
Another possibility, and more work than WMI but less setup than SNMP, is to write your own code to query various pieces of information using the actual API calls. This is overkill for most things, stick with WMI where you can.
您应该能够使用 WMI 和 System.Management 命名空间监视远程系统的状态。 此处有一篇介绍性文章。
要强制删除关机、重新启动和注销,最简单的方法可能是使用 Sysinternals
psshutdown
(详细信息)。您可以通过将其作为外部进程运行来从 C# 中使用它。You should be able to monitor the status of remote systems using WMI and the System.Management namespace. An introductory article is here.
To force remove shutdown, reboots and logoff, probably the easiest way is to use the Sysinternals
psshutdown
(details). You can use this from C# by running it as an external Process.