DX NetOps

 View Only
Expand all | Collapse all

Time when a device discovered in NetVoyant

  • 1.  Time when a device discovered in NetVoyant

    Posted Nov 09, 2014 08:59 AM

    Hi,

     

    Can anyone help me to have database query so that i will get to know when a device is discovered(Added) in NetVoyant database? Need the date only.. if we can get time as well no prblem.

     

    Also it would be nice if we can get date for when the device got rediscovered last?

     

    Thanks in Advance.



  • 2.  Re: Time when a device discovered in NetVoyant

    Posted Nov 10, 2014 10:42 AM

    Any help on this?



  • 3.  Re: Time when a device discovered in NetVoyant
    Best Answer

    Posted Nov 13, 2014 09:27 AM

    Sorry, CAWorld was this week, so most of us have been involved with that.

     

    select *, from_unixtime(dev_discovered) as 'First Discovered', modified as 'Last Modified' from devices;
    

     

    This will give you when the device was first discovered and last modified. Last modified should be the same as the last time it was discovered. However, it may only represent when the last discovery that changed anything happened.



  • 4.  Re: Time when a device discovered in NetVoyant

    Posted Dec 28, 2014 12:20 PM

    Hey Stu,

     

    I applied the query in database. Now can you please let me know how can i see it in a page?



  • 5.  Re: Time when a device discovered in NetVoyant

    Posted Dec 28, 2014 02:08 PM

    You have two options:

    1. Setup the ODBC connector and use that query in your config. This will run the query every time the page is rendered.
    2. Run the query as part of a scheduled task with the -H flag. This will output the results in HTML. Redirect that HTML to your custom content directory and use a browser view to get it on the page. This will run the query only when it is scheduled.


  • 6.  Re: Time when a device discovered in NetVoyant

    Posted Dec 28, 2014 03:20 PM

    Hey Stu,

     

    I am not using NPC.. so it seems like i can not perform above two options.



  • 7.  Re: Time when a device discovered in NetVoyant

    Posted Dec 28, 2014 03:27 PM

    Why not?


    You can use the browser view in NV web GUI I think. 



  • 8.  Re: Time when a device discovered in NetVoyant

    Posted Jan 02, 2015 09:32 AM

    If all that is needed is to see the output in an easy to read format you can use this:

    mysql nms2 -t -e "select *, from_unixtime(dev_discovered) as 'First Discovered', modified as 'Last Modified' from devices" > D:\DeviceDiscoverDate.txt

    or if you don't want all the info for each device

    mysql nsm2 -t -e "select from_unixtime(dev_discovered), dev_alias, dev_name from devices" > DeviceDiscoverDate.txt

    In this case dev_discovered = the 'First Discovered' in the first query.



  • 9.  Re: Time when a device discovered in NetVoyant

    Posted Jan 02, 2015 09:45 AM

    You could also design a query to create a property for each device with the updated discovery time.



  • 10.  Re: Time when a device discovered in NetVoyant

    Posted Jan 02, 2015 09:51 AM

    Yeah In addition to Stu recommendation can we have this in NetVoyant webpage.



  • 11.  Re: Time when a device discovered in NetVoyant

    Posted Jan 02, 2015 09:58 AM

    Adding a property will add it to the details page in NPC & NV. I'll post a script later. 



  • 12.  Re: Time when a device discovered in NetVoyant

    Posted Jan 03, 2015 06:36 PM

    Run this script every so often and the properties will show up in the details view for each device in NPC and NV.

    mysql -P 3308 nms2 -e "replace into properties select dev_properties,'Last Discovered', 18, from_unixtime(dev_discovered),0,0 from devices;"
    mysql -P 3308 nms2 -e "replace into properties select dev_properties,'Last Modified', 18, modified,0,0 from devices;"
    
    

    I've also incorporated these two lines into my properties setting script.



  • 13.  Re: Time when a device discovered in NetVoyant

    Posted Jan 03, 2015 06:37 PM

    If you run these queries with a -H option, it will output HTML format instead of tab separated text documents.