使用MOF来扩展hardware inventory -- 动态数据 -- 补充2 -- 其它名称空间中的信息的收集
2010-04-08 14:42
281 查看
Client缺省只收集 CIMV2 名称空间中的WMI类实例的信息,对于其它名称空间中的信息,可以有两个方法来解决。
1. SMS 2003 高级客户端(SCCM2007 客户端也相同)支持从其它名称空间收集信息,但是在报告类中要加入标示符。例如下面的例子收集 root/WMI 名称空间中的 registeredGUIDs 类的实例信息,报告类中要指明名称空间信息。这里略去了数据类部分
#pragma namespace ("////.//root//CIMv2//sms")
[SMS_Report(TRUE),
SMS_Group_Name("Registered GUIDs"),
SMS_Class_ID("Microsoft|Registered GUIDs|1.0"),
Namespace("////////.////root////WMI")]
class RegisteredGuids : SMS_Class_Template
{
[SMS_Report(TRUE), key]
string InstanceName;
[SMS_Report(TRUE)]
boolean Active;
[SMS_Report(TRUE)]
uint32 GuidType;
[SMS_Report(TRUE)]
uint32 LoggerId;
[SMS_Report(TRUE)]
uint32 EnableLevel;
[SMS_Report(TRUE)]
uint32 EnableFlags;
[SMS_Report(TRUE)]
boolean IsEnabled;
};
2. 还有一种方式是通过 view provider来实现。view provider 是 WMI本身提供的provider,用于将其它名称空间的信息映射到CIMV2中。这原本是SMS 2003 legacy client使用的方式,但是也很实用。尤其是一些自带provider的程序本身就在WMI中创建了自己的名称空间并创建自己的类和实例,例如SQL Server,Exchange等。 SQL 2000 的provider在光盘上要手工安装,SQL2005以后是安装过程自行安装的。
#pragma namespace("////.//Root//CIMV2")
instance of __Win32Provider as $DataProv
{
Name = "MS_VIEW_INSTANCE_PROVIDER";
ClsId = "{AA70DDF4-E11C-11D1-ABB0-00C04FD9159E}";
ImpersonationLevel = 1;
PerUserInitialization = "True";
};
instance of __InstanceProviderRegistration
{
Provider = $DataProv;
SupportsPut = True;
SupportsGet = True;
SupportsDelete = True;
SupportsEnumeration = True;
QuerySupportLevels = {"WQL:UnarySelect"};
};
[union, ViewSources{"Select * from MSSQL_Database"},
ViewSpaces{"////.//root//MicrosoftSQLServer"}, Dynamic : ToInstance,
provider("MS_VIEW_INSTANCE_PROVIDER")]
-----------------------------------------------上面是实例化一个provider来映射MicrosoftSQLServer名称空间到CIMV2
class SQL_Databases
{
[PropertySources("Size") ] sint32 Size;
[PropertySources("SQLServerName"), key ] string SQLServerName;
[PropertySources("Name"), key ] string Name;
[PropertySources("SpaceAvailable") ] sint32 SpaceAvailable;
};
------------------------------------------------这段是数据类和数据类实例的定义
#pragma namespace("////.//root//CIMv2//sms")
[SMS_Report(TRUE),
SMS_Group_Name("SQL Database"),
SMS_Class_ID("MICROSOFT|SQLDatabase|1.0")]
class SQL_Databases : SMS_Class_Template
{
[SMS_Report(TRUE),key]
string SQLServerName;
[SMS_Report(TRUE),key]
string Name;
[SMS_Report(TRUE)]
sint32 Size;
[SMS_Report(TRUE)]
sint32 SpaceAvailable;
};
---------------------------------------------- 上面这段是报告类的定义
1. SMS 2003 高级客户端(SCCM2007 客户端也相同)支持从其它名称空间收集信息,但是在报告类中要加入标示符。例如下面的例子收集 root/WMI 名称空间中的 registeredGUIDs 类的实例信息,报告类中要指明名称空间信息。这里略去了数据类部分
#pragma namespace ("////.//root//CIMv2//sms")
[SMS_Report(TRUE),
SMS_Group_Name("Registered GUIDs"),
SMS_Class_ID("Microsoft|Registered GUIDs|1.0"),
Namespace("////////.////root////WMI")]
class RegisteredGuids : SMS_Class_Template
{
[SMS_Report(TRUE), key]
string InstanceName;
[SMS_Report(TRUE)]
boolean Active;
[SMS_Report(TRUE)]
uint32 GuidType;
[SMS_Report(TRUE)]
uint32 LoggerId;
[SMS_Report(TRUE)]
uint32 EnableLevel;
[SMS_Report(TRUE)]
uint32 EnableFlags;
[SMS_Report(TRUE)]
boolean IsEnabled;
};
2. 还有一种方式是通过 view provider来实现。view provider 是 WMI本身提供的provider,用于将其它名称空间的信息映射到CIMV2中。这原本是SMS 2003 legacy client使用的方式,但是也很实用。尤其是一些自带provider的程序本身就在WMI中创建了自己的名称空间并创建自己的类和实例,例如SQL Server,Exchange等。 SQL 2000 的provider在光盘上要手工安装,SQL2005以后是安装过程自行安装的。
#pragma namespace("////.//Root//CIMV2")
instance of __Win32Provider as $DataProv
{
Name = "MS_VIEW_INSTANCE_PROVIDER";
ClsId = "{AA70DDF4-E11C-11D1-ABB0-00C04FD9159E}";
ImpersonationLevel = 1;
PerUserInitialization = "True";
};
instance of __InstanceProviderRegistration
{
Provider = $DataProv;
SupportsPut = True;
SupportsGet = True;
SupportsDelete = True;
SupportsEnumeration = True;
QuerySupportLevels = {"WQL:UnarySelect"};
};
[union, ViewSources{"Select * from MSSQL_Database"},
ViewSpaces{"////.//root//MicrosoftSQLServer"}, Dynamic : ToInstance,
provider("MS_VIEW_INSTANCE_PROVIDER")]
-----------------------------------------------上面是实例化一个provider来映射MicrosoftSQLServer名称空间到CIMV2
class SQL_Databases
{
[PropertySources("Size") ] sint32 Size;
[PropertySources("SQLServerName"), key ] string SQLServerName;
[PropertySources("Name"), key ] string Name;
[PropertySources("SpaceAvailable") ] sint32 SpaceAvailable;
};
------------------------------------------------这段是数据类和数据类实例的定义
#pragma namespace("////.//root//CIMv2//sms")
[SMS_Report(TRUE),
SMS_Group_Name("SQL Database"),
SMS_Class_ID("MICROSOFT|SQLDatabase|1.0")]
class SQL_Databases : SMS_Class_Template
{
[SMS_Report(TRUE),key]
string SQLServerName;
[SMS_Report(TRUE),key]
string Name;
[SMS_Report(TRUE)]
sint32 Size;
[SMS_Report(TRUE)]
sint32 SpaceAvailable;
};
---------------------------------------------- 上面这段是报告类的定义
相关文章推荐
- 使用MOF来扩展hardware inventory -- 动态数据 -- 补充
- 使用MOF来扩展hardware inventory -- 动态数据
- 创建表空间以及用户,授予权限,查看表空间名称及大小,物理文件的名称及大小,数据库的创建日期和归档方式,数据库的版本,数据库库对象,表空间的使用情况,表空间读写
- jQuery EasyUI使用教程之在数据网格中扩展行显示详细信息
- 检查存储结构-控制、REDO日志、表空间使用情况、数据文件等信息脚本--HTML
- C++第4周项目5 - 数组作数据成员(扩展1动态开辟空间)
- 使用MOF来扩展hardware inventory -- 静态数据
- ASM时的OFM特性对影的建数据文件名称的影响及为SYSTEM表空间的数据文件使用别名
- SQL Server 2008空间数据应用系列十:使用存储过程生成GeoRSS聚合空间信息
- 学生类封装 , (链表)插入排序成绩 无动态数组 ,动态开辟空间 以及静态函数,数据成员的使用
- 【动态代理】使用动态代理解析注解原数据,获取接口信息
- SQL Server 2008空间数据应用系列十:使用存储过程生成GeoRSS聚合空间信息
- mysql 查询表的行数和空间使用及其它信息
- FormData表单数据对象(h5)快速收集表单信息(注册登录时使用的)
- JSP Web 页面收集用户IP地址信息-聚合数据IP地址数据接口的使用
- SQL Server 2008空间数据应用系列十:使用存储过程生成GeoRSS聚合空间信息
- Struts2 中,相同的验证规则,如何使用同一条异常响应信息,及动态调用各自对应的名称?
- 如何防止数据恢复及内存硬盘空间信息的利用造成损失(工具链:secure-delete)
- ORACLE用户常用数据字典的查询使用方法(转载收集)
- 一个int数组, 比如 array[],里面数据无任何限制,要求求出 所有这样的数array[i],其左边的数都小于等于它,右边的数都大于等于它。能否只用一个额外数组和少量其它空间实现