Send netdisco-users mailing list submissions to
        netdisco-users@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.sourceforge.net/lists/listinfo/netdisco-users
or, via email, send a message with subject or body 'help' to
        netdisco-users-requ...@lists.sourceforge.net

You can reach the person managing the list at
        netdisco-users-ow...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of netdisco-users digest..."
Today's Topics:

   1. Re: perl script for custom reports (Oliver Gorwits)
--- Begin Message ---
Hi Brian

No problem asking again! A lot has been developed in the past couple of
years which might help.

One problem with making anything a hyperlink by using Perl munging is that
the output is then HTML escaped for safety by Netdisco, rendering the link
useless. This is why the old Plugins I released for Observium and RANCID
were quite a bit of work, adding template code and so on.

Since then, we have the new external_links and custom_fields features which
allow these plugins to be entirely replaced by deployment.yml config!

https://github.com/netdisco/netdisco/wiki/Configuration#external_links
https://github.com/netdisco/netdisco/wiki/Configuration#custom_fields

I'm not quite understanding how you attach a CVE number to a device, or do
you mean you have a separate database to look them up in?

Anyway, you can easily nowadays push some data into a custom field (for a
device or port), either via API or in a Hook, and then use that custom
field in a device or port hyperlink, using above config options.

https://github.com/netdisco/netdisco/wiki/Hooks
https://github.com/netdisco/netdisco/wiki/API#update-a-custom-field

If you have another scenario in mind, please elaborate, as this is where
the features come from! :-)

regards
oliver.

On Sun, 7 Sept 2025 at 21:32, Brian Marshall via netdisco-users <
netdisco-users@lists.sourceforge.net> wrote:

> Hi list, I know this is a _very_ old thread, but it just kind of ended up
> with a link to the Wiki which, while an excellent source of a lot of things
> to do with custom reports, still doesn't have an example .pm for column
> munging.
>
> I'd love to be able to do a few things like make some columns into
> hotlinks (eg. CVE numbers going to NIST definitions), but I'm not sure
> where to get started with the "munging".
> On 6/24/21 02:14, Ruben Moretti via netdisco-users wrote:
>
> Hi Oliver !
>
> Thanks a lot !
>
> Maybe a Perl script as an example to mung the data that is called up in
> this way? I can't see how to access the input for the script, and I don't
> know what the output should look like either. I only know that the Perl
> script should have the same name as the report tag and must be located
> under site_plugins.
>
> Thanks in advance,
>
>
>
> Am 23.06.2021 um 22:59 schrieb Oliver Gorwits:
>
> A wiki page might do as well - can be collaboratively edited with
> suggested reports and grouped by topic similar to the menus
>
> ....time passes...
>
> I created one :) https://github.com/netdisco/netdisco/wiki/Custom-Reports
>
> On Wed, 23 Jun 2021 at 21:36, Michael Butash <mich...@butash.net> wrote:
>
>> Probably nice to make a /contrib directory for these folks could drop
>> into a repo for other user-created reports they find useful.
>>
>> Reading this thread, I was wondering about looking at making a custom
>> report to fix nbt node views.  It's really quite annoying it doesn't give
>> the ip address in the main view, would be nice to add a like report with
>> just that if not adding to the existing one.
>>
>> -mb
>>
>>
>> On Tue, Jun 22, 2021 at 11:23 PM Miha Kralj <miha.kr...@gmail.com> wrote:
>>
>>> Another nice report is for finding all ports that are: Port down, Admin
>>> Up, for 2 months
>>> This means that ports are not used for at least 2 months and for
>>> security reasons should be shut down.
>>> The time range is configurable inside the query.
>>>
>>> reports:
>>>   - tag: portsdownall
>>>     label: 'Port down, Admin Up - 2 months'
>>>     category: Port
>>>     columns:
>>>     - { host: Device_name}
>>>     - { ip: ip}
>>>     - { port: Port}
>>>     - { name: Description}
>>>     - { status: Status}
>>>     - { status_admin: 'Status Admin'}
>>>     - { last_change: 'Last change'}
>>>     query: |
>>>       SELECT device.name AS host, device_port.ip, device_port.port,
>>> device_port.name, device_port.up AS status, device_port.up_admin AS
>>> status_admin,
>>>         to_char((device.last_discover - (device.uptime -
>>> device_port.lastchange) / 100 * interval '1 second'), 'YYYY-MM-DD
>>> HH24:MI:SS') as last_change from device_port
>>>       LEFT JOIN device ON device_port.ip = device.ip
>>>       WHERE device_port.up = 'down'
>>>         AND device_port.up_admin = 'up'
>>>         AND device_port.port NOT LIKE '%Vlan%'
>>>         AND (device.last_discover - (device.uptime -
>>> device_port.lastchange) /
>>>         100 * interval '1 second') < (now() - interval '2 month')
>>>
>>> On Wed, Jun 23, 2021 at 8:07 AM Muris <alcat...@gmail.com> wrote:
>>>
>>>> Does anyone else have any other handy custom reports they can share?
>>>>
>>>>
>>>>
>>>> *From: *Miha Kralj <miha.kr...@gmail.com>
>>>> *Date: *Wednesday, 23 June 2021 at 15:20
>>>> *To: *Ruben Moretti <news.liste...@googlemail.com>
>>>> *Cc: *<netdisco-users@lists.sourceforge.net>
>>>> *Subject: *Re: [Netdisco] perl script for custom reports
>>>>
>>>>
>>>>
>>>> Hi,
>>>>
>>>> There is a simple way to make custom reports...
>>>>
>>>> My way to create custom reports is to place yml code at the end in
>>>> environments/deployment.yml file like this:
>>>>
>>>>
>>>>
>>>> reports:
>>>>
>>>>   - tag: List_of_devices
>>>>
>>>>     label: 'List of devices'
>>>>
>>>>     category: Device
>>>>
>>>>     columns:
>>>>
>>>>     - { name: Device}
>>>>
>>>>     - { ip: ip}
>>>>
>>>>     - { creation: First_seen}
>>>>
>>>>     - { last_discover: Last_discover}
>>>>
>>>>     query: |
>>>>
>>>>       SELECT name, ip, creation::timestamp(0),
>>>> last_discover::timestamp(0) from device
>>>>
>>>>         ORDER BY name
>>>>
>>>>
>>>>
>>>> After that you can find a report on the web interface "Reports -- >
>>>> Device -- > List of devices".
>>>>
>>>> I hope it helps.
>>>>
>>>>
>>>>
>>>> On Sun, Jun 20, 2021 at 3:31 PM Ruben Moretti via netdisco-users <
>>>> netdisco-users@lists.sourceforge.net> wrote:
>>>>
>>>> Hello !
>>>>
>>>> Can anyone post some simple perl script example  for them ?
>>>>
>>>> Thanks a lot.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> https://github.com/netdisco/netdisco/wiki/Configuration#reports
>>>>
>>>> You can munge the data retrieved from the database by placing a Perl
>>>> script with the same name as the reports key into the “site_plugins”
>>>> directory of Netdisco’s home area. The script can access $config for
>>>> its configuration and @data for the retrieved data. It should return a
>>>> list of munged data
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Netdisco mailing list
>>>> netdisco-users@lists.sourceforge.net
>>>> https://sourceforge.net/p/netdisco/mailman/netdisco-users/
>>>>
>>>> _______________________________________________
>>> Netdisco mailing list
>>> netdisco-users@lists.sourceforge.net
>>> https://sourceforge.net/p/netdisco/mailman/netdisco-users/
>>
>> _______________________________________________
>> Netdisco mailing list
>> netdisco-users@lists.sourceforge.net
>> https://sourceforge.net/p/netdisco/mailman/netdisco-users/
>
>
>
> _______________________________________________
> Netdisco mailing 
> listnetdisco-users@lists.sourceforge.nethttps://sourceforge.net/p/netdisco/mailman/netdisco-users/
>
>
>
> _______________________________________________
> Netdisco mailing 
> listnetdisco-users@lists.sourceforge.nethttps://sourceforge.net/p/netdisco/mailman/netdisco-users/
>
> _______________________________________________
> Netdisco mailing list
> netdisco-users@lists.sourceforge.net
> https://sourceforge.net/p/netdisco/mailman/netdisco-users/

--- End Message ---
_______________________________________________
Netdisco mailing list - Digest Mode
netdisco-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/netdisco-users

Reply via email to