DX Infrastructure Manager

Expand all | Collapse all

List of all monitored objects

  • 1.  List of all monitored objects

    Posted 03-29-2011 03:18 PM

    Hi , 

     

    We're looking for a way to easely generate a list of all the monitors we have in place, preferably with some sort of distinction between usertag. In a more specific way:

     

    environment A :

    E:\ threshold

    F:\ threshold

    Physical memory threshold

    ...

    ...

     

    Does nimbus have something like this currently in place that we could use, or do we have to write a script that can read the config file for the parameters?

     

    Thanks in advance for your help !

    Kind regards,

    Joris



  • 2.  Re: List of all monitored objects

    Posted 03-29-2011 04:09 PM

    Here is a script that was posted by a user here a while back that does about what you are looking for it seems just make sure you set your directory path properly at the top of the script about line 8.

     

    local h_resp,rc = nimbus.request("hub", "gethubs")
    for h_row,h_entry in pairs (h_resp.hublist) do
        local r_resp,rc = nimbus.request(h_entry.addr, "getrobots")
        for r_row, r_entry in pairs (r_resp.robotlist) do
            args = pds.create()
            pds.putString (args,"name","cdm")
            cfg,rc = nimbus.request ( r_entry.addr,"probe_config_get",args)
            dir= "E://ProbeThresholds//cdm//"
            file = r_entry.name..".txt"
            io.output(dir..file)
            io.write("<",r_entry.name,">")
            print("Robot: ", r_entry.name)
            cpu_error = cfg["/cpu/alarm/error"]
            if cpu_error ~= nil and cpu_error.active == "yes" then
                io.write("\n\tCPU Error=",cpu_error.threshold)
                print("CPU Error=",cpu_error.threshold)
            end
            cpu_warning = cfg["/cpu/alarm/warning"]
            if cpu_warning ~= nil and cpu_warning.active == "yes" then
                io.write("\n\tCPU Warning=",cpu_warning.threshold)
                print("CPU Warning=",cpu_warning.threshold)
            end
            cpu_multi_max_error = cfg["/cpu/alarm/multi_max_error"]
            if cpu_multi_max_error ~= nil and cpu_multi_max_error.active == "yes" then
                io.write("\n\tCPU Multi Max Error=",cpu_multi_max_error.threshold)
                print("CPU Multi Max Error=",cpu_multi_max_error.threshold)
            end
            cpu_multi_diff_error = cfg["/cpu/alarm/multi_diff_error"]
            if cpu_multi_diff_error ~= nil and cpu_multi_diff_error.active == "yes" then
                io.write("\n\tCPU Multi Diff Error=",cpu_multi_diff_error.threshold)
                print("CPU Multi Diff Error=",cpu_multi_diff_error.threshold)
            end
            cpu_specific_proc_q_len = cfg["/cpu/specific/proc_q_len"]
            if cpu_specific_proc_q_len ~= nil and cpu_specific_proc_q_len.active == "yes" then
                io.write("\n\tCPU Pro Queue Len=",cpu_specific_proc_q_len.threshold)
                print("CPU Pro Queue Len=",cpu_specific_proc_q_len.threshold)
            end
            pagefile_error = cfg["/memory/alarm/pagefile error"]
            if pagefile_error ~= nil and pagefile_error.active == "yes" then
                io.write("\n\tPagefile Error=",pagefile_error.threshold)
                print("Pagefile Error=",pagefile_error.threshold)
            end
            pagefile_warning = cfg["/memory/alarm/pagefile warning"]
            if pagefile_warning ~= nil and pagefile_warning.active == "yes" then
                io.write("\n\tPagefile Warning=",pagefile_warning.threshold)
                print("Pagefile Warning=",pagefile_warning.threshold)
            end
            physical_error = cfg["/memory/alarm/physical error"]
            if physical_error ~= nil and physical_error.active == "yes" then
                io.write("\n\tPhysical Error=",physical_error.threshold)
                print("Physical Error=",physical_error.threshold)
            end
            physical_warning = cfg["/memory/alarm/physical warning"]
            if physical_warning ~= nil and physical_warning.active == "yes" then
                io.write("\n\tPhysical Warning=",physical_warning.threshold)
                print("Physical Warning=",physical_warning.threshold)
            end
            swap_error = cfg["/memory/alarm/swap error"]
            if swap_error ~= nil and swap_error.active == "yes" then
                io.write("\n\tSwap Error=",swap_error.threshold)
            print("Swap Error=",swap_error.threshold)
            end
            swap_warning = cfg["/memory/alarm/swap warning"]
            if swap_warning ~= nil and swap_warning.active == "yes" then
                io.write("\n\tSwap Warning=",swap_warning.threshold)
            print("Swap Warning=",swap_warning.threshold)
            end
            paging_error = cfg["/memory/alarm/paging error"]
            if paging_error ~= nil and paging_error.active == "yes" then
                io.write("\n\tPaging Error=",paging_error.threshold)
                print("Paging Error=",paging_error.threshold)
            end
            paging_warning = cfg["/memory/alarm/paging warning"]
            if paging_warning ~= nil and paging_warning.active == "yes" then
                io.write("\n\tPaging Warning=",paging_warning.threshold)
                print("Paging Warning=",paging_warning.threshold)
            end
            local filesystems = {}
            for section,conf in pairs(cfg) do
                local fs = string.match(section, "^/disk/alarm/fixed/([^/]+)$")
                if fs ~= nil then
                    table.insert(filesystems, fs)
                end
            end
            table.sort(filesystems)
            for fs,x in pairs(filesystems) do
               -- Filesystem names on Unix have the / replaced with # in the config
               local fs_name = string.gsub(x, "#", "/")
                   disk_active = cfg["/disk/alarm/fixed/"..x..""]
                   if disk_active.active == "yes" then
                      print("Disk Active ",fs_name)
                      disk_alarm_fixed_error = cfg["/disk/alarm/fixed/"..x.."/error"]
                if disk_alarm_fixed_error ~= nil and disk_alarm_fixed_error.active == "yes" then
                    io.write("\n\tDisk Alarm Fixed Error on ",fs_name,"=",disk_alarm_fixed_error.threshold)
                    print("Disk Alarm Fixed Error on ",fs_name,"=",disk_alarm_fixed_error.threshold)
                end
                disk_alarm_fixed_warning = cfg["/disk/alarm/fixed/"..x.."/warning"]
                if disk_alarm_fixed_warning ~= nil and disk_alarm_fixed_warning.active == "yes" then
                    io.write("\n\tDisk Alarm Fixed Warning on ",fs_name,"=",disk_alarm_fixed_warning.threshold)
                    print("Disk Alarm Fixed Warning on ",fs_name,"=",disk_alarm_fixed_warning.threshold)
                end
                disk_alarm_fixed_inode_error = cfg["/disk/alarm/fixed/"..x.."/inode_error"]
                if disk_alarm_fixed_inode_error ~= nil and disk_alarm_fixed_inode_error.active == "yes" then
                    io.write("\n\tDisk Alarm Fixed Inode Error on ",fs_name,"=",disk_alarm_fixed_inode_error.threshold)
                    print("Disk Alarm Fixed Inode Error on ",fs_name,"=",disk_alarm_fixed_inode_error.threshold)
                end
                disk_alarm_fixed_inode_warning = cfg["/disk/alarm/fixed/"..x.."/inode_warning"]
                if disk_alarm_fixed_inode_warning ~= nil and disk_alarm_fixed_inode_warning.active == "yes" then
                    io.write("\n\tDisk Alarm Fixed Inode Warning on ",fs_name,"=",disk_alarm_fixed_inode_warning.threshold)
                    print("Disk Alarm Fixed Inode Warning on ",fs_name,"=",disk_alarm_fixed_inode_warning.threshold)
                end
                disk_alarm_fixed_delta_error = cfg["/disk/alarm/fixed/"..x.."/delta_error"]
                if disk_alarm_fixed_delta_error ~= nil and disk_alarm_fixed_delta_error.active == "yes" then
                    io.write("\n\tDisk Alarm Fixed Delta Error on ",fs_name,"=",disk_alarm_fixed_delta_error.threshold)
                    print("Disk Alarm Fixed Delta Error on ",fs_name,"=",disk_alarm_fixed_delta_error.threshold)
                end
                disk_alarm_fixed_delta_warning = cfg["/disk/alarm/fixed/"..x.."/delta_warning"]
                if disk_alarm_fixed_delta_warning ~= nil and disk_alarm_fixed_delta_warning.active == "yes" then
                    io.write("\n\tDisk Alarm Fixed Delta Warning on ",fs_name,"=",disk_alarm_fixed_delta_warning.threshold)
                    print("Disk Alarm Fixed Delta Warning on ",fs_name,"=",disk_alarm_fixed_delta_warning.threshold)
                end
                   else
                      print ("Disk not Active ",fs_name)
                   end
            end
            disk_fixed_default_error = cfg["/disk/fixed_default/error"]
            if disk_fixed_default_error ~= nil and disk_fixed_default_error.active == "yes" then
                io.write("\n\tDisk Fixed Default Error=",disk_fixed_default_error.threshold)
                print("Disk Fixed Default Error=",disk_fixed_default_error.threshold)
            end
            disk_fixed_default_warning = cfg["/disk/fixed_default/warning"]
            if disk_fixed_default_warning ~= nil and disk_fixed_default_warning.active == "yes" then
                io.write("\n\tDisk Fixed Default Warning=",disk_fixed_default_warning.threshold)
                print("Disk Fixed Default Warning=",disk_fixed_default_warning.threshold)
            end
            disk_fixed_default_inode_error = cfg["/disk/fixed_default/inode_error"]
            if disk_fixed_default_inode_error ~= nil and disk_fixed_default_inode_error.active == "yes" then
                io.write("\n\tDisk Fixed Default Inode Error=",disk_fixed_default_inode_error.threshold)
                print("Disk Fixed Default Inode Error=",disk_fixed_default_inode_error.threshold)
            end
            disk_fixed_default_inode_warning = cfg["/disk/fixed_default/inode_warning"]
            if disk_fixed_default_inode_warning ~= nil and disk_fixed_default_inode_warning.active == "yes" then
                io.write("\n\tDisk Fixed Default Inode Warning=",disk_fixed_default_inode_warning.threshold)
                print("Disk Fixed Default Inode Warning=",disk_fixed_default_inode_warning.threshold)
            end
            disk_fixed_default_delta_error = cfg["/disk/fixed_default/delta_error"]
            if disk_fixed_default_delta_error ~= nil and disk_fixed_default_delta_error.active == "yes" then
                io.write("\n\tDisk Fixed Default Delta Error=",disk_fixed_default_delta_error.threshold)
                print("Disk Fixed Default Delta Error=",disk_fixed_default_delta_error.threshold)
            end
            disk_fixed_default_delta_warning = cfg["/disk/fixed_default/delta_warning"]
            if disk_fixed_default_delta_warning ~= nil and disk_fixed_default_delta_warning.active == "yes" then
                io.write("\n\tDisk Fixed Default Delta Warning=",disk_fixed_default_delta_warning.threshold)
                print("Disk Fixed Default Delta Warning=",disk_fixed_default_delta_warning.threshold)
            end
            print("\n")
            io.write("\n</",r_entry.name,">\n")
        end
    end



  • 3.  Re: List of all monitored objects

    Posted 03-29-2011 04:50 PM
    Would this information be available in the database or only via the API?


  • 4.  Re: List of all monitored objects

    Posted 03-29-2011 05:23 PM

    Only via the probe_requests (API). That being said, you could modify the script to insert the information into a database table as opposed to a text file.



  • 5.  Re: List of all monitored objects

    Posted 03-29-2011 05:24 PM

    It's my understanding that we're in the process of creating an OOTB method to show these types of stats as today we have limited (canned) options and scripting solutions.

     

    One way to do this is using the Probe Report Utility, it's in the Bin directory here:

     

    [Nimsoft Directory]\bin\ProbeReport.exe

     

    Another option is the script Neal posted, here is the thread it's from: 

     

    http://forum.nimsoft.com/t5/General/Pulling-thresholds-from-cdm-cfg-with-LUA/m-p/4209#M2442

     

    Best of luck,

     

    Dustin



  • 6.  Re: List of all monitored objects

    Posted 03-30-2011 10:08 AM

    When I try to execute this script I get following error.

     

     

    >lua -e "io.stdout:setvbuf 'no'" "test.lua" 
    lua: test.lua:1: attempt to index global 'nimbus' (a nil value)
    stack traceback:
     test.lua:1: in main chunk
     [C]: ?
    >Exit code: 1

     

     

    tried running the scripts from the link from the original script and tried the last one there but no luck, i'm also a complete novice to lua. Which isn't to my advantage.

     

    Any help would be greatly appreciated.

     

    thanks!

     

    Joris

     



  • 7.  Re: List of all monitored objects

    Posted 03-30-2011 10:38 AM

    Joris,

     

    It looks like you are using an external Lua interpreter. In order to run this script, you need to use the Nimsoft Script Agent (NSA). You can find the nsa package in the Internet archive. After you download the package to your local archive and distribute it to a robot, the executable will located here:

     

    $NIMROOT/sdk/nsa/nsa

     

    The NSA extends Lua 5.1 with several NMS-specific libraries. A whitepaper is available and contains details about the NMS-specific functions. You should be able to find the whitepaper either here on this forum or on the customer portal.

     

    -Keith



  • 8.  Re: List of all monitored objects

    Posted 03-30-2011 11:26 AM

    I ran the script trough the command prompt using the nsa package and seem to get a similar error, i ran it with logging so i could paste it.

     

     

    Mar 30 10:22:32:450 nsa: Script error, cdm-thresholds:16: attempt to index local 'h_resp' (a nil value)

     

     

    The script file is in the folder together with the nsa.exe

    command line used was , nsa -l log.txt cdm-thresholds



  • 9.  Re: List of all monitored objects

    Posted 03-30-2011 05:20 PM

    The script does not check the return codes from the calls to nimbus.request(). So this probably means the request failed in this line:

     

    local h_resp,rc = nimbus.request("hub", "gethubs")

     

    The correct way to figure out what happened be to add a check of the rc variable immediately after this line. Something like this:

     

    if rc ~= NIME_OK then

        print("Exiting due to rc = "..rc)

        os.exit(rc)

    end

     

    You can check the value of the return code against this list to get some idea of what might be wrong:

     

    http://forum.nimsoft.com/t5/General-Development/NIME-NOENT/m-p/3826#M925

     

    If I had to guess, I would think you might not running this script on a hub. If that is the case, change the line to something like this:

     

    local h_resp,rc = nimbus.request("/[domain]/[hubname]", "gethubs")

     

    And put in the proper values for [domain] and [hubname] for your environment.

     

    -Keith



  • 10.  Re: List of all monitored objects

    Posted 04-06-2011 10:58 PM

     

    The below is a script I had wrote to get everything from every probe config and write it to SQL. From there I use SQL querys to gather data and i have the ability to filter my SQL Query based on User Tags and whatever else in SQL Syntax. It helps alot for Unified Reports to have this data. The script takes a while to run since it loops everything.
    ----------------------------------------------------------------------------------------------------------------------------------------------
    -- Nimsoft Enviroment Audit
    -- Login so that I can run this from the command line
    nimbus.login("username","password")
    -- Initialize the enviroment database
    local cs = "Provider=SQLOLEDB;Initial Catalog=Nimbus_Custom;Data Source=192.168.1.1;User Id=sa;Password=sapassword;Network Library=dbmssocn;Language=us_english"
    database.open(cs)
    -- Drop the envProfile table
    query = "DELETE audit"
    printf("DB QUERY -> %s",query)
    database.query(query)
    -- Populate the audit table with probe configuration information
    -- Start by getting a list of the hubs
    printf("NIM REQUEST -> %s %s","hub","gethubs")
    local gethubs = nimbus.request("hub","gethubs")
    if gethubs ~= nil then
     for i,hub in pairs(gethubs.hublist) do
     -- Get a list of robots from each hub
     --printf("NIM REQUEST -> %s %s",hub.addr,"getrobots")
     local getrobots = nimbus.request(hub.addr,"getrobots")
     if getrobots ~= nil then
     for j,robot in pairs(getrobots.robotlist) do
     -- Get some information from each robot
     --printf("NIM REQUEST -> %s %s",robot.addr.."/controller","probe_list")
     local probe_list = nimbus.request(robot.addr.."/controller","probe_list")
     if probe_list ~= nil then
     for k,probe in pairs(probe_list) do
     
    -- Get some information from each probe
    args = pds.create()
                      pds.putString(args,"name",probe.name)
                      --printf("NIM REQUEST -> %s %s",robot.addr.."/controller","probe_list")
    local probe_config_get = nimbus.request(robot.addr.."/controller","probe_config_get",args)
    if probe_config_get ~= nil then
    for section,tableid in pairs(probe_config_get) do
                            for key,value in pairs(probe_config_get[section]) do
                               -- And dump the config file in the DB for later use
      query = sprintf("INSERT INTO audit VALUES ('%s','%s','%s','%s','%s','%s')",hub.name,robot.name,probe.name,section,key,value)
                               printf("DB QUERY -> %s",query)
                               database.query(query)
                               
    end
    end
    end
    end
    end
    end
    end
    end
    end
    -- Close the database and return
    database.close()
    return
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
    HERE IS A SQL SCRIPT TO CREATE THE TABLE NEEDED FOR THE ABOVE MY DB WAS CALLED Nimbus_Custom
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
    USE [Nimbus_Custom]
    GO
    /****** Object:  Table [dbo].[audit]    Script Date: 04/06/2011 14:53:07 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[audit](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [hub] [varchar](255) NULL,
    [robot] [varchar](255) NULL,
    [probe] [varchar](255) NULL,
    [section] [varchar](255) NULL,
    [key] [varchar](255) NULL,
    [value] [text] NULL,
     CONSTRAINT [PK__audit__07020F21] PRIMARY KEY CLUSTERED 
    (
    [id] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF

     



  • 11.  Re: List of all monitored objects

    Posted 04-08-2011 09:37 AM

    I like the idea posted by Jarrod , but i can't get it to work , it won't accept my connection to the database. I tried what i think is every possible way, but as i've said before i have no understanding of lua and im still learning it from scratch. 

     

    database.open("Provider=SQLNCLI10;Server=10.93.198.40\SQLEXPRESS;Database=Nimbus_Custom;Uid=sa; Pwd=xx;")

    this is just one of the many different strings i tried, in the process of trying to connect i'm just launching a script that opens a connection and closes it , nothing else.

    the server is currently in test environment and has sql express installed, i tried with the name aswell.

     

    I've added an odbc connection for both the native client and the SQL Server but nothing seems to work 

     

    Apr  8 08:34:08:000 nsa: Script error, [Error]: unable to open the database.

     

    I read the document that is provided with the NSA package but that doesnt really help me get any further as setting up the correct datastring.

     

    So i was hoping you guys have some tips for me

     

    with kind regards, 

     a complete lua noob



  • 12.  Re: List of all monitored objects

    Posted 04-08-2011 12:36 PM

    Hi,

     

    You are trying to use the SQLNCLI10 (sql server native client), it do not appear to work with nsa/nas.

     

    I think you need to use sqloledb as provider.

     

    Thanks,

    G.



  • 13.  Re: List of all monitored objects

    Posted 04-08-2011 05:33 PM

    Joris,

    I am using SQL 2005, that connection string is for it. There is another way of doing the Conncection strings. You can create a DSN from within Control Panel--Administrative Tools--Data Sources(ODBC) and then use the DSN Name in the Connection string like below:

     

    database.open("DSN=mydsnname;Uid=sa;Pwd=xxxx")



  • 14.  Re: List of all monitored objects

    Posted 04-11-2011 12:31 PM

    Clearly I'm not made for this scripting language, the database connection works (we think) but we cant write to the db. Now we've been thinking as we have zero experience in LUA, but we do have significant experience in JAVA and we've seen the sdk package of java in the nimsoft archive, is there a way to achieve the same result through java.

     

    This would be a lot easier for us atleast.

     

     

    I appreciate all the help so far, we've certainly learned from what's been posted here.



  • 15.  Re: List of all monitored objects

    Posted 04-11-2011 05:31 PM

    I had a problem with inserting when i first tryed with a script. For some reason the normal insert method doesnt work even though it works in SQL Manager.  Not sure why but this made me almost give up, maybe its the same issue you are having.


    This WORKS :

    ("INSERT INTO audit VALUES ('%s','%s','%s','%s','%s','%s')",hub.name,robot.name,probe.name,section,key,value)

    This DOESNT WORK:
    ("INSERT INTO audit (hub,robot,probe,section,key,value) VALUES ('%s','%s','%s','%s','%s','%s');",hub.name,robot.name,probe.name,section,key,value)