3 Replies Latest reply on Dec 7, 2011 3:17 PM by Catalysttgj

    query for hard drives space

    Apprentice

      Hello

       

      I need to a query to show total available space in all availabe drivers in xyz domain

       

      plus space less then 5000 MB or 5 GB

       

      working on LDMS 9.0 Sp2

       

      Cheers

        • 1. Re: query for hard drives space
          Catalysttgj Expert

          Tall order for a straight LDMS query, unless you can handle lots of columns of output, and then summing it all up in a spreadsheet?

           

          Basically for finding logical disks with a certain amout of available storage, its straight forward, but you might be wanting some magical number to pop out. If so, you'll end up coding this in SQL.

           

          Here's a simple query to identify every device with less then 5000 MB for the "C" Drive.

           

          "Computer"."Mass Storage"."Logical Drive"."Drive Letter" = "C"

          AND "Computer"."Mass Storage"."Logical Drive"."Available Storage" < "5000.0 MB"

           

          You might want to cover several drive letters by doing a compound query like this: (expanding based on additional drive letters)

           

          ("Computer"."Mass Storage"."Logical Drive"."Drive Letter" = "C"

          AND "Computer"."Mass Storage"."Logical Drive"."Available Storage" < "5000.0 MB")

          (OR "Computer"."Mass Storage"."Logical Drive"."Drive Letter" = "D"

          AND "Computer"."Mass Storage"."Logical Drive"."Available Storage" < "5000.0 MB")

          (OR "Computer"."Mass Storage"."Logical Drive"."Drive Letter" = "E"

          AND "Computer"."Mass Storage"."Logical Drive"."Available Storage" < "5000.0 MB")

           

          This might be precarious, since you may have a lot of logical drives that you would want to see, and Mac and Unix stuff (if you have any) might not work with this particular arrangement.

           

          For the output columns you'd likely want to include the same columns of information that you're evaluating against:

          Computer"."Mass Storage"."Logical Drive"."Available Storage"

           

          Dont' forget you'll need to "Qualify" each column and Name each column something unique if they are the same type of information, if you have more than one that you want to see in the output. After adding a column, any that CAN be qualified, the qualify button will be available just above the output columns (bottom right) frame. You'll only be able to add one at a time, and then you'll need to name it, and qualify it before you can add another.

          • 2. Re: query for hard drives space
            Apprentice

            Thanks for the Quick reply

             

            here is the details

             

            Here's a simple query to identify every device with less then 5000 MB for the "C" Drive.

             

            "Computer"."Mass Storage"."Logical Drive"."Drive Letter" = "C"

            AND "Computer"."Mass Storage"."Logical Drive"."Available Storage" < "5000.0 MB"

             

             

             

             

             

            test2query.JPG

            Note: if i use OR operator i do not get any result and if i use AND operator i get  this result

            Test2result.JPG

            My question : is this the correct result  (Here's a simple query to identify every device with less then 5000 MB for the "C" Drive.)

             

            let me know where i am wrong

             

            please advise

             

            Thanks

            • 3. Re: query for hard drives space
              Catalysttgj Expert

              Think this scenario through with these statements.

               

              1.) I want to look for a C drive.

               

              2.) OR... I want to look for available storage less than an amount.

               

              3.) AND... I want it to be in a certain place.

               

               

               

              A C drive OR less than a certain amount? Does that seem logical? This is how you figure out if you're queries are right or wrong. Think them through step by step, and consider how each operator affects each statement in ORDER. Meaning that without proper grouping, things are just evaluated in the order they appear. Remember, that when using OR's you must almost always group at some point, while AND's are generally all inclusive, meaning you want ALL the items to be true at the same time.

               

              Consider if you wanted to look for different drive letters, you would never put AND's between them, unless you want only devices to appear that had both drives at the same time, and if you further were going to look at specifics about each drive letter, you'd put AND's around the items associated to each drive letter, group them, and then put OR's in between the different drive letter specifics, as i had demonstrated in the first reply.

               

               

              Here's some basic logic of queries.

               

              example 1:

               

              (item 1

              AND item 2

              AND item 3)

              (OR item 4

              AND item 5

              AND item 6)

               

              in the above case, you want the first three items to be true at the same time, OR you want the next three items to be true.

              If either the first three OR the second three are true, then you will get a result. In this case grouping is done on the first three items, and the second three items.

               

              example 2:

               

              item1

              ((AND item2

              AND item3)

              (OR item4

              AND item5))

               

              In this scenario item 2 and item 3 must be true, OR item 4 and item 5 must be true, BUT in both cases item 1 MUST also be true.

              If item 1 is not true, then it doesn't matter what the state of the other items is, since its an AND separating item 1 from the rest of the group. Notice the double grouping. To make this work you must group item 2 and item 3, then group item 4 and item 5, and then finally selecting items 2 through 5, grouping those altogther. This way the AND operator separating item 1 from item 2 is actually separating item 1 from the following 4 items treating them as one thing.

               

              Consider if they weren't double grouped like this:

               

              item1

              (AND item2

              AND item3)

              (OR item4

              AND item5)

               

              In this case item 1, 2, and 3 must be true, OR item 4 and 5 must be true. Without the double grouping, item 1 2 and 3 are just together. The separation only occurs at the first OR operator in the list, so this query would most likely produce some weird results, if the true spirit was for the query to really look like example 1 above. Basically the groupings act the same way as they do in algebra to a point. The group is like a sub query in a query, and must be evaluated unto itself. The trick is realizing that the LANDesk UI is not very intuitive in its display of the line items. If it were, it would do a better job of separating the operators in a way that would make it more obvious to the user.

               

              In my opinion it would be better if the query in example 1 looked more like this in a landesk query:

               

              item1

              AND

              ((item2

              AND item3)

              OR

              (item4

              AND item5))

               

              Just this slight improvement would at least make it more clear as to how the operators should be considered, but then again this is maybe splitting hairs.

               

              I don't know if this will help you make heads or tails of it, but hopefully this gets you in the right direction, so that you can make queries with confidence. You are going to eventually run into scenarios where you can't do certain things, and it will annoy you, but you're not quite there YET!