DX Infrastructure Manager

Expand all | Collapse all

How to alert on Robot left in Maintenance mode?

Jump to Best Answer
  • 1.  How to alert on Robot left in Maintenance mode?

    Posted 06-17-2015 06:59 AM

    Hi all,

     

    Does anyone know of a way to alert on Robots that have been left in maintenance mode for X period of time?

     

    We have had a few occasions where Analysts have left Servers in Maintenance mode by accident.  They have set maintenance mode until "next year" for example because they are not sure how long a particular piece of work will take, but then forget to click the "Leave maintenance mode now" button..

     

    Thanks in advance!

    Sam



  • 2.  Re: How to alert on Robot left in Maintenance mode?

    Posted 06-17-2015 01:59 PM

    Hi,

     

    I really don't think there' a built in method for doing this. Chances are you can get it from robotlist callback on hub with details turned up to 3. If not there, you'll have to go to the robot itself. That being said, I do have the same problem myself, people set the maintenance mode for a year or something of the sort. I think this is really bad practice and try to get people to stop doing it. As I'm building a new UIM environment, I have disabled the ability to use the Infrastructure Manager, or old, maintenance mode. It is kind of better than the new "USM" maintenance mode, but the new one does bring some good things with it, such as maintenance periods being saved in the database. If you migrated to use that as well, you could rather easily build a SQL query to keep an eye on the maintenance windows people define.

     

    -jon



  • 3.  Re: How to alert on Robot left in Maintenance mode?
    Best Answer

    Posted 11-21-2018 06:07 PM

    Hi Jon,

     

    I finally got round to looking into this properly.  Here's a script you can couple with Logmon to generate alerts for devices in maintenance.  It also needs NEXEC setting up to delete the file (MYSQL limitation).

     

    --Requires - NEXEC Profile to delete file created by SQL
    --Recommended - Couple with Logmon to draw out the details into an alert
    --Actions Nexec command to remove old SQL output file - Deletes file that is about to be created by NEXEC (Set this up)
    i = 1
    probename = "nexec"
    probeaddr1 = "/PATH/TO/PROBE/nexec"
    args = pds.create()
    pds.putString(args,"profile","NEXEC_PROFILE_NAME")
    while i <= 4 do
    reply,rc = nimbus.request(probeaddr1,"run_profile",args)
    if rc == NIME_OK then break end
    i = i + 1
    sleep(15)
    end
    pds.delete(args)
    --Open DB
    database.open("provider=nis;database=nis;driver=none")
    --Dump Tables into readable format
    function tdump(t)
    local function dmp(t, l, k)
    if type(t) == "table" then
    print(string.format("%s%s:", string.rep(" ", l*2), tostring(k)))
    for k, v in pairs(t) do
    dmp(v, l+1, k)
    end
    else
    print(string.format("%s%s:%s", string.rep(" ", l*2), tostring(k), tostring(t)))
    end
    end
    dmp(t, 1, "Maintenance Monitor")
    end
    --SQL Query to write to new file
    query = database.query("SELECT distinct cmcs.name, ms.schedule_name, mw.start_time, mw.end_time from MAINTENANCE_WINDOW mw INNER JOIN CM_DEVICE cmd on mw.dev_id = cmd.dev_id INNER JOIN CM_COMPUTER_SYSTEM cmcs on cmcs.cs_id = cmd.cs_id INNER JOIN MAINTENANCE_SCHEDULE ms on mw.schedule_id = ms.schedule_id where mw.end_time > GETDATE() INTO OUTFILE '/tmp/Maintenance.txt';")
    --Dump table
    tdump(query)

     

     

    Improvements welcomed  



  • 4.  Re: How to alert on Robot left in Maintenance mode?

    Posted 06-19-2015 04:20 PM

    Thanks John,

     

    I'll take a look at using the UMP maintenance mode instead, and retrain our SOC staff on the process. 

     

     

    I was hoping Nimsoft would log somewhere (on the primary hub) that a Server is in Maintenance, but I've check the Hub probe and there's nothing in there..