Ad Widget

Collapse

Low Level Discovery Physical Disk Windows Performance Monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vintagegamingsystems
    Member
    • Jun 2013
    • 57

    #1

    Low Level Discovery Physical Disk Windows Performance Monitoring

    If anyone is interested, the contents of this repository will allow you low level discover and monitor individual disks on a Windows machine. Let me know if any of the returned metrics are incorrect.

    GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.
  • ArtemK
    Senior Member
    • May 2013
    • 232

    #2
    wow, that's what I wanted to implement on this week. Thank you very much

    Comment

    • vintagegamingsystems
      Member
      • Jun 2013
      • 57

      #3
      Writing Code

      I need to write the code so that it takes into account multiple disk partitions on the disks. If you have multiple disk partitions that have drive letters assigned, the items will become unsupported.

      Comment

      • vintagegamingsystems
        Member
        • Jun 2013
        • 57

        #4
        Fixed

        It should now be working with multiple partitions with drive letters. I hope you all enjoy.

        Comment

        • vintagegamingsystems
          Member
          • Jun 2013
          • 57

          #5
          Total Rewrite

          Works great now.
          Code:
          $drives = typeperf -qx physicaldisk | findstr /r "Idle" | select-string -pattern "[0-9]\s[a-z]:((\s[a-z]:)+(\s)?)?" -allmatches -list | select matches
          write-host "{"
          	write-host " `"data`":[`n"
          	foreach ($perfDrives in $drives)
          		{
          		$line= "{ `"{#DISKNUMLET}`" : `"" + $perfDrives.matches + "`" },"
          		write-host $line
          		}
          	write-host
          	write-host " ]"
          	write-host "}"
          	write-host
          Last edited by vintagegamingsystems; 15-10-2013, 17:31.

          Comment

          • Grandpa
            Junior Member
            • Jul 2015
            • 1

            #6
            Small update

            In v.2.4 you'll get "invalid JSON (...)" error. The problem is the comma in the last line. This would do the job:
            Code:
            $drives = typeperf -qx physicaldisk | findstr /r "Idle" | select-string -pattern "[0-9]\s[a-z]:((\s[a-z]:)+(\s)?)?" -allmatches -list | select matches
            
            write-host "{"
            	write-host " `"data`":[`n"
            
            	#temp variable
            	$temp = 1
            	
            	foreach ($perfDrives in $drives)
            		{
            			if ($temp -eq 0){
            			Write-Host ",";
            		} 
            		else{
            			$temp = 0;
            		}
            		$line= "{ `"{#DISKNUMLET}`" : `"" + $perfDrives.matches + "`" }"
            		Write-Host -NoNewline $line
            		}
            	
            	# Close the JSON message
            	write-host
            	write-host " ]"
            	write-host "}"
            	write-host

            Comment

            Working...