PDA

View Full Version : Some clues on Windows monitoring (WMI)


naparuba
6th May 2008, 12:42
Hi, I post some WMI requests that are quite usefull to me to monitors windows systems. You can use theses request with tools like Nc_net or nrpe_nt. Some requests are not ok with w2k.

See if all automatic services are up:
SELECT Name,State,StartMode FROM Win32_Service WHERE StartMode="Auto"
The only exeption I know is SysmonLog, it's in automatic mode but sopped. You can make it a manual service.

Cpu load:
SELECT LoadPercentage FROM Win32_Processor
>90%=problem

Disk I/O:
SELECT Name,DiskReadsPersec,DiskReadBytesPersec,DiskWrite sPersec,DiskWriteBytesPersec FROM Win32_PerfFormattedData_PerfDisk_PhysicalDisk
It's just for graph. not w2k.

Disk queue lenght:
SELECT Name,CurrentDiskQueueLength FROM Win32_PerfFormattedData_PerfDisk_PhysicalDisk
>2 = disks too slow.

Disk space:
SELECT Name,FreeSpace,Size FROM Win32_LogicalDisk WHERE drivetype=3 and volumename!='Swap'
change Swap with the partition label of your swap partition (if you do not have a swap partition, create one :) )

Physical memory usage:
SELECT FreePhysicalMemory,TotalVisibleMemorySize FROM Win32_OperatingSystem
Then:
$usedPhysical = $totalvisible - $freephysical;
$pctPhysicalUsed = $usedPhysical * 100 / $totalvisible;

% of network brandwith use:
SELECT Name,BytesTotalPersec,CurrentBandwidth FROM Win32_PerfFormattedData_Tcpip_NetworkInterface
Too hight? too much network access.

Network interface usage:
SELECT DatagramsReceivedPersec,DatagramsSentPersec,Fragme ntationFailures FROM Win32_PerfFormattedData_Tcpip_IPv4
Just for graphs.

Network queue:
SELECT Name,OutputQueueLength FROM Win32_PerfFormattedData_Tcpip_NetworkInterface
>2? too much network access

Processor queue:
SELECT ProcessorQueueLength FROM Win32_PerfFormattedData_PerfOS_System
>10 = too much load on the server

Processor usage:
SELECT PercentInterruptTime,PercentDPCTime,PercentPrivile gedTime Win32_PerfFormattedData_PerfOS_Processor WHERE Name='_Total'
*PercentInterruptTime > 50%? too much network I/O
*PercentPrivilegedTime > 20%? too much disk I/O

Swap usage:
SELECT AllocatedBaseSize,CurrentUsage FROM Win32_PageFileUsage
Swap? bad bad bad. (>20%)

reboot (uptime):
SELECT SystemUpTime FROM Win32_PerfFormattedData_PerfOS_System
<3600= reboot in the previous hour

File creation:
SELECT LastModified FROM CIM_Datafile WHERE name="C:\myfile.txt"
Too see the creation date of a file

If you have some others, I take :)


Nap

ragkiki
30th March 2009, 12:55
comment on s'en sert de tout ca ?
ca marche comment ? quel soft ?

naparuba
30th March 2009, 13:57
NSClient++ a un module WMI.

Tu peux aussi passer par l'appel à un script VB avec nrpe_nt (c'est ce que je préfère)

Ou enfin enfin utiliser une application "proxy" pour WMI: un service fonctionne avec un compte capable de faire les requêtes (autant de dire que les droits sont élevé) sur une mahcine de ton domaine, puis elle effctue les requêtes à distances.

nunki
18th May 2009, 18:01
Bonjour!

J'ai testé la requête concernant les IO des disques. Mais, en résultat, je n'ai que des valeurs à 0. Même quand je fais travailler mon disque! Il n'y aurai pas une autre table permettant d'obtenir une telle information?

Merci d'avance