1. Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING) Click the link to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This message will disappear after you have made at least 12 posts. Thank you for your cooperation.

Script to show occupancy on stgpool for inactive nodes

Discussion in 'Scripting' started by redplumptomato, Nov 27, 2012.

  1. redplumptomato

    redplumptomato New Member

    Joined:
    Aug 21, 2012
    Messages:
    69
    Likes Received:
    0
    Hi there,

    We have this script (which I got from another site) which shows us node data grouped by stgpool. However, I'd like to know the occupancy of all nodes, grouped by stgpool, but, inactive only.

    Here is what we use now:
    SELECT node_name, filespace_name, stgpool_name, SUM(logical_mb) AS "Total MB" FROM occupancy WHERE node_name='NOCD1' GROUP BY node_name, filespace_name, stgpool_name ORDER BY filespace_name

    How can I get the above to show nodes that have not accessed the server in 30 days or more?
     
  2.  
  3. ChrisRees

    ChrisRees Senior Member

    Joined:
    Jul 24, 2008
    Messages:
    538
    Likes Received:
    13
    Occupation:
    Storage Management Person
    Location:
    Birmingham, UK
    Hi

    This should do what you want..

    SELECT aa.node_name, bb.filespace_name, bb.stgpool_name, SUM(bb.logical_mb) AS "Total MB" FROM nodes aa, occupancy bb where aa.lastacc_time<=(current_timestamp - 30 days) and aa.node_name=bb.node_name group by aa.node_name, bb.filespace_name, bb.stgpool_name ORDER BY bb.filespace_name

    Hope that helps
     
  4. redplumptomato

    redplumptomato New Member

    Joined:
    Aug 21, 2012
    Messages:
    69
    Likes Received:
    0
    FANTASTIC!!!

    Exactly what I was looking for!
     

Share This Page