将进程信息写入本地系统上的文件的系统间缓存例程?
我有兴趣创建一个例程来查询当前正在运行的缓存进程,然后将此信息写入文件。在 Cache 2008.2 中如何做到这一点?
I am interested in creating a routine that would query the currently running cache processes and then write this information to a file. How could this be done in Cache 2008.2?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PERFMON 可能就是您正在寻找的。该应用程序有自己的 UI,但您也可以作为 API 直接调用它的函数。
检查缓存文档中的“缓存监控指南”。这将为您提供 PERFMON 文档以及其他系统监控工具的文档的链接。
您可能会在类参考中的包 %SYSTEM、%SYS 和 %Monitor 下找到有用的内容。
对于某些进程信息,您可能需要向操作系统提供信息。在这种情况下,请检查 $ZF 函数。这将允许您从缓存内调用操作系统级命令。
哦,您可能需要考虑将过程数据保存在缓存数据库中,而不是将其转储到文件中。也就是说,创建一个持久类,其属性与您要捕获的每个流程属性相对应,然后编写代码来创建、填充和保存该类的实例,从 PERFMON 或您选择的任何其他源获取数据。
如果您这样做,您可以使用缓存 SQL 生成您需要的任何类型的报告。 (Cache 将自动生成与您的持久类相对应的 SQL 表。)Cache 支持 ODBC,因此您可以使用 Crystal Reports 或 Access 等外部工具来完成该部分。
显然,这比仅仅将数据回显到文件需要更多的工作,但是如果您要对信息做任何有趣的事情,则需要某种结构。
PERFMON might be what you're looking for. That's app with it's own UI, but you can call it's functions directly too, as an API.
Check the Cache docs for "Cache Monitoring Guide". That will give you links to PERFMON docs, as well as docs for other system monitoring tools.
You might find something useful in the Class Reference, under packages %SYSTEM, %SYS, and %Monitor.
For some process info you might need to shell out to the OS. In that case check into the $ZF function. That will let you invoke os-level commands from within Cache.
Oh, and you might want to consider saving the process data within the Cache DB, rather than dumping it out to a file. That is, create a Persistent Class with Properties corresponding to each process attribute that you want to capture, then write code to create, populate, and save instances of that class, taking the data from PERFMON or whatever other source you choose.
If you do that you can use Cache SQL to generate whatever kind of report you need. (Cache will automatically generate a SQL Table corresponding to your Persistent Class.) Cache supports ODBC, so you can use an external tool like Crystal Reports or Access for that part.
Obviously that will be more work than just echoing data to a file, but some kind of structure will be needed if you're going to do anything interesting with the information.