Data source examples

Creating data source from scratch is an advance feature. You can either use the samples templates provided and tailor according to your needs, or create your own. Here are some of the examples for you to try out:

Using SQL queries

About this task

You want to be alerted when a job is pending for five days because of unavailable memory.

Procedure

  1. Enter a name and description and select the data type as a SQL query.
  2. Write a SQL query for notifying you about the pending jobs.
  3. Add the Custom Data Input items and run the SQL query.
    Figure 1. SQL query example

Results

Create an alert based on this template. If a job is pending for five days due to unavailable memory, then you will receive an email.

Using database tables

About this task

You want to be alerted when two users are logged on to a host.

Procedure

  1. Enter a name and description and select the data type as a table.
  2. Select the table type and table name appropriately.
  3. Define Data Source Metrics and Custom Data Input Items as shown in Figure 2.
  4. Build an expression, and make use of these two metrics and custom data in the Data Source Items.
    Figure 2. Example using database table
  5. Check the syntax. Either OK or Bad Syntax result is displayed. Refer to the Cacti log if there are any errors.

Results

Create an alert based on this template. You will be notified when two users are logged on to a host.

Using a script

About this task

You want to be alerted when a license has not been used for 15 days.

Procedure

  1. Enter a name and description and select the data type as a script.
  2. Write your script and input custom data Input items as shown in Figure 3.
    Figure 3. Example using a script
  3. Run the script. Either OK or Bad Syntax result is displayed. Refer to the Cacti log if there are any errors.

Results

Create an alert based on this template. You will be notified when a license is not used for 15 days.