Hello there. I have a fully functional Cacti 0.8.6g install loaded on Windows XP with IIS. I am querying several servers using WMI/SNMP. I have a few servers that, for several reasons, can't be members of the domain. My SNMP stuff like CPU usage, logged in users, processes and NIC traffic are all working fine, but the two graphs that use WMI; memory usage and hard drive space, are not working at all. I am guessing that this is because these servers are in a workgroup instead of the domain. I am just wondering if there is a way to graph WMI stuff on servers that are not members of the domain, if that it is indeed my problem.
Thanks advance for any ideas anyone can lend.
-Chris
WMI outside of domain
Moderators: Developers, Moderators
- Diggit2001
- Cacti User
- Posts: 195
- Joined: Tue May 03, 2005 4:29 pm
- Location: MD, US
I think it's possible. You would have to modify your WMI script and then pass in the username/password you would use on the remote host. Then, you could specify a lcoal username for the machines not on the domain.
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
- Diggit2001
- Cacti User
- Posts: 195
- Joined: Tue May 03, 2005 4:29 pm
- Location: MD, US
Here is how you would modify the script: http://www.microsoft.com/technet/script ... y1213.mspx
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
-
- Cacti User
- Posts: 130
- Joined: Thu Mar 31, 2005 4:24 pm
- Location: Sydney, Asutralia
- Contact:
Heres some example code (VBSCRIPT) on how to do it --
Networkusername=""
Networkpassword=""
Hostname=WScript.Arguments.Item(0)
Instance=WScript.Arguments.Item(1)
OStype=WScript.Arguments.Item(2)
If Hostname="." Or Hostname="localhost" Then
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& Hostname & "\root\cimv2")
If OStype="2000" Then
Set colProcesses = objWMIService.ExecQuery( _
"SELECT * FROM Win32_PerfRawData_W3SVC_WebService" )
ElseIf OStype="2003" Then
Set colProcesses = objWMIService.ExecQuery( _
"SELECT * FROM Win32_PerfFormattedData_W3SVC_WebService" )
End If
Else
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(Hostname, _
"root\CIMV2", _
Networkusername, _
Networkpassword, _
"MS_409", _
"NTLMDomain:" + Hostname)
If OStype="2000" Then
Set colProcesses = _
objSWbemServices.ExecQuery("SELECT * FROM Win32_PerfRawData_W3SVC_WebService")
ElseIf OStype="2003" Then
Set colProcesses = _
objSWbemServices.ExecQuery("SELECT * FROM Win32_PerfFormattedData_W3SVC_WebService")
End If
End If
CurrentConnectionsCount=0
CurrentAnonymousUsersCount=0
CurrentNonAnonymousUsersCount=0
For Each objProcess in colProcesses
CurrentConnections = objProcess.CurrentConnections
CurrentAnonymousUsers = objProcess.CurrentAnonymousUsers
CurrentNonAnonymousUsers = objProcess.CurrentNonAnonymousUsers
CurrentConnectionsCount=CurrentConnectionsCount+CurrentConnections
CurrentAnonymousUsersCount=CurrentAnonymousUsersCount+CurrentAnonymousUsers
CurrentNonAnonymousUsersCount=CurrentNonAnonymousUsersCount+CurrentNonAnonymousUsers
Next
Wscript.Echo "CurrentConnections:" & CurrentConnectionsCount & " CurrentAnonymousUsers:" & CurrentAnonymousUsersCount & " CurrentNonAnonymousUsers:" & CurrentNonAnonymousUsersCount
Networkusername=""
Networkpassword=""
Hostname=WScript.Arguments.Item(0)
Instance=WScript.Arguments.Item(1)
OStype=WScript.Arguments.Item(2)
If Hostname="." Or Hostname="localhost" Then
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& Hostname & "\root\cimv2")
If OStype="2000" Then
Set colProcesses = objWMIService.ExecQuery( _
"SELECT * FROM Win32_PerfRawData_W3SVC_WebService" )
ElseIf OStype="2003" Then
Set colProcesses = objWMIService.ExecQuery( _
"SELECT * FROM Win32_PerfFormattedData_W3SVC_WebService" )
End If
Else
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(Hostname, _
"root\CIMV2", _
Networkusername, _
Networkpassword, _
"MS_409", _
"NTLMDomain:" + Hostname)
If OStype="2000" Then
Set colProcesses = _
objSWbemServices.ExecQuery("SELECT * FROM Win32_PerfRawData_W3SVC_WebService")
ElseIf OStype="2003" Then
Set colProcesses = _
objSWbemServices.ExecQuery("SELECT * FROM Win32_PerfFormattedData_W3SVC_WebService")
End If
End If
CurrentConnectionsCount=0
CurrentAnonymousUsersCount=0
CurrentNonAnonymousUsersCount=0
For Each objProcess in colProcesses
CurrentConnections = objProcess.CurrentConnections
CurrentAnonymousUsers = objProcess.CurrentAnonymousUsers
CurrentNonAnonymousUsers = objProcess.CurrentNonAnonymousUsers
CurrentConnectionsCount=CurrentConnectionsCount+CurrentConnections
CurrentAnonymousUsersCount=CurrentAnonymousUsersCount+CurrentAnonymousUsers
CurrentNonAnonymousUsersCount=CurrentNonAnonymousUsersCount+CurrentNonAnonymousUsers
Next
Wscript.Echo "CurrentConnections:" & CurrentConnectionsCount & " CurrentAnonymousUsers:" & CurrentAnonymousUsersCount & " CurrentNonAnonymousUsers:" & CurrentNonAnonymousUsersCount
- Diggit2001
- Cacti User
- Posts: 195
- Joined: Tue May 03, 2005 4:29 pm
- Location: MD, US
- Diggit2001
- Cacti User
- Posts: 195
- Joined: Tue May 03, 2005 4:29 pm
- Location: MD, US
OK, I got it. If anyone else is interested, here's the code I used:
my $wmipath = "root\\cimv2";
my $user = "username";
my $pwd = "password";
my $wmiwebloc = Win32::OLE->new('WbemScripting.SWbemLocator') ||
die "Cannot access WMI on local machine: ", Win32::OLE->LastError;
my $wmi = $wmiwebloc->ConnectServer($computer,$wmipath,$user,$pwd);
my $wmipath = "root\\cimv2";
my $user = "username";
my $pwd = "password";
my $wmiwebloc = Win32::OLE->new('WbemScripting.SWbemLocator') ||
die "Cannot access WMI on local machine: ", Win32::OLE->LastError;
my $wmi = $wmiwebloc->ConnectServer($computer,$wmipath,$user,$pwd);
Who is online
Users browsing this forum: No registered users and 2 guests