DX Unified Infrastructure Management

  • 1.  change cdm disk setting without re-initialising and losing custom settings

    Posted Jan 09, 2013 01:17 AM

    Have you ever wanted to make a change to one setting on all disk configs but don't want to delete the existing config and re-apply some new default because you have a lot of minor customisations out there. Some drives have been deactivated, many thresholds have been tweaked etc.

     

    Here is a script that can change just one setting in your deployed cdms without altering anything else. I ran it direct from the nas lua script editor. It did give a timeout in the GUI but the thread kept on running and the job got done. It could be run from the scheduler so it wrote to nas.log, or with a little work run under sdk/nsa.

     

    Sorry about the indentation. the cut and paste lost all my leading spaces, yuck :smileysad: My re-format may have introduced minor errors, caveat emptor. 

     

    -- change some disk settings without re-discovering and losing existing settings

     

    -- put the setting you wish to change in here and the desired value
    -- this example sets disk usage in MB active
    key = "qos_disk_usage"
    value = "yes"

     

    -- set the param pds for getting cdm configs
    local getarg = pds.create()
    pds.putString(getarg, "name", "cdm")

     

    -- Find hubs
    local list = nimbus.request("hub", "gethubs")
    for _,hub in pairs (list.hublist) do
       print ("Finding Robots on "..hub.name)
       local list,rc = nimbus.request(hub.addr, "getrobots")
       if rc == 0 then
         for _,robot in pairs (list.robotlist) do
           print (" ",robot.name)
           local cdm, rc = nimbus.request(robot.addr.."/controller", "probe_config_get", getarg)
           if rc == 0 then

             print (" Got cdm config from ",robot.name)

             for section,rec in pairs (cdm) do
                local changes = 0
                if rec.disk ~= nil then -- is this a disk 'root' section?
                   if rec.qos_disk_usage == value then
                      print (section, " key: ",key," already set to ",value)
                   else
                      local setargs = pds.create()
                      pds.putString (setargs, "name", "cdm")
                      pds.putString (setargs, "section", section)
                      pds.putString (setargs, "key", key)
                      pds.putString (setargs, "value", value)
                      _, rc = nimbus.request(robot.addr.."/controller", "probe_config_set", setargs)
                   if rc == 0 then
                      print (section," changed OK")
                      changes = changes + 1
                   else
                      print (section," change failed")
                   end
                end
             end
             if changes ~= 0 then -- restart the probe
                sleep (500) -- give it a moment to write
                nimbus.request(robot.addr.."/cdm", "_restart")
             end
            end
          else
             print (" Failure getting cdm config from ",robot.name)
          end

        end

      else
         print (" No response or bad response from this hub. rc = ",rc)
      end
    end



  • 2.  Re: change cdm disk setting without re-initialising and losing custom settings

    Posted Mar 27, 2015 11:57 AM

    How would I modify this such that I can change the disk thresholds for currently monitored disks?  For example:

     

    Based on your script, it's just looking for the key of qos_disk_usage... In my case the key of active=yes is almost everywhere within the probe.  I just want to change it under the section for the drive letter and the threshold under that drive letter section.

     

    <disk>

       interval = 15 min

       samples = 4

       <alarm>

          active = yes

          <fixed>

             <E:\>

                active = yes

                description = File system E:\

                disk = \Device\HarddiskVolume3

                percent = yes

                qos_disk_usage = no

                qos_disk_usage_perc = no

                inode_percent = yes

                qos_inode_usage = no

                qos_inode_usage_perc = no

                delta_percent = no

                delta_calculate_all = yes

                delta_type = both

                qos_disk_delta = no

                <error>

                  active = yes

                   threshold = 10

                   message = DiskError

                </error>

                <warning>

                   active = no

                   threshold = 20

                   message = DiskWarning

                </warning>

                <inode_error>

                   active = no

                   threshold = 10

                   message = InodeError

                </inode_error>

                <inode_warning>

                   active = no

                   threshold = 20

                   message = InodeWarning

                </inode_warning>

                <missing>

                   active = yes

                   message = DiskMissing

                </missing>

                <delta_error>

                   active = no

                   threshold = 10

                   message = DeltaError

                </delta_error>

                <delta_warning>

                   active = no

                   threshold = 8

                   message = DeltaWarning

                </delta_warning>

             </E:\>



  • 3.  Re: change cdm disk setting without re-initialising and losing custom settings

    Posted Mar 27, 2015 04:18 PM

    What prevents you from doing this with a CFX? I believe with the "edit" flag/verb you should be alright.

     

    -jon



  • 4.  Re: change cdm disk setting without re-initialising and losing custom settings

    Posted Mar 27, 2015 06:56 PM

    For existing file systems, you need to know the name of the drive path. The script does it for all known file systems in the existing config it appears.

     

    I do something similar myself. On top of this we use user_tag_1 to define the purpose of the server. That way one can easily identify the list of servers to do a task like "change disk HWM to 97% for all SQL servers"

     

    -Garin



  • 5.  Re: change cdm disk setting without re-initialising and losing custom settings

    Posted Mar 28, 2015 02:46 AM

    Yeah true. I guess for windows "simpe" disks like C: D: etc cfx is alright. But if you have mountpoints etc, it'll be harder to include all disks.



  • 6.  Re: change cdm disk setting without re-initialising and losing custom settings

    Posted Mar 30, 2015 11:01 AM

    Right, nothing prevents me from using a cfx.. The issue arises where I have a system with 3 monitored disks(where there may be 5 on the actual box)  Deploying the cfx to clear the fixed section forces a re-discovery and will then add ALL disks into monitoring.  So I want to basically say for anything that is currently monitored, ensure there is a high and low threshold set for the disk at specific thresholds, and then thus that requires a special cfx for each box (given the monitored drives) so it knows which disks to modify.