Skip to content
Oliver Gorwits edited this page Jun 27, 2023 · 16 revisions

Here is a page of community-contributed custom reports.

Create a reports: section of your deployment.yml and add the reports under it. Be careful to ensure you follow YAML rules and correctly indent with whitespace. When the file is saved, the web frontend process will notice and reload. Reload your browser page to see the changes.

Remember to back up your deployment.yml before making any changes!

The 'yamllint' validator can be invaluable for exactly locating anything that will cause YAML parsing errors. You may find it beneficial to craft your report in a seperate file, ensure it validates, and then paste it into deployment.yml.

Unless specified otherwise, added reports will appear in the "My Reports" category. The examples below suggest the category you may wish to locate them in.

The full specification for reports: setting is here in the configuration guide.

Port Reports

Ports that are down, Admin Up, for 2 months

Contributed by Miha Kralj on the mailing list.

The use case is that ports not used for at least two months should be shut down for security reasons. The time range is configurable inside the query.

- tag: portsdown_adminup_period
  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') 

Port speeds summary

Produce a summary of the number of ports of each different speed.

- tag: port_speeds
  label: 'Port Speeds'
  category: Port
  columns:
    - {total: 'Count'}
    - {speed: 'Speed'}
   query: |
     SELECT count(*) AS total, speed
       FROM device_port
       WHERE up = 'up'
     GROUP BY speed
     ORDER BY total

Device Report

Device Uptime

Produce a report of device uptime.

- tag: uptime 
  label: 'Uptime' 
  category: Device
  columns: 
    - {name: 'Device Name'} 
    - {uptime: 'Uptime'} 
  query: | 
    SELECT name, 
    FORMAT ('%s Years,%s Weeks,%s Days,%s Hours,%s Minutes', 
    (uptime /100 /60 /60 /24 /7 /52), 
    (uptime /100 /60 /60 /24 /7 % 52), 
    (uptime /100 /60 /60 /24 % 7), 
    (uptime /100 /60 /60 % 24), 
    (uptime /100 /60 % 60)) AS uptime 
    FROM device 
    ORDER BY name 

Device Last Discovery Greater Than

Report devices which were last discovered more than some time ago.

The time limit is configurable inside the query.

- tag: last_discovery_gt
  label: 'Device last discovery > 2 months'
  category: Device
  columns:
    - { ip: IP}
    - { dns: DNS }
    - { serial: Serial }
    - { vendor: Vendor }
    - { os: OS }
    - { os_ver: 'OS Version' }
    - { last_discover: 'Last discovered' }
  query: |
    SELECT ip, dns, serial, vendor, os, os_ver, last_discover
      FROM device
      WHERE last_discover < (now() - interval '2 month')
      ORDER BY last_discover