Walkthroughs

Watch your database with a dashboard

You build one dashboard that monitors the demo shop's database. When you finish, one screen holds tiles for the database server's status and business metrics such as orders per period, and they query again by themselves at the interval you set. The buttons and markers on the screen are explained in Dashboards, and the settings of a single tile in Tile settings. The focus is the order to build it in and why.

Where you can use itWebDesktopWithout signing inSigned inLocal projectsAccount projects

Before you start

  • You need a connection to the database you want to monitor. Tiles really query it, so the connection must have connection details.
  • To monitor a production database, use a connection with a query-only database account. Tile SQL runs again and again at each interval, even when nobody is looking. How to create such a connection is in Connect to a production database safely.
  • A dashboard is not a monitoring service. It runs only while the app is open and the dashboard tab is visible, and it sends no alerts when values change.
  • The web app queries only databases the NeoSQL server can reach. Monitor intranet databases from the desktop app (Web and desktop).

Create a dashboard

  1. Click the Project railDashboards button on the left rail, then the + button at the top of the panel. Result: The New dashboard dialog opens.
  2. Enter Store status as the name and click the OK button. Result: An empty dashboard is saved and opens as a tab. The No tiles yet message appears in the middle.
  • Dashboards are not part of the connection tree; they are gathered in the dashboards panel. Each tile has its own connection, so one dashboard can mix tiles from several databases.
  • You can also create one from the Create a dashboard for this connection dialog that appears when you create a connection. That puts in every preset for the DBMS, so for a production database, adding only chosen tiles as here sends fewer queries to the database.

Add database status tiles from presets

Questions that are the same for every database of a DBMS, such as session counts, slow queries and storage, are added from presets NeoSQL has prepared. You do not have to write SQL, and NeoSQL checks first whether they can run with the database account's privileges.

  1. Click the Start from presets button in the middle of the dashboard. On a dashboard that already has tiles, click the Presets button in the toolbar. Result: The preset gallery opens.
  2. Choose the Connection field (1) and the schema field (2). Result: Only presets for the chosen connection's DBMS appear, and NeoSQL sends a light query for each preset to check whether it can run. The number that can is shown at 3.
  3. Click the cards to add. Cards that cannot be used show the privilege or extension they need and cannot be clicked. Result: Chosen cards get a check mark. After you are granted privileges, check again with the Re-check availability button.
  4. Click the Add n selected button (8). Result: The tiles go into empty places and run once. Preset tiles come with automatic runs on, at the interval the preset defines.
  • Why a preset cannot be used and which presets each DBMS has are explained in Preset gallery.

Create a business metric tile with SQL

For questions presets do not cover, refine the query in the SQL editor and send it as a tile. You can check results and fix the query in the editor, which is faster than writing it from scratch in the tile settings dialog.

  1. In a SQL tab for shop-db, write a query that counts orders in a period and try running it. Result: :from and :to appear as bind parameters, so you can enter values and run it (Bind parameters).
  2. Put the cursor in the statement, click the Dashboard button in the toolbar and choose the Store status dashboard. Result: The tile settings dialog opens with the statement and the SQL tab's connection and schema.
  3. Choose the number type in the Type field and click the Run query button. Result: It really queries with the current period and shows the value.
  4. Turn on the Run automatically switch and click the OK button. Result: The tile goes into the first empty place on the dashboard and the dashboard tab opens. The tile runs once right after it is added. If you leave the Run automatically switch off, it stays manual after that and runs only when you click it.
SELECT COUNT(*) AS order_count
FROM orders
WHERE ordered_at >= :from AND ordered_at < :to
  • A tile accepts only one statement that starts with SELECT or WITH. Other statements are not sent, and you are told why.
  • Writing :from and :to with >= and < as above, instead of BETWEEN, avoids counting rows at the period's end time twice.

Set the period and refresh interval

  1. Choose the period you want in the Period field (3). The initial value is the last 7 days. Result: Only tiles that use :from and :to run again, and their past values and trend lines are cleared, so values from different ranges are not compared.
  2. Set the default interval next to the Auto run switch (4). The initial value is 60 seconds, and the shortest is 30 seconds. Result: Automatic tiles without their own interval run at the default interval. Give heavy aggregate tiles a longer interval of their own in the tile settings.
  3. Click the Edit button (6), drag tiles to set their places and sizes, and click it again to turn it off. Result: Each move is saved right away. Put the metrics you look at most at the top.
  4. To see current values, click the Refresh all button (5). Result: Every tile runs now, whether or not it runs automatically.
  • Automatic runs stop when you move to another work tab or project. When you come back, only the tiles whose interval passed in the meantime run right away, and the rest wait for the remaining interval.
  • To avoid loading the database, only one tile runs at a time per connection. The limits on concurrent and automatic runs are in 'Automatic runs and refreshing' on Dashboards.

Share with the team

Local projectAccount project
Dashboard definition (tiles, SQL, layout, intervals)Only on the deviceShared by project members. Any member can edit or delete it
Run resultsKept only on the deviceEach member's app runs its own queries. Results are not shared
  1. Build the dashboard in an account project and tell your teammates. Result: When teammates open the project, the same dashboard appears in the panel on the left rail. Teammates who already have the project open must open it again to see changes.
  2. A teammate opens the dashboard. Result: The teammate's app queries directly with the tile's connection. The teammate must be able to reach the database, and masked columns are hidden according to the teammate's role.
  • Anyone can edit or delete it, so let the team know before you delete tiles on a dashboard the team watches together. Deleting a tile cannot be undone.
  • If two people edit the same dashboard, the one who saves later sees the Another member saved first window and chooses whether to load the latest version or overwrite with their change.

What's next