docs: bring shared developer and plugin guides to the 1.2.x manual (#312)
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
No files matched your search
@@ -0,0 +1,524 @@
|
||||
# Card API Developer Guide
|
||||
|
||||
Use Cacti's Card API when a plugin needs a dashboard of movable panels, or
|
||||
when an existing page needs a small chart. PHP renders the measurements as
|
||||
HTML or SVG. The shared stylesheet lays out the cards. The JavaScript
|
||||
controller handles keyboard and pointer interaction and calls your plugin
|
||||
when it needs new content or a layout saved.
|
||||
|
||||
The example below builds two cards from sample poller measurements. You
|
||||
can move a card, expand its details, and refresh it from PHP. It runs on
|
||||
the Cacti `develop` and `1.2.x` revisions listed under
|
||||
[Implementation references](#implementation-references).
|
||||
|
||||
The 1.2.x example was tested on a 1.2.32 maintenance checkout. Check
|
||||
which card helpers your installed build provides before using the example.
|
||||
|
||||
![Poller load and device availability][overview]
|
||||
|
||||
## Choose the parts you need
|
||||
|
||||
| Use case | What to load or supply |
|
||||
| --- | --- |
|
||||
| Show a gauge, bar, or statistic in an existing Cacti page | Call a PHP widget helper and print its return value. |
|
||||
| Lay out several cards | Render a `.ccGrid` with one direct `.ccCard` child per card. |
|
||||
| Enable card controls | Call `CactiCards.init(grid, adapter)` after inserting the grid. |
|
||||
| Save a layout or load fresh data | Implement the corresponding adapter callbacks in the plugin. |
|
||||
|
||||
Cacti's standard page header includes `include/css/cards.css`,
|
||||
`include/css/card-widgets.css`, and `include/js/cards.js` on both tested
|
||||
branches. The PHP helpers live in `lib/html.php`. On older installations,
|
||||
check for the helpers and the controller before advertising these controls.
|
||||
A plugin that emits a standalone fragment relies on the enclosing page to
|
||||
load the assets.
|
||||
|
||||
## Build the example plugin
|
||||
|
||||
[Download the example plugin](resources/carddemo.zip) and extract it into
|
||||
your development installation’s `plugins/` directory, or create
|
||||
`plugins/carddemo/` and copy the four standalone dashboard files below.
|
||||
The sample uses fixed
|
||||
measurements so you can compare your result with the screenshots without
|
||||
configuring a poller.
|
||||
|
||||
### INFO
|
||||
|
||||
```ini
|
||||
[info]
|
||||
name = carddemo
|
||||
version = 1.0
|
||||
longname = Card API Example
|
||||
author = Example Maintainer
|
||||
homepage = https://www.cacti.net
|
||||
compat = 1.2.32
|
||||
```
|
||||
|
||||
### setup.php
|
||||
|
||||
Register the page as a realm so the full dashboard and the refresh
|
||||
response use the same Cacti permission check.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
function plugin_carddemo_version() {
|
||||
$info = parse_ini_file(__DIR__ . '/INFO', true, INI_SCANNER_RAW);
|
||||
return $info['info'];
|
||||
}
|
||||
|
||||
function plugin_carddemo_install() {
|
||||
api_plugin_register_realm('carddemo', 'dashboard.php',
|
||||
'View Card API Example', 1);
|
||||
}
|
||||
```
|
||||
|
||||
### dashboard.php
|
||||
|
||||
The page can return the whole grid or one card. Both paths call the same
|
||||
renderer, which keeps the card ID, controls, and markup consistent.
|
||||
Only the two IDs in the catalogue select content.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
chdir(dirname(__DIR__, 2));
|
||||
require_once './include/auth.php';
|
||||
|
||||
$titles = [
|
||||
'load' => __('Poller load', 'carddemo'),
|
||||
'devices' => __('Device availability', 'carddemo'),
|
||||
];
|
||||
|
||||
function carddemo_render($id, $title, $expanded) {
|
||||
$load = $id === 'load';
|
||||
?>
|
||||
<section class="ccCard ccW2" data-card="<?= html_escape($id) ?>"
|
||||
data-severity="<?= $load ? 'warn' : 'up' ?>"
|
||||
data-expandable="<?= $load ? '1' : '0' ?>"
|
||||
data-expanded="<?= $load && $expanded ? '1' : '0' ?>" data-height="1">
|
||||
<header class="ccCardHeader">
|
||||
<button type="button" class="ccDrag"
|
||||
aria-label="<?= __esc('Move %s', $title, 'carddemo') ?>">↕</button>
|
||||
<h2 class="ccTitle"><?= html_escape($title) ?></h2>
|
||||
<span class="ccTools">
|
||||
<?php if ($load) { ?>
|
||||
<button type="button" class="ccTool" data-tool="expand">
|
||||
<?= __esc('Show more', 'carddemo') ?></button>
|
||||
<button type="button" class="ccTool" data-tool="collapse">
|
||||
<?= __esc('Show less', 'carddemo') ?></button>
|
||||
<?php } ?>
|
||||
<button type="button" class="ccTool" data-tool="refresh">
|
||||
<?= __esc('Refresh', 'carddemo') ?></button>
|
||||
</span>
|
||||
</header>
|
||||
<div class="ccCardBody">
|
||||
<?php
|
||||
if ($load) {
|
||||
print card_gauge(72, '72%', __('Cycle budget used', 'carddemo'), 'warn');
|
||||
print card_bullet(12, 24, 42, __('Cycle duration', 'carddemo'),
|
||||
__('12 / 24 / 42 seconds', 'carddemo'), 'warn', 0, 60);
|
||||
print card_bar(80, __('Worker utilization: 80%', 'carddemo'), 'up');
|
||||
print card_stat('18', __('Idle workers', 'carddemo'));
|
||||
} else {
|
||||
print card_stat('48 / 50', __('Devices responding', 'carddemo'));
|
||||
print card_stackbar([
|
||||
['percent' => 96, 'severity' => 'up', 'label' => __('48 up', 'carddemo')],
|
||||
['percent' => 4, 'severity' => 'down', 'label' => __('2 down', 'carddemo')],
|
||||
], true);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (isset($_GET['card'])) {
|
||||
$id = $_GET['card'];
|
||||
if (!is_string($id) || !isset($titles[$id])) {
|
||||
http_response_code(404);
|
||||
exit;
|
||||
}
|
||||
|
||||
carddemo_render($id, $titles[$id], ($_GET['expanded'] ?? '') === '1');
|
||||
exit;
|
||||
}
|
||||
|
||||
top_header();
|
||||
?>
|
||||
<div id="carddemo-grid" class="ccGrid">
|
||||
<?php foreach ($titles as $id => $title) {
|
||||
carddemo_render($id, $title, false);
|
||||
} ?>
|
||||
</div>
|
||||
<p id="carddemo-message" role="status"
|
||||
data-failure="<?= __esc('Refresh failed. Reload the page and try again.', 'carddemo') ?>"></p>
|
||||
<?php
|
||||
print get_md5_include_js('plugins/carddemo/dashboard.js');
|
||||
bottom_footer();
|
||||
```
|
||||
|
||||
### dashboard.js
|
||||
|
||||
The controller passes the current expanded state to the refresh callback.
|
||||
Send that state to the same authenticated PHP page and return the outer
|
||||
HTML of one card. The example reports a failed refresh next to the grid.
|
||||
Use the Cacti URL path for the endpoint so refresh works when Cacti is
|
||||
installed in a subdirectory.
|
||||
|
||||
```javascript
|
||||
(function () {
|
||||
const grid = document.getElementById('carddemo-grid');
|
||||
const message = document.getElementById('carddemo-message');
|
||||
|
||||
if (!grid) {
|
||||
return;
|
||||
}
|
||||
|
||||
CactiCards.init(grid, {
|
||||
async fetchCard(id, state) {
|
||||
const url = new URL('plugins/carddemo/dashboard.php',
|
||||
new URL(urlPath, window.location.origin));
|
||||
url.searchParams.set('card', id);
|
||||
url.searchParams.set('expanded', state.expanded ? '1' : '0');
|
||||
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok || response.redirected) {
|
||||
throw new Error('Card unavailable');
|
||||
}
|
||||
const html = await response.text();
|
||||
const fragment = document.createElement('template');
|
||||
fragment.innerHTML = html.trim();
|
||||
const card = fragment.content.firstElementChild;
|
||||
if (!card || !card.matches('.ccCard') || card.dataset.card !== id) {
|
||||
throw new Error('Unexpected card response');
|
||||
}
|
||||
message.textContent = '';
|
||||
return card.outerHTML;
|
||||
} catch (error) {
|
||||
message.textContent = message.dataset.failure;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
```
|
||||
|
||||
### Install and try it
|
||||
|
||||
From the Cacti root, use the same account you normally use to manage
|
||||
plugins and run the following command.
|
||||
|
||||
```console
|
||||
php cli/plugin_manage.php --plugin=carddemo --install --enable
|
||||
```
|
||||
|
||||
Sign in with **View Card API Example** and open
|
||||
`plugins/carddemo/dashboard.php` under your Cacti URL. Focus the move
|
||||
button on **Device availability** and press Left. Select **Show more** on
|
||||
**Poller load** to reveal **Idle workers**, then select **Refresh**.
|
||||
The expanded card should stay open and the device card should stay first.
|
||||
Reloading the full page restores the initial order in this example.
|
||||
|
||||
![Device card first, with poller details expanded][expanded]
|
||||
|
||||
## Publish a card in Intropage
|
||||
|
||||
Intropage supplies the grid, header, permissions, refresh schedule, and
|
||||
dashboard picker. Your plugin registers a **panel** and renders its body.
|
||||
The same PHP widget can appear in your own dashboard and in Intropage.
|
||||
Give the panel its own ID so users can configure each dashboard separately.
|
||||
|
||||
The [example archive](resources/carddemo.zip) includes an optional provider
|
||||
for Intropage. The standalone dashboard still works without Intropage.
|
||||
With the example and Intropage enabled, run this from the Cacti root:
|
||||
|
||||
```console
|
||||
php plugins/carddemo/register-panel.php
|
||||
```
|
||||
|
||||
Expect **Registered carddemo_capacity.** In **Console > Intropage > Panel
|
||||
Library**, look for the source **Carddemo**. Open the Intropage dashboard
|
||||
as a user with access to the panel. In the **Panels ...** menu select
|
||||
**Carddemo - Worker capacity**. The gauge displays **72%**. The panel can
|
||||
also update on the next Intropage polling cycle.
|
||||
|
||||
![Worker capacity gauge rendered within the Intropage dashboard][ip-shot]
|
||||
|
||||
### Register your provider
|
||||
|
||||
The CLI checks that both plugins are enabled, loads Intropage's
|
||||
`includes/functions.php`, and checks for `intropage_register_panel`.
|
||||
Keep this check in optional integrations so older or absent hosts do not
|
||||
prevent your plugin from loading. The registration in the archive uses:
|
||||
|
||||
```php
|
||||
$result = intropage_register_panel([
|
||||
'panel_id' => 'carddemo_capacity',
|
||||
'plugin' => 'carddemo',
|
||||
'name' => __('Worker capacity', 'carddemo'),
|
||||
'description' => __('Example worker pool utilization', 'carddemo'),
|
||||
'class' => 'carddemo',
|
||||
'level' => PANEL_SYSTEM,
|
||||
'refresh' => 300,
|
||||
'include_file' => 'plugins/carddemo/intropage-panel.php',
|
||||
'update_func' => 'carddemo_update_capacity',
|
||||
]);
|
||||
```
|
||||
|
||||
Use a stable, plugin-prefixed ID, the installed plugin's directory name,
|
||||
and a readable PHP callback file under `plugins/`. A successful call
|
||||
returns `true`. Validation failure returns an array of messages, so
|
||||
compare the result strictly with `true`. The host persists the definition.
|
||||
Register on installation or an explicit integration upgrade. Registering
|
||||
the same ID again replaces its definition, including fields you omitted.
|
||||
Use `intropage_update_panel_registration()` to change selected fields.
|
||||
|
||||
### Render, authorize, and remove a panel
|
||||
|
||||
Intropage loads the provider file when it builds the panel library. The
|
||||
callback calls the same core widget helper as a standalone page and saves
|
||||
the result for the supplied user:
|
||||
|
||||
```php
|
||||
function carddemo_update_capacity($panel, $user_id) {
|
||||
$panel['alarm'] = 'yellow';
|
||||
$panel['data'] = card_gauge(72, '72%', __('Worker utilization', 'carddemo'), 'warn');
|
||||
save_panel_result($panel, $user_id);
|
||||
}
|
||||
```
|
||||
|
||||
The example uses `PANEL_SYSTEM` because its sample is identical for
|
||||
everyone. Use `PANEL_USER` for user-specific data, restrict the query to
|
||||
objects the supplied user can view, and save the result with that user ID.
|
||||
The **Intropage Panel Library** realm controls administration. Grant panel
|
||||
visibility separately to the intended dashboard users or groups. If you
|
||||
add a details callback, declare its request variables, read them with
|
||||
`intropage_validate_request_vars()`, and check access to the selected item.
|
||||
|
||||
A disabled registration keeps its definition but loses its current
|
||||
placements. Re-enabling makes it available to add again. The example's
|
||||
uninstall callback calls `intropage_unregister_plugin_panels('carddemo')`
|
||||
when the API is available. Unregistering also removes the provider's data,
|
||||
placements, and panel permissions. See the [Intropage registration API][ip-api]
|
||||
for individual enable, disable, update, and removal calls.
|
||||
|
||||
## Integrate with other Cacti plugins
|
||||
|
||||
On the reviewed plugin default branches, Intropage exposes the external
|
||||
registration API above. Several other dashboards use the shared card
|
||||
markup or controller with a catalog owned by the host plugin. For a
|
||||
contribution to one of those dashboards, add the card to its catalog,
|
||||
implement its renderer, and test its own refresh and permission paths.
|
||||
Register separately with Intropage if users should see it there too.
|
||||
|
||||
| Plugin dashboard | Where to integrate a card |
|
||||
| --- | --- |
|
||||
| APC UPS | Choose the per-UPS or fleet catalog. Register the key in that catalog and render the body for the selected UPS or fleet. [APC UPS dashboard][apc-host] |
|
||||
| Host MIB | Add metadata and a body renderer to the host dashboard. Check availability for the selected device and preserve its host scope on refresh. [Host MIB dashboard][hmib-host] |
|
||||
| MacTrack | Add the key and title to the dashboard catalog and implement the matching card body. Its JavaScript adapter reloads cards by key. [MacTrack dashboard][mac-host] |
|
||||
| Syslog | Extend the status dashboard's card definitions and renderer. Preserve its filters when fetching refreshed markup. [Syslog dashboard][sys-host] |
|
||||
| TopX | Extend the overview catalog and select the records for the requested timespan. Its adapter can refresh the body in place. [TopX dashboard][topx-host] |
|
||||
| Alarm Manager | Its alarm statistics page renders shared card headers and bodies with a plugin-specific collapse button and chart loader. Extend that page's chart list and data response. [Alarm Manager dashboard][alarm-host] |
|
||||
|
||||
### Use existing plugin data in Intropage
|
||||
|
||||
Intropage also ships panels for other plugins. These definitions live in
|
||||
Intropage. Enable the data-providing plugin, grant the relevant panel
|
||||
permission, and use the dashboard picker. Reuse the existing panel when
|
||||
it already shows what you need.
|
||||
|
||||
| Data provider | What Intropage already displays |
|
||||
| --- | --- |
|
||||
| MacTrack | Device-tracking details and sites. [MacTrack panels][ip-mac] |
|
||||
| Syslog | Details, top devices and message levels. [Syslog panels][ip-sys] |
|
||||
| Thold | Threshold status and recent threshold events. [Threshold panels][ip-thold] |
|
||||
| Maint | Maintenance schedule details. [Maintenance panel][ip-misc] |
|
||||
| Webseer | Webseer checks for installations using this plugin. [Webseer panel][ip-misc] |
|
||||
| Servcheck | Service-check details. [Servcheck panel][ip-misc] |
|
||||
| Monitor | The Analyze panel can report devices missing monitoring when Monitor is enabled. This is part of the existing analysis panel. [Analyze panel][ip-monitor] |
|
||||
|
||||
## Choose a widget
|
||||
|
||||
All five helpers return a string. Pass plain text labels, including translated
|
||||
labels, and print the returned HTML once. The helpers escape their labels.
|
||||
Give each measurement a unit or a denominator that the reader can interpret.
|
||||
|
||||
| Helper and arguments, in order | What the reader sees |
|
||||
| --- | --- |
|
||||
| `card_gauge($percent, $center_label, $sub_label = '', $severity = 'none')` | A semicircle filled from 0 to 100 with a central value and optional caption. |
|
||||
| `card_bar($percent, $label = '', $severity = 'none')` | A horizontal percentage bar and optional label beneath it. |
|
||||
| `card_stat($value, $label)` | A large formatted value with a caption. Format its units before passing it. |
|
||||
| `card_stackbar($segments, $legend = false)` | One bar with a segment for each array entry. Each entry has `percent`, `severity`, and an optional `label`. Set the second argument to true to show labeled legend chips. |
|
||||
| `card_bullet($min, $avg, $max, $label, $summary = '', $severity = 'none', $scale_min = 0.0, $scale_max = 100.0)` | A colored band from minimum to maximum, an average marker, and the two scale endpoints. All five numbers use the same measurement unit. |
|
||||
|
||||
Calculate percentages from a common total before building a stacked bar.
|
||||
The helper clamps individual percentages to the range 0–100 and leaves
|
||||
their relative totals to the caller. For a bullet, supply an increasing
|
||||
scale and measurements from the same sampling window. Handle missing
|
||||
measurements and a zero denominator before calling a helper. Display
|
||||
**No data** when the source has no sample. The stable and development
|
||||
implementations differ in how they handle non-finite numeric inputs.
|
||||
|
||||
`card_severity($value)` normalizes a widget severity. The aliases `up` and
|
||||
`good` select green by default. `warn`, `warning`, and `recovering` select
|
||||
warning styling. `down`, `bad`, and `error` select error styling. Other
|
||||
values use `none`. For a card header, set `data-severity` to the normalized
|
||||
token. Pair the color with a label such as **2 down**.
|
||||
|
||||
## Grid, controls, and themes
|
||||
|
||||
- Give each card a unique, stable string in `data-card`. The controller
|
||||
uses that ID to match a refresh to the live card and to serialize order.
|
||||
Keep the grid's direct children in reading order. Put toolbars outside it.
|
||||
- Set `--cc-cols` on the grid to choose a column count (default 4).
|
||||
The width classes run from `.ccW1` to `.ccW8`. At narrow breakpoints,
|
||||
use a plugin stylesheet to reduce both column count and card spans.
|
||||
- Use `data-expandable="1"` for a card with more content than its preview.
|
||||
The controller synchronizes `data-expanded` and `.ccCardExpanded`.
|
||||
The stylesheet clips the collapsed body at 210 CSS pixels. Include both
|
||||
expand and collapse buttons so keyboard focus can move between them.
|
||||
- For stepped resizing, set `data-size-model="steps"`, a numeric
|
||||
`data-height`, and a matching `.ccH1`, `.ccH2`, or `.ccH3` class.
|
||||
Implement the size limits in your adapter. Return markup with the new
|
||||
class and height together so the saved state matches the visible layout.
|
||||
- Use focusable buttons for `.ccDrag` and `.ccTool`. Give each icon-only
|
||||
button an accessible name. On the handle, Left or Up moves one position
|
||||
earlier, and Right or Down moves one later.
|
||||
- Set theme variables on the grid to scope them to the dashboard. Examples
|
||||
include `--cc-card`, `--cc-text`, `--cc-border`, `--cc-header-bg`,
|
||||
`--cc-header-fg`, and `--cc-sev-warn`. Check text and controls against
|
||||
their background in a light and a dark theme.
|
||||
|
||||
## Adapter reference
|
||||
|
||||
Pass an object as the second argument to `CactiCards.init(grid, adapter)`.
|
||||
Initialization runs once per grid element. If Cacti replaces the entire
|
||||
grid during navigation, initialize the new element after inserting it.
|
||||
|
||||
| Member | When it runs and what to return |
|
||||
| --- | --- |
|
||||
| `cardSelector`, `idAttr` | Override the controller's card selector and ID attribute. The defaults are `.ccCard` and `data-card`. Keep the shared CSS classes when using the core stylesheet. |
|
||||
| `fetchCard(id, state)` | Refresh one card. Return its complete HTML or a promise for it. State contains `expanded` and `height`. A null result leaves the markup in place. |
|
||||
| `onRefresh(id, card)` | Takes precedence over `fetchCard`. Use this when the plugin replaces only the body. The host owns completion, ordering, and error feedback on this path. |
|
||||
| `onResize(id, direction, card)` | A grow or shrink button was activated. Return replacement HTML, directly or through a promise, or update the live card in the callback. |
|
||||
| `maximize(id, mode, card)` | Open a host-provided detail view. Mode comes from `data-maximize` and defaults to `body`. Manage dialog focus and return it when the dialog closes. |
|
||||
| `addControl`, `onAddCard(id)` | Supply a select element or its DOM ID. On change, return the new card's complete HTML or a promise. Use the empty option as the prompt. |
|
||||
| `onRemoveCard(id, card)` | Return a promise when removal must be confirmed by storage. Rejection keeps the card. Without a callback, removal updates the current grid only. |
|
||||
| `onLayoutChange(state)` | Receives the current order, expanded flags, and heights after a layout change. Calls are debounced by 250 ms. The host chooses storage and handles write failures. |
|
||||
| `applyTheme(grid)` | Set host-specific theme variables. Runs on initialization and when the controller adds or replaces a card. |
|
||||
|
||||
For controller-managed replacement, a refresh requested during a resize
|
||||
waits for that card's resize to finish. If a user toggles expansion during
|
||||
a pending refresh, the controller preserves the live choice when the
|
||||
returned card can still expand. Keep scripts and event handlers in your
|
||||
plugin JavaScript when returning a fragment. Render user-visible data with
|
||||
the same authorization and escaping as the initial page.
|
||||
|
||||
## Save and restore a layout
|
||||
|
||||
With the example grid open, run the following in the browser console.
|
||||
|
||||
```javascript
|
||||
const grid = document.getElementById('carddemo-grid');
|
||||
CactiCards.serialize(grid, {});
|
||||
```
|
||||
|
||||
After the reorder and expansion above, the result has this shape.
|
||||
|
||||
```json
|
||||
{
|
||||
"order": ["devices", "load"],
|
||||
"cards": {
|
||||
"devices": { "expanded": false, "height": 1 },
|
||||
"load": { "expanded": true, "height": 1 }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To retain changes across visits, add `onLayoutChange` to the adapter passed
|
||||
during the original initialization. Save a user's layout under that user's
|
||||
account and dashboard ID. For server storage, use Cacti's authenticated
|
||||
request and CSRF handling for writes. Allow only authorized card IDs,
|
||||
discard duplicates, and validate heights against each card's limits.
|
||||
|
||||
On the next visit, intersect the saved order with the current catalogue.
|
||||
Decide where newly available cards belong. Render cards in that order and
|
||||
apply the saved `data-expanded`, `data-height`, and size class **before**
|
||||
calling `init`. Pass the same adapter to `serialize` if you customized
|
||||
the selector or ID attribute.
|
||||
|
||||
For a host that inserts cards itself, `CactiCards.bindCard(grid, adapter,
|
||||
card)` wires a newly attached card. `CactiCards.replaceCard(grid, adapter,
|
||||
oldCard, html)` replaces one card, binds it, reapplies the theme callback,
|
||||
and returns the new element or null. Keep the same stable ID across a
|
||||
replacement.
|
||||
|
||||
## Verify and troubleshoot
|
||||
|
||||
| Symptom | Check |
|
||||
| --- | --- |
|
||||
| Values appear but buttons do nothing | Confirm the page loaded `cards.js`, the grid exists when initialized, and each tool has the `ccTool` class and its `data-tool` action. |
|
||||
| Expand has no visible effect | Check `data-expandable`, the `ccCardBody` wrapper, and whether the contents exceed the collapsed height. |
|
||||
| Grow does not change height | Confirm the steps model, the adapter's size calculation, and the matching row class and numeric height in the response. |
|
||||
| Refresh shows the login page or a whole dashboard | Inspect the response after signing in again. The fragment route must return exactly one authorized card with the requested ID. |
|
||||
| A layout reverts after reloading | Inspect the saved state and verify that the next full-page render restores it before initialization. |
|
||||
|
||||
Test keyboard reordering, expansion during a slow refresh, and a failed
|
||||
refresh with the browser open. Verify that keyboard focus follows the move
|
||||
handle and that a failed refresh preserves the existing content. If your
|
||||
plugin saves layouts, also test reload, a removed card ID, and two users
|
||||
with different permissions.
|
||||
|
||||
## Implementation references
|
||||
|
||||
- [PHP widgets and page assets on develop][php-dev]
|
||||
- [PHP widgets and page assets on 1.2.x][php-stable]
|
||||
- [JavaScript controller and adapter implementation][controller]
|
||||
- [Card layout and control styles][chrome]
|
||||
- [Widget markup styles][widgets]
|
||||
- [Controller regression tests][tests]
|
||||
|
||||
[ip-shot]: images/card-api-intropage.png
|
||||
[ip-api]:
|
||||
<https://github.com/Cacti/plugin_intropage/blob/8b22359a101374741699b5dba1e154d553a9ff6c/includes/registration.php>
|
||||
[apc-host]:
|
||||
<https://github.com/Cacti/plugin_apcupsd/blob/a52bc99d81ab4e596085e62532dacd20db3dc802/includes/dashboard.php>
|
||||
[mac-host]:
|
||||
<https://github.com/Cacti/plugin_mactrack/blob/49b633f20ab53bd228b298ca138f19b27c7c29a4/mactrack_view_dashboard.php>
|
||||
[sys-host]:
|
||||
<https://github.com/Cacti/plugin_syslog/blob/8e128f720b72697f4378fa79c6d722ba4ed08093/syslog.php>
|
||||
[hmib-host]:
|
||||
<https://github.com/Cacti/plugin_hmib/blob/82659c4293868aa1bd0528845f67583825ba6f87/hmib.php>
|
||||
[topx-host]:
|
||||
<https://github.com/Cacti/plugin_topx/blob/5e4f10c8507cf9f517f521abd633a59e3c0557c7/includes/dashboard.php>
|
||||
[alarm-host]:
|
||||
<https://github.com/Cacti/plugin_alarmmanager/blob/ac81a262a60a6aa4ac1e34f6956622c2b5ae3520/includes/web_view.php>
|
||||
[ip-mac]:
|
||||
<https://github.com/Cacti/plugin_intropage/blob/8b22359a101374741699b5dba1e154d553a9ff6c/panellib/mactrack.php>
|
||||
[ip-misc]:
|
||||
<https://github.com/Cacti/plugin_intropage/blob/8b22359a101374741699b5dba1e154d553a9ff6c/panellib/misc.php>
|
||||
[ip-thold]:
|
||||
<https://github.com/Cacti/plugin_intropage/blob/8b22359a101374741699b5dba1e154d553a9ff6c/panellib/thold.php>
|
||||
[ip-sys]:
|
||||
<https://github.com/Cacti/plugin_intropage/blob/8b22359a101374741699b5dba1e154d553a9ff6c/panellib/syslog.php>
|
||||
[ip-monitor]:
|
||||
<https://github.com/Cacti/plugin_intropage/blob/8b22359a101374741699b5dba1e154d553a9ff6c/panellib/analyze.php>
|
||||
[overview]: images/card-api-overview.png
|
||||
[expanded]: images/card-api-expanded.png
|
||||
[php-dev]:
|
||||
<https://github.com/Cacti/cacti/blob/32e8be90738ed35136f55d6a0dba68906cf792e2/lib/html.php#L3319-L3569>
|
||||
[php-stable]:
|
||||
<https://github.com/Cacti/cacti/blob/06bcf95c3857bcd5c95719d4b33aa579774b38aa/lib/html.php#L2769-L3040>
|
||||
[controller]:
|
||||
<https://github.com/Cacti/cacti/blob/32e8be90738ed35136f55d6a0dba68906cf792e2/include/js/cards.js>
|
||||
[chrome]:
|
||||
<https://github.com/Cacti/cacti/blob/32e8be90738ed35136f55d6a0dba68906cf792e2/include/css/cards.css>
|
||||
[widgets]:
|
||||
<https://github.com/Cacti/cacti/blob/32e8be90738ed35136f55d6a0dba68906cf792e2/include/css/card-widgets.css>
|
||||
[tests]:
|
||||
<https://github.com/Cacti/cacti/blob/32e8be90738ed35136f55d6a0dba68906cf792e2/tests/js/cards_controller.test.js>
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,39 @@
|
||||
# Harden a Cacti installation
|
||||
|
||||
Apply these checks to the main server and to each remote collector. Start
|
||||
with the service accounts and paths from your distribution's installation
|
||||
guide. Test changes on a representative host while you can still restore
|
||||
the previous configuration.
|
||||
|
||||
## Separate runtime data from application files
|
||||
|
||||
Identify the web, scheduler and poller accounts. Give the process that
|
||||
writes each RRD or log directory access to that directory. Keep PHP
|
||||
application files and plugin code writable by the deployment account.
|
||||
Restrict the database configuration files to the accounts that read them.
|
||||
After changing ownership, confirm that a web login succeeds, a fresh poll
|
||||
produces a log entry, and an existing graph gets a new data point.
|
||||
|
||||
## Limit network access
|
||||
|
||||
Allow the web interface over HTTPS for its intended users. Restrict
|
||||
database access to the hosts that require it, including both connection
|
||||
directions for [remote collectors](How-To-Setup-Remote-Pollers.md). Use
|
||||
read-only device credentials for polling. Keep install packages, database
|
||||
exports and backups outside the web root.
|
||||
|
||||
## Verify the web server configuration
|
||||
|
||||
The distribution includes Apache access rules for directories such as
|
||||
`cli/` and `log/`. Confirm the deployed virtual host enforces the
|
||||
restrictions. Nginx needs equivalent location rules. Request the path to
|
||||
an existing CLI script or log from a test client and verify that access is
|
||||
denied. Then open a normal graph page and verify that it still renders.
|
||||
|
||||
Use the [Enterprise Linux](Install-Under-Enterprise-Linux-LAMP.md) or
|
||||
[Ubuntu/Debian](Installing-Under-Ubuntu-Debian.md) installation guide for
|
||||
the service configuration on your platform.
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,213 @@
|
||||
# Alarm Manager
|
||||
|
||||
Alarm Manager lets Cacti administrators route alarms to notification services
|
||||
and scripts. It records each alarm event, tracks which conditions are active,
|
||||
uses alarm rules to decide which destinations should be told, queues the
|
||||
deliveries and keeps the results. Other plugins submit alarms through the
|
||||
`alarmmanager_submit` hook, and the plugin also captures confirmed Cacti device
|
||||
down and recovery states after each polling cycle.
|
||||
|
||||
This page follows the plugin's `main` branch, which is unreleased and can
|
||||
change. In its `INFO` file that branch declares version 0.12.2 and
|
||||
compatibility with Cacti 1.2.29. Check the release you install for differences.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Cacti 1.2.29 or later, as declared in the `INFO` file. The `INFO` file lists
|
||||
no required plugins.
|
||||
- PHP 8.2 or later with the `openssl` extension. Installation returns failure
|
||||
when either is missing.
|
||||
- MariaDB 10.11 or later. The schema step stops with `requires_mariadb_10_11`
|
||||
on other databases.
|
||||
- The PHP `curl` extension for REST API and webhook destinations.
|
||||
- The PHP `pcntl` and `posix` extensions for delivery workers and the daemon,
|
||||
and `/usr/bin/setsid` for email, script and SNMP trap delivery.
|
||||
- Cacti's `snmptrap` binary (the `path_snmptrap` setting) for SNMP trap
|
||||
destinations. The path must be absolute.
|
||||
- Cacti's `DEBUG_SQL_FLOW` option must not be defined. The plugin does not run
|
||||
while it is set.
|
||||
|
||||
## Installation
|
||||
|
||||
Follow the generic steps in [Plugin Management](Plugins.md). The plugin
|
||||
directory must be named `alarmmanager`. Plugin-specific points:
|
||||
|
||||
- Installing creates the database schema and an encryption key. The key is
|
||||
stored in the `settings_user` table as `alarmmanager_key` for user 1. Back it
|
||||
up: encrypted destination credentials cannot be read without it, and enabling
|
||||
or upgrading the plugin fails when the key is missing or malformed.
|
||||
- Uninstalling keeps the key and the alarm history for recovery.
|
||||
- On a distributed installation, put the plugin files on the main poller and on
|
||||
every collector, and enable the plugin on the main poller. Manage
|
||||
destinations, rules and credentials on poller 1. Script executables and
|
||||
custom CA files must exist at the same paths on each collector that delivers
|
||||
with them.
|
||||
- To run workers in a resident service, copy `service/alarmmanager.service` from
|
||||
the plugin to your systemd unit directory, edit the user, group, working
|
||||
directory and PHP path, and start it. Then tick **Enable Daemon** in the
|
||||
settings.
|
||||
|
||||
## Permissions
|
||||
|
||||
The plugin registers two realms in `setup.php`.
|
||||
|
||||
| Realm | Page | Allows |
|
||||
| --- | --- | --- |
|
||||
| Alarm Manager View | `alarmmanager.php` | The **Alarm Manager** tab: Dashboard, Active conditions and Events. |
|
||||
| Alarm Manager Administration | `alarmmanager_admin.php` | The **Alarm Manager Settings** group. Also requires Cacti realm 1 and an enabled authentication method. |
|
||||
|
||||
Users with only the view realm see alarms for the devices they are allowed to
|
||||
see in Cacti.
|
||||
|
||||
## Settings
|
||||
|
||||
Settings are under **Console > Configuration > Settings > Alarm Manager**.
|
||||
Cacti replicates them to collectors.
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| Offline Summary | Device Offline | Summary of new device down alarms. Existing history keeps its original summary. |
|
||||
| Recovering Summary | Device Recovering | Summary for recovering updates within the same outage. |
|
||||
| Online Summary | Device Online | Summary for recovery alarms once Cacti confirms the device is up. |
|
||||
| Keep Alert History For | 90 | Number of days, weeks or months to keep history. Maximum 3650 days, 520 weeks or 120 months. |
|
||||
| Retention Unit | Indefinitely | Days, Weeks, Months or Indefinitely. With Indefinitely, nothing is purged and the number is ignored. |
|
||||
| Enable Daemon | off | Run processing and delivery workers in the resident service instead of the Cacti poller. |
|
||||
| Processing Workers | 2 Worker Processes | Daemon workers that evaluate rules: 1, 2, 4, 6, 8 or 16. |
|
||||
| Delivery Workers | 4 Worker Processes | Daemon workers that deliver notifications: 0, 1, 2, 4, 6, 8 or 16. |
|
||||
|
||||
The purge job runs with the poller. It removes aged events together with their
|
||||
decisions, deliveries and attempts, and never removes active conditions or
|
||||
queued or failed work. Each collector purges its own history.
|
||||
|
||||
## Using Alarm Manager
|
||||
|
||||
### The Alarm Manager tab
|
||||
|
||||
Users with the view realm get an **Alarm Manager** tab in the Cacti header. It
|
||||
has three pages: **Dashboard**, **Active conditions** and **Events**. The
|
||||
screenshot shows the Events page with synthetic demo alarms. Above the table
|
||||
are search conditions that you build with AND, OR, NOT and groups, a time range
|
||||
and refresh choice, and quick filters for source, severity, device and
|
||||
collector.
|
||||
|
||||
![Alarm Manager Events page with synthetic alarms][alarmmanager-image]
|
||||
|
||||
The table lists the collector, time received, source, transition, severity,
|
||||
device, event ID, summary, payload, routing decision and integration status of
|
||||
each event. Open one event to see its deliveries and to replay failed jobs.
|
||||
Time ranges on the history pages use UTC, while current conditions and queues
|
||||
ignore the time window.
|
||||
|
||||
### Administration pages
|
||||
|
||||
Users with the administration realm get a **Alarm Manager Settings** group in
|
||||
the console menu, placed after **Import/Export**. It has these pages:
|
||||
|
||||
| Page | Purpose |
|
||||
| --- | --- |
|
||||
| Alarm Destinations | Create destinations, preview the payload, send a test and enable them. |
|
||||
| Alarm Rules | Create rules that match alarms and select destinations. |
|
||||
| Credentials | Manage the encrypted credentials used by destinations. |
|
||||
| Configuration Backup/Restore | Export and import configuration. |
|
||||
| Alarm Queue | Inspect waiting messages, pause and resume delivery, and clear waiting deliveries. |
|
||||
| Workers and failed processing | Worker status and failed jobs. |
|
||||
|
||||
Destination types are Webhook / REST API, Email, Script, SNMP trap and Syslog.
|
||||
Presets exist for Slack, Microsoft Teams (Workflows), Telegram, Twilio SMS,
|
||||
Twilio WhatsApp, PagerDuty Events v2, ServiceNow incidents and ServiceNow
|
||||
events. A WebSocket destination type is not implemented.
|
||||
|
||||
### Set up your first alarm route
|
||||
|
||||
1. Open **Alarm Manager Settings > Alarm Destinations** and add a destination,
|
||||
from a preset or a generic type.
|
||||
2. Replace the placeholder values and enter the credentials.
|
||||
3. Preview the payload and use **Test destination** to queue one test send.
|
||||
4. Enable the destination.
|
||||
5. Open **Alarm Rules** and create an enabled rule with conditions and the
|
||||
destination selected. An enabled destination alone sends nothing.
|
||||
6. Check the **Events** page for the routing decision and the delivery result.
|
||||
|
||||
## How It Collects Data
|
||||
|
||||
Alarm Manager has two sources of alarms. Source plugins call the
|
||||
`alarmmanager_submit` hook with an event envelope (see `examples/event.json` in
|
||||
the plugin), and Cacti's `admin_alert` hook is handled as well. The plugin also
|
||||
checks device status after each poller cycle and records device down,
|
||||
recovering and online alarms.
|
||||
|
||||
The `poller_bottom` hook does the work after every polling cycle:
|
||||
|
||||
- It applies daemon settings and checks device status.
|
||||
- It purges aged history according to **Keep Alert History For**.
|
||||
- Unless the daemon is enabled and running, it runs one pass of the processing
|
||||
and delivery workers inside the poller and logs a line starting with
|
||||
`ALARMMANAGER STATS:`.
|
||||
|
||||
With **Enable Daemon** on, the resident service runs the workers instead.
|
||||
Disabling it lets current jobs finish and returns processing to the poller.
|
||||
On collectors, each collector processes and delivers its own alarms, and
|
||||
collector history is sent back to the main poller.
|
||||
|
||||
## Command-Line Tools
|
||||
|
||||
Run these as the Cacti poller user from the plugin directory. Each prints its
|
||||
usage with `--help`.
|
||||
|
||||
```console
|
||||
php cli/status.php
|
||||
php cli/submit_event.php --file=examples/event.json
|
||||
php cli/endpoint.php --endpoint=1 --file=examples/event.json --preview|--test-send
|
||||
php cli/producers.php --retry-pending [--limit=100]
|
||||
php cli/credentials.php --save=ENDPOINT_ID --file=/secure/credentials.json
|
||||
php cli/credentials.php --backup-dir=/secure/new-backup
|
||||
php cli/credentials.php --rotate
|
||||
php cli/credentials.php --restore=/secure/credentials.json --key-file=/secure/key.txt --replace-local-credentials
|
||||
php cli/remote.php --identity
|
||||
php cli/remote.php --export-for=2 --endpoints=1,2 --output=/secure/poller-config.json
|
||||
php cli/remote.php --provision=/secure/poller-config.json
|
||||
php cli/remote.php --configure=/secure/routing.json
|
||||
php cli/remote.php --grant-file=/secure/device-grant.json
|
||||
php cli/remote.php --send [--limit=100]
|
||||
php cli/remote.php --seed=event|processing|decision|delivery|attempt [--after=0 --limit=100]
|
||||
php alarmmanager_daemon.php [--config=/path/to/workers.json]
|
||||
```
|
||||
|
||||
- `--preview` sends nothing. `--test-send` queues one explicit test for the
|
||||
delivery workers.
|
||||
- For `cli/credentials.php`, use `--file=php://stdin` to avoid storing
|
||||
plaintext input. Restore also provisions an authorized remote poller and
|
||||
replaces its entire local key and credential set.
|
||||
- `cli/producers.php` retries bounded pending receipts from source plugins,
|
||||
using their original event IDs.
|
||||
- `alarmmanager_daemon.php` is the command the service runs. Without
|
||||
`--config`, worker counts come from the settings.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- The plugin does not enable or upgrade: check the PHP version, that `openssl`
|
||||
is loaded, that the MariaDB version is 10.11 or later, and that the
|
||||
`alarmmanager_key` row in `settings_user` exists.
|
||||
- No notification is sent: confirm that an enabled rule matches the alarm and
|
||||
selects an enabled destination. The Events page shows `No matching rule` when
|
||||
nothing matched.
|
||||
- Deliveries wait in the queue: check whether the queue is paused on the **Alarm
|
||||
Queue** page, and whether workers run (**Workers and failed processing**).
|
||||
- SNMP trap delivery fails with `snmptrap_unavailable` when `path_snmptrap` is
|
||||
not an absolute executable path, or when `posix` or `/usr/bin/setsid` is
|
||||
missing.
|
||||
- Cacti log lines from this plugin use the name `Alarm Manager`.
|
||||
|
||||
## More Information
|
||||
|
||||
- [Alarm Manager repository](https://github.com/Cacti/plugin_alarmmanager)
|
||||
- [Alarm Manager README][readme]
|
||||
- [Plugin Management](Plugins.md)
|
||||
- [Supported plugins](supported-plugins.md)
|
||||
|
||||
[alarmmanager-image]: images/plugin-alarmmanager-events.png
|
||||
[readme]: https://github.com/Cacti/plugin_alarmmanager/blob/main/README.md
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,207 @@
|
||||
# Audit
|
||||
|
||||
The Audit plugin records who changed what in Cacti, when, and from which IP
|
||||
address, so that administrators can trace a problem back to a user action. It
|
||||
logs submitted web requests and command-line scripts to the Cacti database, can
|
||||
copy events to a file or to a remote Syslog receiver, and can record login and
|
||||
access-denied events. Administrators who need an activity trail for compliance
|
||||
or troubleshooting use it.
|
||||
|
||||
This page follows the plugin's `develop` branch, which is unreleased and can
|
||||
change. In its `INFO` file that branch declares version 1.7 and compatibility
|
||||
with Cacti 1.2.29. Check the release you install for differences.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Cacti 1.2.29 or later, as declared in the `INFO` file. The `INFO` file lists
|
||||
no required plugins.
|
||||
- Remote Syslog delivery uses PHP stream sockets. The **TLS** transport needs a
|
||||
PHP build with TLS stream support.
|
||||
- Authentication auditing reads Cacti's `user_log` table and needs indexes that
|
||||
you create once with a command-line script (see
|
||||
[Authentication events](#authentication-events)).
|
||||
|
||||
## Installation
|
||||
|
||||
Follow the generic steps in [Plugin Management](Plugins.md). The plugin
|
||||
directory must be named `audit`. Plugin-specific points:
|
||||
|
||||
- Installing creates the tables `audit_log`, `audit_syslog_delivery` and
|
||||
`audit_user_log_state`, registers the hooks and realms, and grants both
|
||||
realms to the user who installs the plugin.
|
||||
- Authentication auditing, failed-login detection and remote Syslog are off
|
||||
after installation. Turn them on in the settings when you need them.
|
||||
- Uninstalling drops the three tables and removes the plugin's settings, so
|
||||
export any events you need first.
|
||||
|
||||
## Permissions
|
||||
|
||||
The plugin registers two realms in `setup.php`. They appear under **Audit
|
||||
Plugin** in the user permissions.
|
||||
|
||||
| Realm | Page | Allows |
|
||||
| --- | --- | --- |
|
||||
| Audit Log User | `audit.php` | Viewing, searching and exporting the audit log. |
|
||||
| Audit Log Admin | `audit_manage.php` | Purging the log, the plugin's settings, Test Syslog and Retry Dead-letter. |
|
||||
|
||||
## Settings
|
||||
|
||||
Settings are under **Console > Configuration > Settings > Audit**. The fields
|
||||
are shown to users with the Audit Log Admin realm.
|
||||
|
||||
### Audit Log Settings
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| Enable Audit Log | on | Track GUI activity. |
|
||||
| Audit Log Retention | 3 Months | How long entries are kept: 2 Weeks, 1 Month, 2 Months, 3 Months, 4 Months, 6 Months, 1 Year, 2 Years, 3 Years or Indefinitely. |
|
||||
| External Audit Log | off | Also write each event to an external file. |
|
||||
| External Audit Log Format | JSON | Text or JSON. |
|
||||
| External Audit Log Log file Path | `/var/www/html/cacti/log/audit.log` | Path of the external file. |
|
||||
|
||||
### Authentication Auditing
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| Enable Authentication Auditing | off | Capture new login, logout, token, password-change and authorization-denied events from this point forward. |
|
||||
| Enable Failed-login Volume Detection | off | Emit one global anomaly event when installation-wide failed logins exceed the threshold. |
|
||||
| Failed-login Window (minutes) | 5 | Rolling window, 1 through 1440. |
|
||||
| Failed-login Volume Threshold | 10 | Failed-login count, 1 through 1000, that triggers the event. |
|
||||
| User Log Ingestion Batch Size | 1000 | Maximum `user_log` rows ingested per poller cycle, 1 through 5000. |
|
||||
|
||||
### Remote Syslog
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| Enable Remote Syslog | off | Queue finalized events for Syslog delivery. The external file stays independent. |
|
||||
| Syslog Receiver | empty | Host name or IP address, without scheme, path or credentials. |
|
||||
| Syslog Port | empty | 1-65535. Empty means 514 for UDP and TCP, and 6514 for TLS. |
|
||||
| Syslog Transport | UDP | UDP, TCP or TLS. TCP and TLS use RFC 6587 octet-count framing. |
|
||||
| Syslog Payload Format | JSON | RFC 5424, CEF or JSON. All use an RFC 5424 header. |
|
||||
| Syslog Facility | `local0` | Facility used to calculate the RFC 5424 priority. |
|
||||
| Syslog Application Name | `cacti-audit` | RFC 5424 APP-NAME, up to 48 printable ASCII characters. |
|
||||
| Audit Node Identity | the server host name | Stable identity of this Cacti node. |
|
||||
| Connection and Write Timeout | 5 | Seconds, 1 through 30. |
|
||||
| Maximum UDP Record Size | 8192 | Larger records are dead-lettered, never truncated. |
|
||||
|
||||
The **Syslog TLS** group has **TLS CA File**, **TLS Client Certificate** and
|
||||
**TLS Client Private Key** (all optional, default empty). Peer and host name
|
||||
verification are always on.
|
||||
|
||||
The **Syslog Delivery Queue** group controls retries:
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| Retry Base Delay | 30 | Initial retry delay in seconds, 1 through 3600. |
|
||||
| Maximum Retry Delay | 3600 | Seconds, from the base delay through 86400. |
|
||||
| Maximum Delivery Attempts | 10 | Attempts before dead-letter, 1 through 100. |
|
||||
| Poller Batch Size | 100 | Records processed per poller cycle, 1 through 1000. |
|
||||
| Pending Age Warning | 900 | Seconds the oldest queued record may wait before an unhealthy warning. |
|
||||
| Dead-letter Warning Count | 1 | Dead-lettered records that trigger the warning. |
|
||||
|
||||
## Using Audit
|
||||
|
||||
Open **Console > Utilities > Audit Log**. On Cacti versions before 1.3 the page
|
||||
is also listed as **View Audit Log** under Technical Support on the System
|
||||
Utilities page.
|
||||
|
||||
The screenshot shows the page filtered to one user, with synthetic events. The
|
||||
**Remote Syslog Delivery** box above the log shows the queue status when Syslog
|
||||
is enabled, and is disabled here.
|
||||
|
||||
![Audit Log page listing synthetic events][audit-image]
|
||||
|
||||
The filter row has **Search** (matches the page name or the submitted data),
|
||||
**Page**, **User** (including `cli` for command-line activity) and **Events**
|
||||
(rows per page), plus the buttons **Go**, **Clear**, **Export** and, for Audit
|
||||
Log Admin users, **Purge**. The table columns are **Page Name**, **User Name**,
|
||||
**Requested Action**, **Request Status**, **External File Delivery**, **User
|
||||
Agent**, **IP Address** and **Event Time**. Hover over an action to see the
|
||||
request data, including the event ID, request status and operation outcome.
|
||||
Sensitive values in submitted data are redacted before they are stored.
|
||||
|
||||
An event starts as started and is finalized as completed or failed. Completed
|
||||
does not guarantee that every operation behind the request succeeded.
|
||||
|
||||
Only web requests that submit data are logged, together with command-line
|
||||
scripts. Pages such as the graph view and the console index are skipped.
|
||||
|
||||
### Purge the log
|
||||
|
||||
1. Open **Console > Utilities > Audit Log** as an Audit Log Admin user.
|
||||
2. Click **Purge** and confirm.
|
||||
|
||||
Events whose Syslog delivery is pending, retrying, sending or dead-lettered are
|
||||
kept, and the page reports how many were protected.
|
||||
|
||||
### Test Remote Syslog
|
||||
|
||||
1. Configure and enable the Remote Syslog settings.
|
||||
2. On the Audit Log page, click **Test Syslog** in the **Remote Syslog
|
||||
Delivery** box.
|
||||
|
||||
The result says the test record was written to the local socket. Syslog does
|
||||
not confirm that the receiver stored it. When dead-lettered records exist,
|
||||
**Retry Dead-letter** resets them for another attempt.
|
||||
|
||||
### Authentication events
|
||||
|
||||
Run this once as the Cacti user from the Cacti directory before you enable
|
||||
**Enable Authentication Auditing**:
|
||||
|
||||
```console
|
||||
php plugins/audit/audit_auth_indexes.php
|
||||
```
|
||||
|
||||
It checks the primary key of Cacti's `user_log` table and adds indexes used for
|
||||
ingestion. It prints `Authentication audit indexes are ready.` on success, or
|
||||
an error and exit code 1 when the key is unsupported or the indexes cannot be
|
||||
created. Uninstalling removes only the indexes that the plugin added.
|
||||
|
||||
## Background Processing
|
||||
|
||||
The `poller_bottom` hook runs after every polling cycle and does the following:
|
||||
|
||||
- Retries failed appends to the external file.
|
||||
- Sends queued Syslog records in batches of **Poller Batch Size**.
|
||||
- When authentication auditing is on, ingests up to **User Log Ingestion Batch
|
||||
Size** new rows from `user_log` and checks for failed-login volume. History
|
||||
from before you enabled it is not imported.
|
||||
- Once per day, deletes events older than **Audit Log Retention**, except
|
||||
events whose Syslog delivery is unfinished, and writes a `NOTE: Purged ...
|
||||
Audit Log Records from Cacti` line to the Cacti log.
|
||||
|
||||
Web requests never send over the network. Events are queued in
|
||||
`audit_syslog_delivery` and the poller sends them.
|
||||
|
||||
## Command-Line Tools
|
||||
|
||||
`audit_auth_indexes.php` is the only script. See
|
||||
[Authentication events](#authentication-events).
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- An external file that is not written: the Cacti log shows `ERROR: Unable to
|
||||
create Audit Log file` or `ERROR: Audit Log file path ... does not exist and
|
||||
the path is not writeable`. Make the directory writable by the web server and
|
||||
poller user. The file must be a regular file and not a symbolic link.
|
||||
- Syslog problems appear in the **Remote Syslog Delivery** box as **Last
|
||||
Error**, or as **Configuration Error** when a setting is invalid.
|
||||
- A record larger than **Maximum UDP Record Size** is dead-lettered. Use TCP or
|
||||
TLS for large events.
|
||||
- A successful write is shown as **Sent (Unconfirmed)** because Syslog gives no
|
||||
receipt. Retries reuse the same event ID, so receivers can deduplicate on it.
|
||||
|
||||
## More Information
|
||||
|
||||
- [Audit repository](https://github.com/Cacti/plugin_audit)
|
||||
- [Audit README][audit-readme]
|
||||
- [Plugin Management](Plugins.md)
|
||||
- [Supported plugins](supported-plugins.md)
|
||||
|
||||
[audit-image]: images/plugin-audit-log.png
|
||||
[audit-readme]: https://github.com/Cacti/plugin_audit/blob/develop/README.md
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,76 @@
|
||||
# Test a Plugin through the Browser
|
||||
|
||||
This test covers installation, an authenticated PHP page, database-backed
|
||||
filtering, sorting, pagination, and realm enforcement. It signs in as two
|
||||
different users in separate Chromium browser contexts. The test starts
|
||||
with the same four records on Cacti develop and 1.2.x.
|
||||
|
||||
## Prepare the fixture
|
||||
|
||||
1. Start a disposable Cacti web installation backed by a separate MariaDB
|
||||
database. Use an application checkout from the branch under test.
|
||||
2. Follow [the filterable page walkthrough](Plugin-Filterable-Page.md) to
|
||||
install the example plugin and insert the four records. The test
|
||||
expects the initial fixture exactly once.
|
||||
3. In **Console > Configuration > Users**, create two enabled local users
|
||||
who can open the console. Grant **View Workflow Example** to the first.
|
||||
Leave it unassigned for the second, including through group memberships.
|
||||
Complete any first-login password change before running the test.
|
||||
4. Use English for these accounts. The example asserts the labels
|
||||
**Name**, **Next**, and **No matching devices**.
|
||||
|
||||
The development branch’s [plugin test harness][harness] supplies locked PHP
|
||||
testing
|
||||
dependencies to CI. Keep its fixture and tooling pins, and keep a plugin's
|
||||
existing database setup and Pest assertions. The browser test below needs
|
||||
a running web server, a database, and the JavaScript Playwright package.
|
||||
|
||||
## Run the example
|
||||
|
||||
Download [the browser test](resources/workflowdemo-browser.cjs) as
|
||||
`workflowdemo-browser.cjs`. Put it in a project directory where Node can
|
||||
resolve the `playwright` package. For example, copy it to `tests/e2e/` in
|
||||
a Cacti develop checkout with that directory's locked dependencies
|
||||
installed. You can use the same runner against a 1.2.x web installation.
|
||||
|
||||
Supply `CACTI_URL` as the base application URL with a trailing slash,
|
||||
including the Cacti subdirectory if present. Supply `ALLOWED_USER`,
|
||||
`ALLOWED_PASSWORD`, `DENIED_USER`, and `DENIED_PASSWORD` through your
|
||||
local test environment or CI secret store. Point `CHROME_BIN` at an
|
||||
existing Chromium executable, or install Playwright's matching Chromium.
|
||||
|
||||
```console
|
||||
node workflowdemo-browser.cjs
|
||||
```
|
||||
|
||||
Exit status zero means all assertions passed. Set `SCREENSHOT` to a
|
||||
writable PNG path to capture the authorized user's filtered second page.
|
||||
|
||||
## Know what each assertion proves
|
||||
|
||||
| Browser action | Expected result |
|
||||
| --- | --- |
|
||||
| Open the example as the permitted user | The initial rows are core-a and edge-a. |
|
||||
| Search for edge | The first page contains edge-a and edge-b. |
|
||||
| Select Name to reverse the order | The rows become edge-c and edge-b. |
|
||||
| Select Next | Only edge-a remains. The search and sort survive navigation. |
|
||||
| Search for absent | The empty-results message appears with zero data rows. |
|
||||
| Sign in as the restricted user and open the same URL directly | Cacti recognizes the user, denies access, and returns no example rows. |
|
||||
|
||||
The test checks the logged-in username before opening the plugin.
|
||||
Otherwise a redirect to the login screen could be mistaken for a successful
|
||||
permission check. It asserts row contents after each action so an unchanged
|
||||
page or stale asynchronous response fails the test.
|
||||
|
||||
If the first assertion fails, inspect the seeded rows, the account's realm,
|
||||
and the plugin status. If navigation fails, inspect the request after
|
||||
pressing Enter and the returned table. Test the
|
||||
[version upgrade](Plugin-Schema-Upgrades.md) separately so a failed schema
|
||||
migration is distinguishable from a browser or permission failure.
|
||||
|
||||
[harness]:
|
||||
<https://github.com/Cacti/cacti/blob/develop/tests/tools/plugin-harness/README.md>
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,164 @@
|
||||
# Credentials
|
||||
|
||||
The Credentials plugin is a central store for the credentials that Cacti
|
||||
administrators and plugin authors need, such as SNMP communities, SSH logins,
|
||||
API tokens and database accounts. A secret is either encrypted in the Cacti
|
||||
database or fetched at poll time from an external secret store. Other plugins
|
||||
read a stored credential with one function call, `credentials_get()`.
|
||||
|
||||
This page follows the plugin's `main` branch, which is unreleased and can
|
||||
change. In its `INFO` file that branch declares version 1.1 and compatibility
|
||||
with Cacti 1.2.29. Check the release you install for differences.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Cacti 1.2.29 or later, as declared in the `INFO` file. The `INFO` file lists
|
||||
no required plugins.
|
||||
- PHP `openssl`, used for encryption of stored secrets (`openssl_encrypt()`)
|
||||
and for signing requests to Google Cloud Secret Manager.
|
||||
- PHP `curl` for the external secret providers. The provider code stops with an
|
||||
error when `curl_init()` is not available.
|
||||
- A Cacti secret encryption key. The plugin stores secrets through Cacti's
|
||||
secret functions. Saving a secret fails with an error message when those
|
||||
functions are unavailable or the key cannot be used.
|
||||
|
||||
## Installation
|
||||
|
||||
Follow the generic steps in [Plugin Management](Plugins.md). The plugin
|
||||
directory must be named `credentials`. Installing creates the `credentials` and
|
||||
`credential_providers` tables. Upgrading adds the `provider_id` column and index
|
||||
to the `credentials` table when they are missing. Uninstalling does not remove
|
||||
the tables.
|
||||
|
||||
The pages are added to the Configuration menu after **User Domains**, or after
|
||||
**Login Providers** when that entry exists.
|
||||
|
||||
## Permissions
|
||||
|
||||
The plugin registers no realm of its own. The pages `credentials.php` and
|
||||
`credential_providers.php` are mapped to the core realm 1, the
|
||||
permission that governs user and group administration. The code comments call
|
||||
it the core Users/Groups permission. A user who has it can manage credentials
|
||||
and secret providers.
|
||||
|
||||
## Settings
|
||||
|
||||
The plugin has no tab under **Console > Configuration > Settings**. Everything
|
||||
is configured on its two pages, **Credentials** and **Secret Providers**, both
|
||||
under **Console > Configuration**.
|
||||
|
||||
## Using Credentials
|
||||
|
||||
### Credentials
|
||||
|
||||
Open **Console > Configuration > Credentials**. The screenshot shows the list
|
||||
with five synthetic credentials of different types. Four are held in the local
|
||||
database and one uses a provider.
|
||||
|
||||
![Credentials list with five synthetic credentials][credentials-image]
|
||||
|
||||
The list has a **Search** box, a **Type** filter and a **Credentials** row
|
||||
count. Its columns are **Name**, **Type**, **Secret Provider**, **Description**,
|
||||
**Owner**, **Enabled** and **Last Updated**. The actions menu on the list offers
|
||||
**Delete**, **Enable** and **Disable** for the selected credentials.
|
||||
|
||||
To add a credential:
|
||||
|
||||
1. Click the plus icon at the top right of the list.
|
||||
2. Enter a **Name**, which must be unique, and an optional **Description**.
|
||||
3. Choose a **Credential Type**. The form fields below change with the type.
|
||||
4. Choose a **Secret Provider**: the local encrypted database, or one of the
|
||||
providers you configured.
|
||||
5. Fill in the type's fields and click **Save**.
|
||||
|
||||
Secret fields are encrypted when stored and are not sent back to the browser.
|
||||
When a value is stored, the form says "A value is currently stored
|
||||
(encrypted)". Leave the field blank to keep it or enter a new value to replace
|
||||
it. With an external provider, each secret field holds a reference that the
|
||||
provider resolves at poll time, and its label shows the provider's reference
|
||||
name, for example **Secret Path and Key** for HashiCorp Vault.
|
||||
|
||||
Changing the type of an existing credential asks for confirmation, because the
|
||||
values stored for the old type are discarded when you save.
|
||||
|
||||
The plugin supports 14 credential types:
|
||||
|
||||
| Group | Types |
|
||||
| --- | --- |
|
||||
| Core polling | SNMP v1/v2c Community, SNMP v3 (USM), Username / Password, SSH |
|
||||
| API and cloud | Bearer / API Token, API Key, GitHub Personal Access Token, OAuth 2.0 Client Credentials, HTTP Basic Auth |
|
||||
| Extended devices | WMI (Windows), IPMI / Redfish (BMC), Database, VMware / vCenter, TLS Client Certificate |
|
||||
|
||||
For example, SNMP v1/v2c Community has **SNMP Version**, **Read Community** and
|
||||
**Write Community**. SNMP v3 (USM) has **Security Name**, **Authentication
|
||||
Protocol**, **Authentication Passphrase**, **Privacy Protocol**, **Privacy
|
||||
Passphrase**, **Context Name** and **Engine ID**. The field definitions are in
|
||||
`includes/arrays.php` in the plugin.
|
||||
|
||||
### Secret providers
|
||||
|
||||
Open **Console > Configuration > Secret Providers**. The list has the columns
|
||||
**Name**, **Type**, **Description**, **Enabled** and **Last Updated**, and the
|
||||
same **Delete**, **Enable** and **Disable** actions. A provider that is still
|
||||
used by a credential is not deleted.
|
||||
|
||||
To add a provider:
|
||||
|
||||
1. Click the plus icon.
|
||||
2. Enter a **Name** and **Description**, and choose a **Provider Type**.
|
||||
3. Fill in the connection fields, which depend on the type. Connection secrets
|
||||
such as tokens and keys are encrypted like credential secrets.
|
||||
4. Click **Save**, then **Test Connection** to check connectivity and
|
||||
authentication. A provider must be saved before it can be tested.
|
||||
|
||||
The provider types are HashiCorp Vault, OpenBao, AWS Secrets Manager, Azure Key
|
||||
Vault, Google Cloud Secret Manager and CyberArk Conjur. You can add any number
|
||||
of instances of each type.
|
||||
|
||||
### Reading a credential from code
|
||||
|
||||
`credentials_get($id)` is declared in
|
||||
`plugins/credentials/includes/functions.php`. It returns an array with the
|
||||
credential's `name`, `description`, `type`, `provider_id`, `user_id`, `enabled`
|
||||
and a `fields` array keyed by the type's field names, with secrets decrypted or
|
||||
resolved through the provider. It returns `false` when the credential does not
|
||||
exist.
|
||||
|
||||
```php
|
||||
require_once $config['base_path'] . '/plugins/credentials/includes/functions.php';
|
||||
|
||||
$credential = credentials_get($credential_id);
|
||||
|
||||
if ($credential === false) {
|
||||
cacti_log('Credential not found');
|
||||
return;
|
||||
}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- "Cannot store a secret: the Cacti core secret encryption functions are
|
||||
unavailable on this installation." appears when encryption is not available
|
||||
on the Cacti installation.
|
||||
- "Could not encrypt the secret. Verify the Cacti encryption key configuration
|
||||
and try again." means encryption failed. The Cacti log then has a line that
|
||||
starts with `ERROR: CREDENTIALS - secret encryption failed`.
|
||||
- "The selected secret provider is disabled." and "The selected secret
|
||||
provider does not exist." appear when you save a credential that points to a
|
||||
provider that is disabled or gone.
|
||||
- "Save the provider before testing it." appears when you use **Test
|
||||
Connection** on an unsaved provider.
|
||||
|
||||
## More Information
|
||||
|
||||
- [Credentials repository](https://github.com/Cacti/plugin_credentials)
|
||||
- [Credentials README][readme]
|
||||
- [Plugin Management](Plugins.md)
|
||||
- [Supported plugins](supported-plugins.md)
|
||||
|
||||
[credentials-image]: images/plugin-credentials-list.png
|
||||
[readme]: https://github.com/Cacti/plugin_credentials/blob/main/README.md
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,107 @@
|
||||
# Cycle
|
||||
|
||||
The Cycle plugin shows Cacti graphs one page at a time and advances
|
||||
automatically after a delay. It suits operations displays that show a changing
|
||||
set of graphs without anyone clicking through them. The set can come from a
|
||||
graph tree or branch, from a list of graph IDs, or from all graphs.
|
||||
|
||||
This page follows the plugin's `develop` branch, which is unreleased and can
|
||||
change. The branch declares version 4.3 and Cacti compatibility 1.2.29 in its
|
||||
`INFO` file. It is not presented here as a released version.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Cacti 1.2.29 or later, as declared in `INFO` (version 4.3).
|
||||
- No other plugins, PHP extensions, or external programs are required.
|
||||
- The plugin creates no database tables.
|
||||
|
||||
## Installation
|
||||
|
||||
Copy the plugin into `plugins/cycle` in the Cacti directory, then install and
|
||||
enable it as described in [Plugin Management](Plugins.md). Grant the
|
||||
**Plugin -> Cycle Graphs** realm to the users who need the view.
|
||||
|
||||
## Permissions
|
||||
|
||||
| Realm | Pages |
|
||||
| --- | --- |
|
||||
| **Plugin -> Cycle Graphs** | `cycle.php` |
|
||||
|
||||
The graph refresh is served by `cycle.php` with `action=graphs`. Graphs a user
|
||||
cannot access are not shown.
|
||||
|
||||
## Settings
|
||||
|
||||
Defaults are set on the **Cycle** tab of **Console > Configuration >
|
||||
Settings**. Each user can override the same fields in their own profile,
|
||||
under the **Cycle** tab of the graph settings.
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| **Delay Interval** | 60 | Time in seconds before the next graph is displayed. |
|
||||
| **Graph Timespan** | 5 | Default timespan of the displayed graphs (a Cacti timespan option). |
|
||||
| **Column Count** | 2 | In Tree Mode, the number of columns used. |
|
||||
| **Number of Graphs per Page** | 4 | Graphs shown at one time (1, 2, 4, 6, 8, or 10). |
|
||||
| **Graph Height** | 100 | Graph height in pixels (75 to 500). |
|
||||
| **Graph Width** | 400 | Graph width in pixels (100 to 1500). |
|
||||
| **Display Legend** | unset | Show the graph legend. |
|
||||
| **Rotation Type** | Specific List | **Legacy (All)**, **Specific List**, or **Tree Mode**. |
|
||||
| **Custom Graph List** | empty | Comma-delimited graph IDs for **Specific List**, for example `1,2,3,4`. |
|
||||
| **Default Tree** | None | The tree to cycle when **Tree Mode** is selected. |
|
||||
|
||||
If **Rotation Type** is **Specific List** and the list is empty, the plugin
|
||||
cycles through all graphs.
|
||||
|
||||

|
||||
|
||||
The screenshot above shows the **Cycle** settings tab. It uses synthetic data.
|
||||
|
||||
## Using Cycle
|
||||
|
||||
Open the **Cycle** tab in the Cacti header. The page has a **Cycle Graph
|
||||
Filter** box with a **Next Update In** countdown, and a **Cycle Graphs** box
|
||||
that holds the images.
|
||||
|
||||
Controls in the filter box:
|
||||
|
||||
- Timespan, refresh delay, and graphs per page selectors.
|
||||
- **Prev**, **Stop** (which becomes **Start** while stopped), **Next**,
|
||||
**Refresh**, **Clear**, and **Save** buttons.
|
||||
- Column count, graph height and width, and a **Legend** checkbox.
|
||||
- In Tree Mode, a tree selector and a leaf selector (**All Levels**, **Top
|
||||
Level**, or a branch).
|
||||
- A regular expression field that filters graphs by title.
|
||||
|
||||
To run a rotation:
|
||||
|
||||
1. Choose the **Rotation Type** and, for a list or tree, the list or **Default
|
||||
Tree** in the Cycle settings.
|
||||
2. Open the **Cycle** tab.
|
||||
3. Adjust the timespan, delay, and layout as needed.
|
||||
4. Click **Save** to keep the current filter values as your own defaults.
|
||||
5. Use **Stop** to pause the rotation and **Prev** or **Next** to move manually.
|
||||
|
||||
Graphs link to the normal graph page. Images are requested as SVG without
|
||||
caching.
|
||||
|
||||
## Command-Line Tools
|
||||
|
||||
The plugin provides none.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **No Graphs Found Matching Criteria** appears when the selected tree, list,
|
||||
or title filter matches no graph that the user may see. Check the user's
|
||||
graph permissions and the selected tree, list, or filter.
|
||||
- In **Specific List** mode, only numeric entries of the list are used.
|
||||
|
||||
## More Information
|
||||
|
||||
- [Plugin repository](https://github.com/Cacti/plugin_cycle)
|
||||
- [Plugin README](https://github.com/Cacti/plugin_cycle/blob/develop/README.md)
|
||||
- [Plugin Management](Plugins.md)
|
||||
- [Supported plugins](supported-plugins.md)
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,106 @@
|
||||
# Build a Filterable Plugin Page
|
||||
|
||||
Build a page where a user can search four sample devices, sort the matches,
|
||||
and move between pages without losing the search. The example stores its
|
||||
own inventory in MariaDB. Everyone with the example realm can see those
|
||||
four records. To display real Cacti devices, also constrain the query to
|
||||
devices the current user is authorized to see.
|
||||
|
||||
## Install the example
|
||||
|
||||
Use a disposable Cacti installation. Extract
|
||||
[workflowdemo version 1](resources/workflowdemo-1.zip) into the Cacti
|
||||
`plugins/` directory. From the application root run:
|
||||
|
||||
```console
|
||||
php cli/plugin_manage.php --plugin=workflowdemo --install --enable
|
||||
```
|
||||
|
||||
In the Cacti database, insert the following fixture once on a fresh install.
|
||||
|
||||
```sql
|
||||
INSERT INTO plugin_workflowdemo_devices (id, name)
|
||||
VALUES (1, 'edge-a'), (2, 'edge-b'), (3, 'edge-c'), (4, 'core-a');
|
||||
```
|
||||
|
||||
Grant a test user **View Workflow Example** in User Management. Sign in as
|
||||
that user and open `plugins/workflowdemo/workflowdemo_devices.php` under
|
||||
your Cacti URL. The first page lists **core-a** and **edge-a**.
|
||||
|
||||
## Render the filter for your branch
|
||||
|
||||
Both branches ship `lib/html_filter.php`. Their `CactiTableFilter`
|
||||
constructors differ. On develop, the fourth argument is the session key.
|
||||
On 1.2.x the fourth argument is the form width and the fifth is the session
|
||||
key. The rendering methods are `render()` and `filter_render()`,
|
||||
respectively.
|
||||
|
||||
The downloadable plugin loads `include/auth.php` and renders a labeled GET
|
||||
form on 1.2.x. It submits the field named `filter` to the same page. Escape
|
||||
the current value when putting it back in the search box. Submitting the
|
||||
form starts a new search on page one.
|
||||
|
||||
```html
|
||||
<form method="get" action="workflowdemo_devices.php">
|
||||
<label>Search <input name="filter" type="search"></label>
|
||||
<button type="submit">Go</button>
|
||||
</form>
|
||||
```
|
||||
|
||||
The downloadable example also includes the development branch's filter
|
||||
renderer. Both forms feed the count and list queries below.
|
||||
|
||||
## Keep search, sort, and paging together
|
||||
|
||||
The count and list queries use the same predicate. With no search text,
|
||||
`LOCATE('', name)` matches every row. A search containing a literal
|
||||
percent sign or underscore searches for that character.
|
||||
|
||||
```php
|
||||
$count = (int) db_fetch_cell_prepared(
|
||||
'SELECT COUNT(*) FROM plugin_workflowdemo_devices WHERE LOCATE(?, name) > 0',
|
||||
[$term]
|
||||
);
|
||||
```
|
||||
|
||||
The page maps two accepted directions to fixed SQL fragments. It orders by
|
||||
name and then by ID so equal names have a stable order. It limits the page
|
||||
number to the available range before computing the offset.
|
||||
|
||||
```php
|
||||
$order = $direction === 'desc' ? 'name DESC, id DESC' : 'name ASC, id ASC';
|
||||
$last = max(1, (int) ceil($count / 2));
|
||||
$page = min($last, max(1, $page));
|
||||
$offset = ($page - 1) * 2;
|
||||
$rows = db_fetch_assoc_prepared(
|
||||
"SELECT name FROM plugin_workflowdemo_devices
|
||||
WHERE LOCATE(?, name) > 0 ORDER BY $order LIMIT 2 OFFSET $offset",
|
||||
[$term]
|
||||
);
|
||||
```
|
||||
|
||||
Use `http_build_query()` to carry the search and direction into each link.
|
||||
Escape the URL for the HTML attribute and escape each displayed name. A new
|
||||
search or sort starts at page one. An empty result has its own message.
|
||||
|
||||
## Verify the visible result
|
||||
|
||||
Search for **edge** and press Enter. Click **Name** to reverse the sort.
|
||||
The first two rows should now be **edge-c** and **edge-b**. Click **Next**.
|
||||
Only **edge-a** should remain. Searching for **absent** should show
|
||||
**No matching devices**. The screenshots show the second page of the same
|
||||
search on the two tested branches.
|
||||
|
||||
![Development filter with edge-a on page two][dev-shot]
|
||||
|
||||
![Stable filter with edge-a on page two][stable-shot]
|
||||
|
||||
Run the [browser test](Plugin-Browser-Testing.md) to repeat these checks
|
||||
and verify access with a second account.
|
||||
|
||||
[dev-shot]: images/workflowdemo-filter-develop.png
|
||||
[stable-shot]: images/workflowdemo-filter-stable.png
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,216 @@
|
||||
# Graph Export
|
||||
|
||||
The Graph Export plugin (`gexport`) exports Cacti graphs, graph trees, and
|
||||
sites as static pages and image files. Each export definition has a schedule, a
|
||||
destination, and a Cacti user whose permissions decide which graphs are
|
||||
included. It replaces the Graph Export feature that was removed from Cacti
|
||||
core, and it suits administrators who publish graphs to a web server outside
|
||||
Cacti.
|
||||
|
||||
This page follows the plugin's `develop` branch, which is unreleased and can
|
||||
change. The branch declares version 2.1 and Cacti compatibility 1.2.29 in its
|
||||
`INFO` file. It is not presented here as a released version.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Cacti 1.2.29 or later, as declared in `INFO` (version 2.1).
|
||||
- No other plugins are required.
|
||||
- The poller runs exports, so the **PHP Binary Path** setting in Cacti must
|
||||
point at a working PHP binary.
|
||||
|
||||
Requirements by export method:
|
||||
|
||||
| Export method | Requirement |
|
||||
| --- | --- |
|
||||
| Local | None beyond a writable export directory. |
|
||||
| FTP | PHP FTP functions (`ftp_connect`). |
|
||||
| SFTP | PHP `ftp_ssl_connect()`, which needs PHP built with OpenSSL. |
|
||||
| FTP NC | The `ncftpput` program. Not available on Windows. |
|
||||
| RSYNC | The `rsync` program, reachable from the poller's path. |
|
||||
| SCP | The `scp` program, reachable from the poller's path. |
|
||||
|
||||
## Installation
|
||||
|
||||
Copy the plugin into `plugins/gexport` in the Cacti directory (rename
|
||||
`plugin_gexport` to `gexport`), then install and enable it as described in
|
||||
[Plugin Management](Plugins.md). Installing creates the `graph_exports` and
|
||||
`graph_exports_tasks` tables. Uninstalling the plugin drops both tables, which
|
||||
deletes all export definitions.
|
||||
|
||||
If you run a Cacti version older than 1.2.31, the plugin README describes a
|
||||
JavaScript function to add to `include/layout.js` so that **Cancel** buttons
|
||||
on forms work.
|
||||
|
||||
## Permissions
|
||||
|
||||
| Realm | Pages |
|
||||
| --- | --- |
|
||||
| **Export Cacti Graphs Settings** | `gexport.php` |
|
||||
|
||||
Assign the realm to users or groups in **Console > Configuration > Users** or
|
||||
**User Groups**. When the Cacti version provides role augmentation, the realm is
|
||||
also added to the **General Administration** role.
|
||||
|
||||
## Settings
|
||||
|
||||
The plugin adds no page to **Console > Configuration > Settings**. All
|
||||
configuration is stored per export definition and is edited on the export's
|
||||
edit form, reached from **Console > Utilities > Graph Exports**. The form has
|
||||
the sections below.
|
||||
|
||||
### General
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| **Export Name** | New Graph Export | The name of the export definition. |
|
||||
| **Enabled** | on | Whether the definition runs. |
|
||||
| **Export Method** | disabled | Local, FTP, SFTP, FTP NC, SCP, or RSYNC. |
|
||||
| **Export Command Arguments** | -zav | Arguments for the non-local methods: `rsync -zav`, `rsync -avpro`, `rsync -avpro --delete-excluded`, or `scp -rp`. |
|
||||
| **Theme** | modern | The Cacti theme used to skin the exported pages. |
|
||||
| **Presentation Method** | disabled | **Site** keeps all graphs in one page. **Tree** keeps the graph tree structure in the static pages. |
|
||||
|
||||
### Export Timing
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| **Timing Method** | export_hourly | **Periodic**, **Hourly**, or **Daily**. |
|
||||
| **Periodic Export Cycle** | none | Run every 1 to 12 polling cycles. |
|
||||
| **Hourly at specified minutes** | 00 | Minute of the hour for hourly exports. The value is rounded to the poller's run time. |
|
||||
| **Daily at specified time** | 00:00 | Time of day for daily exports, in `HH:MM`. |
|
||||
| **Use x Threads** | 0 | Number of background threads. 0 runs the export in the poller process. |
|
||||
|
||||
### Graph Selection & Settings
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| **Effective User** | 0 (N/A) | The Cacti user whose permissions limit which graphs and trees are exported. N/A applies no permission checks. |
|
||||
| **Tree** | 0 (All Trees) | The trees to export. |
|
||||
| **Expand Devices/Sites** | off | When on, each device gets a subfolder with its graph templates or data query items. |
|
||||
| **Site** | 0 (All Sites) | The sites to export. |
|
||||
| **Graph Thumbnail Width** | 300 | Thumbnail width in pixels. |
|
||||
| **Graph Thumbnail Height** | 100 | Thumbnail height in pixels. |
|
||||
| **Default View Thumbnails** | unset | Show thumbnails by default in the exported view. |
|
||||
| **Default Graph Columns** | 2 | Columns used to display graphs. |
|
||||
| **Graphs Per Page** | 20 | Graphs per page in the exported view. |
|
||||
| **Maximum Graphs to Export** | 2000 | After this number an error is generated but exporting continues. 0 means no limit. |
|
||||
|
||||
### Export Location Information
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| **Export Thumbnails** | unset | Export thumbnail mode. |
|
||||
| **Clear Directory** | unset | Clear the final directory before populating it. |
|
||||
| **Export Directory** | none | The directory, local or remote, that receives the exported data. |
|
||||
| **Local Scratch Directory** | the system temporary directory | Where output is staged before transfer by a remote method. Its contents are deleted after the transfer. |
|
||||
|
||||
### Remote Options
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| **Sanitize remote directory** | unset | Delete existing files in the remote directory. Applies only to the PHP FTP functions. |
|
||||
| **Remote Host** | none | Host that receives the export. |
|
||||
| **Remote Port** | none | Port for a non-standard setup. Empty uses the default. |
|
||||
| **Use passive mode** | unset | Connect to the FTP server in passive mode. |
|
||||
| **User** | none | Account on the remote server. |
|
||||
| **Password** | none | Password for the remote account. |
|
||||
| **Private Key Path** | none | Private key for SCP and RSYNC, when required. |
|
||||
|
||||
## Using Graph Export
|
||||
|
||||
Open **Console > Utilities > Graph Exports**. The list is titled **Graph Export
|
||||
Definitions** and has a search box, a rows selector, and a refresh selector.
|
||||
|
||||
The following example uses synthetic data.
|
||||
|
||||
![Graph Export Definitions list with three synthetic exports][gexport-img]
|
||||
|
||||
The columns are **Export Name**, **ID**, **Schedule**, **Next Start**,
|
||||
**Enabled**, **Status** (Idle, Running, or Error), **Exporting (Sites/Trees)**,
|
||||
**Effective User**, **Last Runtime**, **Graphs** (exported on the last run),
|
||||
**Last Started**, and **Last Errored**.
|
||||
|
||||
To create an export:
|
||||
|
||||
1. Open **Console > Utilities > Graph Exports** and click the **+** button.
|
||||
2. Enter an **Export Name** and choose an **Export Method**.
|
||||
3. Choose the timing under **Export Timing**.
|
||||
4. Under **Graph Selection & Settings**, choose an **Effective User** and the
|
||||
**Tree** or **Site** entries to export.
|
||||
5. Set the **Export Directory** and, for remote methods, the **Remote
|
||||
Options**.
|
||||
6. Click **Save**.
|
||||
|
||||
To act on several definitions, select them and choose an action: **Delete**,
|
||||
**Enable**, **Disable**, or **Export Now**.
|
||||
|
||||
## Background Processing
|
||||
|
||||
The plugin registers a `poller_bottom` hook. At the end of each polling cycle,
|
||||
on the main poller (poller ID 1) only, it checks for enabled definitions and, if
|
||||
there are any, starts `poller_export.php` in the background with the PHP binary
|
||||
from the **PHP Binary Path** setting.
|
||||
|
||||
For each enabled definition, the script compares the stored next start time with
|
||||
the current time and runs the export when it is due. It then records the next
|
||||
start time. A definition whose previous run is still alive is not started again.
|
||||
Results are written to the Cacti log with the `EXPORT` tag, including a
|
||||
`MASTER STATS` line with the time, the number of definitions checked, and the
|
||||
number started.
|
||||
|
||||
When **Use x Threads** is greater than 0, the export spawns background tasks
|
||||
that are tracked in the `graph_exports_tasks` table. An export refuses to run
|
||||
when its export path is inside a Cacti system directory, the Cacti web root, a
|
||||
parent of the web root, or a protected system path.
|
||||
|
||||
## Command-Line Tools
|
||||
|
||||
Run `poller_export.php` from the Cacti directory as the poller user:
|
||||
|
||||
```console
|
||||
php plugins/gexport/poller_export.php [--id=N] [--force] [--debug]
|
||||
```
|
||||
|
||||
| Option | Effect |
|
||||
| --- | --- |
|
||||
| `--id=N` | Export only the definition with this ID. |
|
||||
| `-f`, `--force` | Run the export now, regardless of its schedule. |
|
||||
| `-d`, `--debug` | Display verbose output during execution. |
|
||||
| `-V`, `-v`, `--version` | Print the version. |
|
||||
| `-H`, `-h`, `--help` | Print usage. |
|
||||
|
||||
The `--thread` option is used internally when the poller starts a background
|
||||
task. Do not pass it by hand.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Nothing exports:** exports run only from the main poller. Check that the
|
||||
definition is **Enabled** and that **Next Start** is set. Use **Export Now**
|
||||
or `--force` to run it immediately.
|
||||
- **Status shows Error:** read the Cacti log and filter for `EXPORT`. The export
|
||||
functions write each step there.
|
||||
- **Export path refused:** the export stops with a message that the path is
|
||||
within a Cacti system path, a system path, the Cacti web root, or a parent of
|
||||
the web root. Choose a different **Export Directory**.
|
||||
- **Secure FTP Function does not exist:** SFTP needs PHP `ftp_ssl_connect()`.
|
||||
Install an OpenSSL-enabled PHP FTP extension.
|
||||
- **ncftpput only available in unix environment:** FTP NC cannot run on
|
||||
Windows.
|
||||
- **Previous run ended in an unclean state, or is still running:** the export
|
||||
logs a warning and does not start a second run while the earlier process is
|
||||
alive.
|
||||
- **Graph limit reached:** when **Maximum Graphs to Export** is reached an
|
||||
error is logged and the export continues.
|
||||
|
||||
## More Information
|
||||
|
||||
- [Plugin repository](https://github.com/Cacti/plugin_gexport)
|
||||
- [Plugin README][readme]
|
||||
- [Plugin Management](Plugins.md)
|
||||
- [Supported plugins](supported-plugins.md)
|
||||
|
||||
[gexport-img]: images/plugin-gexport-exports.png
|
||||
[readme]: https://github.com/Cacti/plugin_gexport/blob/develop/README.md
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,211 @@
|
||||
# GPSMap
|
||||
|
||||
The Maps plugin (directory `gpsmap`) plots Cacti devices on a Google map by
|
||||
latitude and longitude and colors each marker by device status. It can also
|
||||
draw coverage areas around access points. It suits networks whose devices are
|
||||
spread across real geography, such as wireless, campus and metro networks,
|
||||
where an operator needs to see where a fault is and not only which device is
|
||||
down.
|
||||
|
||||
This page follows the plugin's development branch (`develop`), which is
|
||||
unreleased and can change. That branch declares version 2.2 and Cacti
|
||||
compatibility 1.2.29 in its `INFO` file.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Plugin version 2.2 and Cacti compatibility 1.2.29, as declared in `INFO`.
|
||||
- No other plugins are required. When the **thold** plugin is enabled, the map
|
||||
also uses its threshold state (see [Using GPSMap](#using-gpsmap)).
|
||||
- A Google Maps API key is recommended. The map page loads the Google Maps
|
||||
JavaScript library from `maps.googleapis.com`, so the browser must be able
|
||||
to reach it and Cacti's Content Security Policy settings must allow it.
|
||||
- The poller must be able to write to `plugins/gpsmap/XML`.
|
||||
- The poller runs the PHP binary configured in Cacti's **PHP Binary Path**
|
||||
setting to refresh host name lookups in the background. If it is empty, the
|
||||
plugin logs a warning and skips the refresh.
|
||||
|
||||
## Installation
|
||||
|
||||
Follow [Plugin Management](Plugins.md) for the generic steps. In addition:
|
||||
|
||||
1. Copy the plugin into `plugins/gpsmap`.
|
||||
2. Give the user that runs the poller write access to `plugins/gpsmap/XML`.
|
||||
The directory name is uppercase, which matters on case sensitive file
|
||||
systems.
|
||||
3. Install and enable the plugin.
|
||||
4. Grant the realms in the next section to your users.
|
||||
|
||||
Installation adds columns to the Cacti `host` table and creates the
|
||||
`gpsmap_templates` and `plugin_gpsmap_dns_cache` tables. The columns hold the
|
||||
coordinates and access point values described below. Uninstalling the plugin
|
||||
does not remove the tables or columns, so coordinates survive an accidental
|
||||
removal.
|
||||
|
||||
## Permissions
|
||||
|
||||
| Realm | Pages |
|
||||
| --- | --- |
|
||||
| **Configure Maps** | `gpstemplates.php`, `gpstemplates_add.php` |
|
||||
| **View Maps** | `gpsmap.php` |
|
||||
|
||||
Users need **View Maps** to see the **Maps** tab and open the map. Users who
|
||||
manage Map Templates need **Configure Maps**.
|
||||
|
||||
## Settings
|
||||
|
||||
Settings are on the **Maps** tab of **Console > Configuration > Settings**.
|
||||
The first group, headed **Maps**, locates and centers the map.
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| Google API Key | none | Google Maps API key. The setting is described as not required but highly recommended. |
|
||||
| Geolocation URL | `http://ipinfo.io/` | URL of an IP to geolocation lookup service. The device IP address is appended to the URL. |
|
||||
| Initial Latitude | `33.8734` | Centers the map. |
|
||||
| Initial Longitude | `-115.901` | Centers the map. |
|
||||
| Initial Elevation | `9` | Starting zoom of the map, from 0 to 12. |
|
||||
|
||||
If the initial latitude or longitude is empty, the Maps page shows a message
|
||||
asking you to configure the plugin under **Settings > Maps** instead of a map.
|
||||
|
||||
Section **Display Settings**:
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| Display Disabled Devices | off | Allow disabled devices on the map. |
|
||||
| Coverage Overlay | off | Draw a transparent circle around an access point with a radius equal to the furthest node in the same group. |
|
||||
| Map Refresh | `5` | Reload the map after this many minutes. Set it to the poller interval, or 0 to disable. |
|
||||
|
||||
Section **Overlay Settings**:
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| Tab Radius (Required) | `.0003` | Radius used to combine nearby points into one marker. |
|
||||
| Fill Color | `005D57` | Fill color of the overlay circle. |
|
||||
| Ring Color | `005D57` | Color of the outer rim. |
|
||||
| Ring Width | `2` | Width of the outer ring. |
|
||||
| Fill Opacity | `.2` | Fill opacity, between 0 and 1. |
|
||||
| Ring Opacity | `.8` | Ring opacity, between 0 and 1. |
|
||||
| Quality | `15` | Number of divisions in a circle. Preferably above 15; larger numbers can slow the browser. |
|
||||
|
||||
## Using GPSMap
|
||||
|
||||
Three things must be in place before a device appears on the map: a Map
|
||||
Template for its device template, coordinates on the device, and a completed
|
||||
poller cycle.
|
||||
|
||||
### Map Templates
|
||||
|
||||
Open **Console > Templates > Map** to list the Map Templates. The page is
|
||||
titled **Map Templates** and has the columns **Host Template**, **Up Image**,
|
||||
**Recovering Image**, **Down Image** and **Is AP**. Use the plus icon to add
|
||||
one, or select rows and choose **Delete** from the action list.
|
||||
|
||||
The screenshot below shows the Map Templates list with four synthetic device
|
||||
templates and their marker icons.
|
||||
|
||||
![Map Templates list with four synthetic templates][img-1]
|
||||
|
||||
A Map Template has these fields:
|
||||
|
||||
- **Device Template**: the device template that this Map Template applies to.
|
||||
- **Up Image**, **Recovering Image**, **Down Image**: the marker icon for each
|
||||
state.
|
||||
- **Access Point**: whether the device template represents an access point
|
||||
(**Yes** or **No**).
|
||||
|
||||
A device whose device template has no Map Template is not drawn. Icon images
|
||||
are read from `plugins/gpsmap/images/icons`.
|
||||
|
||||
### Device coordinates
|
||||
|
||||
Edit a device in **Console > Management > Devices**. The plugin adds a
|
||||
**Map Settings** section after the **Disabled** field:
|
||||
|
||||
| Field | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| Overlay Inclusion | on | Disable to plot the device only, not include it in the coverage overlay. |
|
||||
| Latitude | empty | Latitude of the device. |
|
||||
| Longitude | empty | Longitude of the device. |
|
||||
| Starting Degree | `0` | Start of a directional coverage area, 0 to 360. Shown only for access points. |
|
||||
| Stopping Degree | `360` | End of the directional area, must be greater than the starting degree. Access points only. |
|
||||
| Specify Radius | `0` | Manual radius for an access point. 0 derives the radius from grouped devices. Access points only. |
|
||||
| Group ID | `0` | Group that decides which devices belong to an access point's coverage overlay. 0 disables. |
|
||||
|
||||
Starting Degree, Stopping Degree and Specify Radius appear only when the
|
||||
device's device template is marked as an access point.
|
||||
|
||||
### Viewing the map
|
||||
|
||||
Open the **Maps** tab. The map shows each device as a marker whose icon depends
|
||||
on its state: up, recovering, down, disabled or undefined. When the thold
|
||||
plugin is enabled and an otherwise up device has an enabled threshold in an
|
||||
alert state, the marker is drawn in the alert state instead. The map page
|
||||
also lists drill-down links by subnet, each with links to the XML and KML files
|
||||
of that subnet, and has a **Print** button.
|
||||
|
||||
To place a new device on the map:
|
||||
|
||||
1. Create a Map Template for its device template under **Console > Templates
|
||||
> Map**.
|
||||
2. Edit the device and enter **Latitude** and **Longitude** under **Map
|
||||
Settings**, then save.
|
||||
3. Wait for the next poller cycle to finish, then open the **Maps** tab.
|
||||
|
||||
## Background Processing
|
||||
|
||||
The map is generated by the poller, not on each page view. The plugin registers
|
||||
the `poller_bottom` hook. In each cycle it:
|
||||
|
||||
1. Loads every device whose device template has a Map Template and that has
|
||||
coordinates. Devices with a literal IP address are used directly. Devices
|
||||
with a host name use the address stored in `plugin_gpsmap_dns_cache`.
|
||||
2. Writes the full map to `plugins/gpsmap/XML` (`all.xml` and
|
||||
`all-top.html`), then one set of files for each subnet prefix in use. The
|
||||
`.kml` files for the subnet downloads are also produced there.
|
||||
3. Starts a background PHP process that refreshes host name lookups. A newly
|
||||
added host name can therefore appear one poll later. If a lookup fails, the
|
||||
last known address is kept.
|
||||
4. Removes generated files that were not refreshed for three poller intervals,
|
||||
but only after all files were published successfully.
|
||||
5. Writes a summary line to the Cacti log, for example
|
||||
`GPSMAP STATS: Mapped:12 Towers:2 Subnets:3 Pruned:0 Time:0.12`.
|
||||
|
||||
The Maps page reads the prebuilt files, so nothing appears until a poller cycle
|
||||
has completed after you configure a device.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
Messages are written to the Cacti log with the `GPSMAP` tag.
|
||||
|
||||
- Log message `NOTICE: gpsmap has no Devices to map.`: no device qualified.
|
||||
Check that its device template is listed under **Templates > Map** and that
|
||||
the device has coordinates.
|
||||
- Log message `Unable to write to: <file>. Please verify that the Data
|
||||
Collector has write access to this location.`: fix ownership and permissions
|
||||
on `plugins/gpsmap/XML`.
|
||||
- Log message `gpsmap has N hostname(s) without a cached address`: the
|
||||
background lookup has not resolved those names yet. The last known markers
|
||||
are kept.
|
||||
- Log message `gpsmap omitted N hostname(s) after repeated DNS failures`: the
|
||||
named devices are left off the map until the lookup succeeds.
|
||||
- Log message `gpsmap DNS refresh was not scheduled because the PHP binary path
|
||||
is not configured`: set the PHP binary path in the Cacti settings.
|
||||
- The Maps page shows a configuration message instead of a map: set **Initial
|
||||
Latitude** and **Initial Longitude** under **Settings > Maps**.
|
||||
- The page is blank and the browser console reports a blocked script: the
|
||||
Google Maps script was not allowed by the Content Security Policy.
|
||||
- An up device is drawn in the alert state: the thold plugin is enabled and the
|
||||
device has an enabled threshold in an alert state.
|
||||
|
||||
## More Information
|
||||
|
||||
- [Plugin repository](https://github.com/Cacti/plugin_gpsmap)
|
||||
- [README](https://github.com/Cacti/plugin_gpsmap/blob/develop/README.md)
|
||||
- [Plugin Management](Plugins.md)
|
||||
- [Supported plugins](supported-plugins.md)
|
||||
|
||||
[img-1]: images/plugin-gpsmap-templates.png
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,217 @@
|
||||
# Nagios Plugin for Cacti
|
||||
|
||||
The Nagios Plugin for Cacti (NPC) shows the status and history that Nagios
|
||||
stores through NDOUtils inside the Cacti interface. It adds an **NPC** tab with
|
||||
host and service status, comments, scheduled downtime, the Nagios event log and
|
||||
process information, and it can send a small set of commands to the Nagios
|
||||
command file. It is for administrators who run Nagios next to Cacti and want
|
||||
one place to view status and graphs.
|
||||
|
||||
This page follows the plugin's `develop` branch, which is unreleased and can
|
||||
change. That branch declares version 3.1 and Cacti compatibility 1.2.1 in its
|
||||
`INFO` file. No release of the plugin is published. The plugin README describes
|
||||
the plugin as a port of an older plugin and advises using it in a non-production
|
||||
setup until the Cacti community has tested the migration further.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Cacti 1.2.1 or later, as declared in `INFO`. The plugin README states that
|
||||
its tests run against the Cacti 1.2.x branch.
|
||||
- PHP 8.2 or later, as stated in the plugin README.
|
||||
- MySQL or MariaDB, as required by Cacti.
|
||||
- Nagios 3.x with the NDOUtils event broker module (`ndomod`) and the `ndo2db`
|
||||
daemon. The README names NDOUtils 1.4b7.
|
||||
- No other Cacti plugin is listed in `INFO` as required.
|
||||
- No PHP extension beyond the ones Cacti needs.
|
||||
- The `php` program must be in the path of the web server user if you import
|
||||
Nagios hosts, because the import runs Cacti's `cli/add_device.php` with
|
||||
`exec()`.
|
||||
|
||||
The README notes that the default PHP `memory_limit` may not be enough for NPC.
|
||||
Raise it in `php.ini` if NPC runs out of memory.
|
||||
|
||||
## Installation
|
||||
|
||||
Follow [Plugin Management](Plugins.md) for the generic steps. Place the code in
|
||||
`<path_cacti>/plugins/npc`; the directory must be named `npc`. The plugin is
|
||||
listed as **Nagios Plugin for Cacti** on **Console > Configuration > Plugins**.
|
||||
|
||||
Installing creates 62 tables with the `npc_` prefix in the Cacti database, adds
|
||||
the `npc_host_object_id` column to the Cacti `host` table, registers the realms
|
||||
described below, and creates the settings `npc_date_format`, `npc_time_format`
|
||||
and `npc_log_level`. Without ndo2db feeding Nagios data into these tables, the
|
||||
NPC screens are empty.
|
||||
|
||||
### Configure Nagios
|
||||
|
||||
In `nagios.cfg`, enable external commands and the event broker, and point
|
||||
Nagios at the NDOUtils module. Adjust the paths to your installation:
|
||||
|
||||
```ini
|
||||
check_external_commands=1
|
||||
command_check_interval=-1
|
||||
event_broker_options=-1
|
||||
broker_module=/usr/local/nagios/bin/ndomod.o
|
||||
config_file=/usr/local/nagios/etc/ndomod.cfg
|
||||
process_performance_data=1
|
||||
```
|
||||
|
||||
Set `process_performance_data=1` only if you want to graph Nagios performance
|
||||
data in Cacti. In `ndomod.cfg`, `config_output_options` must be `2`.
|
||||
|
||||
### Configure ndo2db
|
||||
|
||||
Install NDOUtils following its own README, but skip its database
|
||||
initialization: NPC creates the tables. In `ndo2db.cfg`, point ndo2db at the
|
||||
Cacti database and use the `npc_` prefix:
|
||||
|
||||
```ini
|
||||
db_servertype=mysql
|
||||
db_host=localhost
|
||||
db_port=3306
|
||||
db_name=cacti
|
||||
db_prefix=npc_
|
||||
db_user=<database user>
|
||||
db_pass=<database password>
|
||||
```
|
||||
|
||||
The database account needs select, insert, update and delete on the `npc_`
|
||||
tables. The socket type and port must be the same in `ndo2db.cfg` and
|
||||
`ndomod.cfg`.
|
||||
|
||||
## Permissions
|
||||
|
||||
| Realm | Pages covered |
|
||||
| --- | --- |
|
||||
| NPC | `npc.php`, the NPC tab and all of its screens |
|
||||
| NPC Global Commands | Sending Nagios commands from the NPC screens |
|
||||
|
||||
Grant the realms on the **Realm Permissions** tab of each user under
|
||||
**Console > Configuration > Users**. The plugin checks the **NPC Global
|
||||
Commands** realm before it sends a command, so a user needs this realm in
|
||||
addition to **NPC** to send commands.
|
||||
|
||||
## Settings
|
||||
|
||||
Settings are on the **NPC** tab of **Console > Configuration > Settings**.
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| Remote Commands | off | Allow commands to be written to the Nagios command file. System wide. |
|
||||
| Nagios Command File Path | empty | Path to the Nagios command file (`nagios.cmd`). The web server user must be able to read and write it. |
|
||||
| Nagios URL | empty | Full URL of the Nagios installation. The value is passed to the page, but no screen uses it in this version. |
|
||||
| Date Format | Y-m-d | Format for displayed dates. |
|
||||
| Time Format | H:i | Format for displayed times. |
|
||||
| Portlet Refresh Rate | 60 | Seconds before the Hosts, Services and Event Log screens refresh. The field text names 30 seconds as the minimum. |
|
||||
| Host/Service Config Type | 1 | Selects the host and service rows with this `config_type`, 0 or 1. If you see groups but no hosts or services, try the other value. |
|
||||
| Host Icons | off | Stored, but no screen uses it in this version. |
|
||||
| Service Icons | off | Stored, but no screen uses it in this version. |
|
||||
| Logging Level | None | Detail written to the Cacti log: None, ERROR, WARN, INFO or DEBUG. |
|
||||
|
||||
Debug logging fills the Cacti log quickly. NPC writes with the component
|
||||
`NPC`.
|
||||
|
||||
## Using NPC
|
||||
|
||||
Open the **NPC** tab in the Cacti header. The screens are tabs on the NPC page:
|
||||
|
||||
- **Dashboard**: host and service status counts (Host Status Summary, Service
|
||||
Status Summary) and the Host Problems and Service Problems lists.
|
||||
- **Hosts**: hosts with address, state, output and last check, with a state
|
||||
filter (Any, Up, Down, Unreachable, Problems).
|
||||
- **Services**: services by host, with a state filter (Any, Ok, Warning,
|
||||
Critical, Unknown, Problems).
|
||||
- **Comments**: host and service comments.
|
||||
- **Downtime**: host and service downtime.
|
||||
- **Event Log**: the Nagios log entries.
|
||||
- **Process Info**: Nagios process properties.
|
||||
|
||||
The screenshot shows the **Dashboard** with the summary tables and problem
|
||||
lists. The example uses synthetic data.
|
||||
|
||||
![NPC Dashboard with synthetic summaries and problems][dashboard-image]
|
||||
|
||||
To see details and send a command for a host or service:
|
||||
|
||||
1. Open **NPC > Hosts** or **NPC > Services**.
|
||||
2. Select the host or service name to open a dialog with its details.
|
||||
3. Select the gear icon in the **Actions** column to open the command dialog.
|
||||
4. Choose a command (Acknowledge Problem, Add Comment, Schedule Downtime,
|
||||
Schedule Check, Enable Notifications or Disable Notifications), fill in the
|
||||
fields, and select **Submit**.
|
||||
|
||||
Commands are written to the Nagios command file. They need **Remote
|
||||
Commands** enabled, a **Nagios Command File Path**, and the **NPC Global
|
||||
Commands** realm. A failed command shows the reason in a message.
|
||||
|
||||
On the **Comments** screen, the cross at the end of a host comment deletes it
|
||||
after a confirmation.
|
||||
|
||||
On a Cacti device, the **Nagios Host Mapping** field on **Console > Management
|
||||
> Devices** links the device to a Nagios host.
|
||||
|
||||
## Background Processing
|
||||
|
||||
NPC registers no poller hook and has no process of its own. Data arrives in the
|
||||
`npc_` tables from ndo2db, outside Cacti. The Hosts, Services and Event Log
|
||||
screens request new data from the plugin every **Portlet Refresh Rate**
|
||||
seconds. The tables grow with the Nagios data. Retention is set in `ndo2db.cfg`
|
||||
with the `max_*_age` options, not in Cacti.
|
||||
|
||||
## Command-Line Tools
|
||||
|
||||
`perfdata.php` and `cli.php` print Nagios performance data in the form a Cacti
|
||||
script data input method reads. Run them with `php`. Usage text:
|
||||
|
||||
```console
|
||||
usage: perfdata.php --type=[host|service] --id=[ID] --datasource=[DS]
|
||||
|
||||
Required:
|
||||
--type Type specifies that we are querting perfdata for a host or service
|
||||
--id The host or service object ID
|
||||
Optional:
|
||||
--ds Return only the specified datasource. All returned by default.
|
||||
List Options:
|
||||
--list-hosts [--hostgroup=<name>]
|
||||
--list-hostgroups
|
||||
--list-services
|
||||
```
|
||||
|
||||
The usage text names `--datasource`, which the code does not read, and does not
|
||||
list all options. The code also accepts `--host=<name>` and
|
||||
`--service=<description>` to select an object by name. `cli.php` takes the same
|
||||
options and adds `--perfdata` (the default) and `--perf-history`, which uses
|
||||
`--host`, `--service`, `--begin=<date>` and `--end=<date>` to print the checks
|
||||
in a range.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- The NPC screens are empty: ndo2db is not writing into the `npc_` tables.
|
||||
Check `ndomod.cfg`, `ndo2db.cfg` and the database account.
|
||||
- Groups are visible but hosts and services are not: change **Host/Service
|
||||
Config Type** to the other value.
|
||||
- A command fails with "You do not have permission to execute this command.":
|
||||
the user lacks the **NPC Global Commands** realm.
|
||||
- A command fails with "Remote Commands must be enabled under
|
||||
console->Settings->NPC" or "The Nagios Command File Path must be set under
|
||||
console->Settings->NPC": set the matching setting.
|
||||
- A command fails with a message from the command file check: the web server
|
||||
user must be able to read and write the Nagios command file. If Nagios runs
|
||||
on another system, the file must be reachable from the Cacti system.
|
||||
- The plugin writes `SECURITY: NPC rejected ...` entries to the Cacti log for
|
||||
requests with an unknown module or action.
|
||||
- Importing Nagios hosts into Cacti and per-user screen layouts have server
|
||||
side code but no screen in this version.
|
||||
|
||||
## More Information
|
||||
|
||||
- [Nagios Plugin for Cacti repository](https://github.com/Cacti/plugin_npc)
|
||||
- [NPC README](https://github.com/Cacti/plugin_npc/blob/develop/README.md)
|
||||
- [Plugin Management](Plugins.md)
|
||||
- [Supported plugins](supported-plugins.md)
|
||||
|
||||
[dashboard-image]: images/plugin-npc-dashboard.png
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,110 @@
|
||||
# QuickTree
|
||||
|
||||
QuickTree is a basket for graphs. While investigating a problem you click a
|
||||
plus icon next to any graph, and the graph is added to your personal QuickTree
|
||||
page. You can then save the collection as a normal Cacti graph tree or as a
|
||||
branch of an existing tree. It suits users who switch between graphs from
|
||||
different devices, such as a server load graph and a switch port graph.
|
||||
|
||||
This page follows the plugin's `main` branch, which is unreleased and can
|
||||
change. The branch declares version 2.0 and Cacti compatibility 1.2.29 in its
|
||||
`INFO` file. It is not presented here as a released version.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Cacti 1.2.29 or later, as declared in `INFO` (version 2.0).
|
||||
- No other plugins, PHP extensions, or external programs are required.
|
||||
- Saving a collection as a tree requires permission to edit that tree.
|
||||
|
||||
## Installation
|
||||
|
||||
Copy the plugin into `plugins/quicktree` in the Cacti directory (the folder
|
||||
must be named `quicktree`), then install and enable it as described in
|
||||
[Plugin Management](Plugins.md). Installing creates the `quicktree_graphs`
|
||||
table and sets the page style to **Tab**. Uninstalling leaves the table in
|
||||
place.
|
||||
|
||||
If you run a Cacti version older than 1.2.31, the plugin README describes a
|
||||
JavaScript function to add to `include/layout.js` so that **Cancel** buttons
|
||||
on forms work.
|
||||
|
||||
## Permissions
|
||||
|
||||
| Realm | Pages |
|
||||
| --- | --- |
|
||||
| **QuickTree Management** | `quicktree.php` |
|
||||
|
||||
Grant the realm to each user who should have a QuickTree. The tab, the console
|
||||
menu entry, and the plus icon next to graphs appear only for users with the
|
||||
realm. Each user has a separate list.
|
||||
|
||||
## Settings
|
||||
|
||||
The plugin adds one setting to the **Misc** tab of **Console > Configuration >
|
||||
Settings**, under the **Quicktree** heading.
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| **Page Style** | Tab | Where the QuickTree page is displayed: **Tab**, **Console Menu**, or **Both Tab and Console Menu**. |
|
||||
|
||||
The default is stored at install time; the setting itself has no `default`
|
||||
entry in the settings array.
|
||||
|
||||
## Using QuickTree
|
||||
|
||||
Depending on **Page Style**, open the **QuickTree** tab in the Cacti header or
|
||||
**Console > Management > QuickTree Trees**.
|
||||
|
||||
To collect graphs, click the plus icon (**Add to Quicktree**) next to a graph
|
||||
on the graph view pages. A graph already in your list is not added twice.
|
||||
|
||||
The page opens with an **Information/Directions** box, an **Actions** drop-down,
|
||||
and then each queued graph with its title and a remove icon. The example uses
|
||||
synthetic data and shows the top of the page; queued graphs appear below it.
|
||||
|
||||
![QuickTree page with directions and Actions][qt-img]
|
||||
|
||||
To save the collection as a tree:
|
||||
|
||||
1. Open the QuickTree page.
|
||||
2. In **Actions**, choose **Save To New Tree** or **Save To Branch**, and click
|
||||
**Go**.
|
||||
3. For a new tree, enter a **Tree Name** and a **Branch Name**. For an existing
|
||||
tree, choose the **Tree Name** and enter a **Branch Name**. Only trees you
|
||||
may edit are offered.
|
||||
4. Click **Continue**.
|
||||
|
||||
Cacti creates the tree or branch, adds the graphs, and opens it in the graph
|
||||
view. Cacti caches graph trees, so you may need to switch to another tree before
|
||||
a newly created tree appears in the list.
|
||||
|
||||
To remove one graph, click the remove icon beside its title. To empty the list,
|
||||
choose **Clear All Graphs** in **Actions**. Adding, removing, and clearing do
|
||||
not change anything else in Cacti. Only saving creates a tree.
|
||||
|
||||
## Command-Line Tools
|
||||
|
||||
The plugin provides none.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **No Graphs Added Yet** is shown when your list is empty.
|
||||
- **QuickTree has no Graphs Queued** is shown when you try to save an empty
|
||||
list.
|
||||
- **Graph ... was NOT added to QuickTree** means the graph is already in your
|
||||
list.
|
||||
- If the plus icon does not appear, check that the user has the **QuickTree
|
||||
Management** realm.
|
||||
|
||||
## More Information
|
||||
|
||||
- [Plugin repository](https://github.com/Cacti/plugin_quicktree)
|
||||
- [Plugin README](https://github.com/Cacti/plugin_quicktree/blob/main/README.md)
|
||||
- [Plugin Management](Plugins.md)
|
||||
- [Supported plugins](supported-plugins.md)
|
||||
|
||||
[qt-img]: images/plugin-quicktree-page.png
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,108 @@
|
||||
# Handle Poller Output on a Remote Data Collector
|
||||
|
||||
This example records a single data source named `wf_demo` in a
|
||||
collector-local plugin table. It illustrates three decisions a plugin
|
||||
author must make: which hook supplies the data, which installation owns
|
||||
the write, and how repeated delivery affects storage.
|
||||
|
||||
## Choose the hook and the writer
|
||||
|
||||
The poller builds a batch keyed by RRD path. Each entry carries a
|
||||
`local_data_id` and a `times` array mapping Unix timestamps to data-source
|
||||
names and values. Cacti passes that batch to the `poller_output` function
|
||||
hook. The example registers a callback in its install function:
|
||||
|
||||
```php
|
||||
api_plugin_register_hook('workflowdemo', 'poller_output', 'workflowdemo_output', 'setup.php');
|
||||
```
|
||||
|
||||
On a remote collector, `remote_collect:1` in `INFO` enables this hook.
|
||||
The separate `remote_poller` capability applies to `poller_bottom`.
|
||||
Choose `poller_output` when you need the measurements themselves.
|
||||
The main server also dispatches the hook. The example checks the collector
|
||||
ID and returns immediately on collector 1, which keeps the write local to
|
||||
the remote instance.
|
||||
|
||||
```php
|
||||
$collector = defined('POLLER_ID') ? POLLER_ID : (int) $config['poller_id'];
|
||||
if ($collector === 1) {
|
||||
return $batch;
|
||||
}
|
||||
```
|
||||
|
||||
Within the callback, return the original batch on every normal path.
|
||||
Other registered callbacks can receive the value your callback returns.
|
||||
|
||||
## Give each measurement a stable identity
|
||||
|
||||
For each timestamp, the example selects the `wf_demo` field. A unique key
|
||||
covers collector ID, local data ID, timestamp, and field name. The table's
|
||||
primary key enforces uniqueness across concurrent connections. Replaying
|
||||
the same identity updates its reading. A new timestamp produces a new row.
|
||||
|
||||
```php
|
||||
$key = hash('sha256', implode(':', [$collector, $rrd['local_data_id'], $time, 'wf_demo']));
|
||||
db_execute_prepared('INSERT INTO plugin_workflowdemo_samples
|
||||
(sample_key, collector, data_id, sample_time, reading) VALUES (?, ?, ?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE reading = VALUES(reading)',
|
||||
[$key, $collector, $rrd['local_data_id'], $time, $fields['wf_demo']]);
|
||||
```
|
||||
|
||||
The example keeps the reading as text so an unknown sample (`U`) remains
|
||||
distinguishable from zero. Its table lives on the collector. A plugin
|
||||
that also displays these records centrally needs a separate transfer and
|
||||
reconciliation design. Declaring a hook capability does not replicate
|
||||
plugin-owned rows.
|
||||
|
||||
## Replay the same sample on two installations
|
||||
|
||||
Use a disposable main installation with collector ID 1 and a remote
|
||||
installation with its own Cacti database and a configured collector ID
|
||||
greater than 1. See [Remote Poller Setup](How-To-Setup-Remote-Pollers.md)
|
||||
for the collector configuration. Deploy the same
|
||||
[example plugin](resources/workflowdemo-1.zip) on both. Confirm the
|
||||
plugin tables exist and the hook is enabled in both databases:
|
||||
|
||||
```sql
|
||||
SELECT name, hook, status FROM plugin_hooks
|
||||
WHERE name = 'workflowdemo' AND hook = 'poller_output';
|
||||
SELECT COUNT(*) FROM plugin_workflowdemo_samples;
|
||||
```
|
||||
|
||||
Start with hook status 1 and zero sample rows. From the Cacti root on the
|
||||
main server, run this command once. Then run it twice on the collector:
|
||||
|
||||
```console
|
||||
php plugins/workflowdemo/replay.php
|
||||
```
|
||||
|
||||
The CLI fixture sends one synthetic batch to the real registered-hook
|
||||
dispatcher. It checks that the returned batch is unchanged. It uses local
|
||||
data ID 42, timestamp 1700000000, field `wf_demo`, and reading `7`. It does
|
||||
not require an RRD file or an SNMP agent.
|
||||
|
||||
Run this query separately against the main and collector databases:
|
||||
|
||||
```sql
|
||||
SELECT collector, data_id, sample_time, reading, COUNT(*) AS copies
|
||||
FROM plugin_workflowdemo_samples
|
||||
GROUP BY collector, data_id, sample_time, reading;
|
||||
```
|
||||
|
||||
The main database should return no rows. For collector ID 2, the collector
|
||||
should return exactly `2, 42, 1700000000, 7, 1`. If the collector has no
|
||||
row, inspect its local plugin registration, `INFO`, and actual collector
|
||||
ID. If it has two rows for one identity, inspect the key definition. For
|
||||
a plugin that consumes live devices, also poll a configured test device
|
||||
and trace its actual data-source name and timestamp through the callback.
|
||||
The replay exercises dispatch and persistence downstream of collection.
|
||||
|
||||
For comparison, see the upstream [poller implementation][poller] and
|
||||
[hook capability checks][hooks].
|
||||
|
||||
[poller]: <https://github.com/Cacti/cacti/blob/1.2.x/lib/poller.php>
|
||||
[hooks]: <https://github.com/Cacti/cacti/blob/1.2.x/lib/plugins.php>
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,110 @@
|
||||
# Upgrade a Plugin with Existing Data
|
||||
|
||||
Version 1 of the [example device list](Plugin-Filterable-Page.md) stores an
|
||||
ID and name. Version 2 adds a note to each device. This walkthrough tests
|
||||
three installation paths: upgrade an existing database, retry after a
|
||||
migration, and install the new version into an empty database.
|
||||
|
||||
## Record the starting state
|
||||
|
||||
On a disposable Cacti system, install version 1 and insert the four
|
||||
[example records](Plugin-Filterable-Page.md#install-the-example). Inspect
|
||||
both the registered plugin version and the actual schema:
|
||||
|
||||
```sql
|
||||
SELECT version FROM plugin_config WHERE directory = 'workflowdemo';
|
||||
SHOW COLUMNS FROM plugin_workflowdemo_devices;
|
||||
SELECT id, name FROM plugin_workflowdemo_devices ORDER BY id;
|
||||
```
|
||||
|
||||
Expect version `1.0`, columns `id` and `name`, and four rows. For a real
|
||||
upgrade, back up existing data and test restoring it. Rehearse the upgrade
|
||||
against a copy from the oldest version your plugin supports. Run one
|
||||
migration at a time while plugin writes are quiescent.
|
||||
|
||||
## Deploy and migrate
|
||||
|
||||
Extract [workflowdemo version 2](resources/workflowdemo-2.zip) over
|
||||
`plugins/workflowdemo/`. Keep the plugin installed. From the Cacti root run:
|
||||
|
||||
```console
|
||||
php plugins/workflowdemo/upgrade.php
|
||||
```
|
||||
|
||||
This is a CLI entry point supplied by the example. Replacing `INFO`
|
||||
changes the version on disk. The migration separately updates the version
|
||||
in `plugin_config` after verifying the database change. It accepts an
|
||||
installed version of `1.0` or `2.0` and requires version `2.0` on disk.
|
||||
|
||||
The same column definition is used on upgrade and fresh installation:
|
||||
|
||||
```php
|
||||
function workflowdemo_note_column() {
|
||||
return ['name' => 'note', 'type' => 'varchar(80)', 'NULL' => false, 'default' => ''];
|
||||
}
|
||||
```
|
||||
|
||||
The migration calls `api_plugin_db_add_column()` only when the column is
|
||||
absent. The helper records its change for the plugin. The example then
|
||||
reads `information_schema.COLUMNS` to verify the name, type, length, and
|
||||
nullability. A second call to `db_column_exists()` in the same request
|
||||
can return its cached pre-migration result. Only after verification does
|
||||
the script change the registered version and print **Schema 2.0 ready.**
|
||||
|
||||
## Verify a retry preserves user data
|
||||
|
||||
After the first run, check all four IDs and names. The new column starts
|
||||
with an empty string on every row. Write a note and rerun the command:
|
||||
|
||||
```sql
|
||||
SELECT id, name, note FROM plugin_workflowdemo_devices ORDER BY id;
|
||||
UPDATE plugin_workflowdemo_devices SET note = 'keep this note' WHERE id = 2;
|
||||
```
|
||||
|
||||
```console
|
||||
php plugins/workflowdemo/upgrade.php
|
||||
```
|
||||
|
||||
```sql
|
||||
SELECT name, note FROM plugin_workflowdemo_devices WHERE id = 2;
|
||||
SELECT version FROM plugin_config WHERE directory = 'workflowdemo';
|
||||
```
|
||||
|
||||
Expect **edge-b**, **keep this note**, and version **2.0**. A failure
|
||||
between the schema change and version update leaves the column available
|
||||
for the next run to verify. If the definition differs, inspect the
|
||||
database before continuing. For migrations that transform row data,
|
||||
verify the transformation as well as the schema before recording success.
|
||||
|
||||
## Verify uninstall and a fresh installation
|
||||
|
||||
On the disposable fixture, uninstall the plugin. This removes its owned
|
||||
tables and their rows. Keep a backup if you need the example data later.
|
||||
|
||||
```console
|
||||
php cli/plugin_manage.php --plugin=workflowdemo --uninstall
|
||||
```
|
||||
|
||||
```sql
|
||||
SHOW TABLES LIKE 'plugin_workflowdemo_%';
|
||||
```
|
||||
|
||||
Expect no matching tables. Leave the version 2 files in place and install
|
||||
again. A fresh installation should create the final schema immediately.
|
||||
|
||||
```console
|
||||
php cli/plugin_manage.php --plugin=workflowdemo --install --enable
|
||||
```
|
||||
|
||||
```sql
|
||||
SHOW COLUMNS FROM plugin_workflowdemo_devices LIKE 'note';
|
||||
SELECT COUNT(*) FROM plugin_workflowdemo_devices;
|
||||
```
|
||||
|
||||
Expect the `note` column and zero records. This distinguishes a working
|
||||
fresh install from an upgrade that only succeeds when historical data or
|
||||
an earlier installation step is present.
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,171 @@
|
||||
# Tags
|
||||
|
||||
The Tags plugin (`tags`) draws colored tags on Cacti graphs to mark events at
|
||||
a point in time. You can enter tags by hand, and the plugin can create
|
||||
automatic tags for events such as a device restart, a new device, a Cacti
|
||||
version change, or a plugin being enabled. Administrators who want to match
|
||||
graph changes with maintenance work and system events need it.
|
||||
|
||||
This page follows the plugin's `develop` branch, which is unreleased and can
|
||||
change. That branch declares version 0.1 and Cacti compatibility 1.2.29 in its
|
||||
`INFO` file. The plugin has no published release.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Plugin version 0.1 and Cacti 1.2.29 or later, as declared in `INFO`.
|
||||
- The `INFO` file lists no required plugins.
|
||||
- The PHP binary configured in Cacti (the `path_php_binary` setting), which
|
||||
the poller uses to start the background `poller_tags.php` script. If the
|
||||
setting is empty, `php` is used from the path.
|
||||
- The PHP `pcntl` functions, which `poller_tags.php` uses for signal handling.
|
||||
- The main Cacti server. The `INFO` file declares no remote data collector
|
||||
support for viewing or management.
|
||||
- On Cacti older than 1.2.31, the README says to add a small snippet to
|
||||
`applySkin()` in `include/layout.js` so the **Cancel** buttons on forms
|
||||
work. See the README for the exact code.
|
||||
|
||||
## Installation
|
||||
|
||||
Install the plugin in `plugins/tags`, using the directory name `tags` rather
|
||||
than `plugin_tags`. Then follow the generic steps in
|
||||
[Plugin Management](Plugins.md) to install and enable it.
|
||||
|
||||
Installation creates the tables `plugin_tags_event`,
|
||||
`plugin_tags_event_archive`, `plugin_tags_uptime`, and `plugin_tags_state`.
|
||||
After installing, open **Console > Configuration > Settings > Tags** and choose
|
||||
a primary device. When the plugin's data is removed, these tables are dropped
|
||||
and the plugin's settings are deleted.
|
||||
|
||||
## Permissions
|
||||
|
||||
| Realm | Pages |
|
||||
| --- | --- |
|
||||
| **Plugin Tags - view** | `tags.php` |
|
||||
|
||||
This is the only realm the plugin registers.
|
||||
|
||||
## Settings
|
||||
|
||||
Settings are on **Console > Configuration > Settings** under the **Tags** tab.
|
||||
|
||||
### Settings section
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| **Hide tags in graphs** | Off | Do not display tags in graphs. |
|
||||
| **Data Retention** | 1 Year | Tags older than this are moved to the archive and are no longer displayed. Choices are Never, 7 Days, 14 Days, 1 Month, 3 Months, 6 Months, 1 Year, and 2 Years. |
|
||||
| **Graph legend limit** | 4 | When the number of tags is above the limit, the legend is aggregated. The number of vertical lines is limited to 5 times this value. |
|
||||
| **Select Primary Device** | None | Typically a local Cacti device. Tags related to the Cacti system are displayed on it. |
|
||||
|
||||
### Automatic tags - host specific
|
||||
|
||||
Each automatic tag has an on and off setting and a color setting. The color
|
||||
choices are Black, Red, Green, Blue, Yellow, Grey, Brown, and Pink. The default
|
||||
color is Black, and the plugin recommends a different color for each tag type.
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| **Host restart automatic tag** | On | Create a tag when a device restarts. |
|
||||
| **Host added automatic tag. Will be displayed on 'Default' device and specific device** | On | Create tags when a device is added. |
|
||||
| **Device save/change automatic tag** | On | Create a tag when a device is saved or changed. |
|
||||
| **Data source reindex automatic tag** | On | Create a tag when the set of indexes returned by a device data query changes. |
|
||||
|
||||
### Automatic tags - others
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| **Choose how to display tags listed below** | All devices | Show the tags below on **All devices** or only on the **Primary device**. |
|
||||
| **Cacti version automatic tag** | On | Create a tag when the Cacti version changes. |
|
||||
| **Poller overrun automatic tag** | On | Create a tag when a polling cycle exceeds the configured poller interval. |
|
||||
| **Data collector status automatic tags** | On | Create tags when a remote data collector goes down or recovers. |
|
||||
| **Plugin status automatic tag** | On | Create a tag when a plugin is enabled, disabled, or upgraded. |
|
||||
|
||||
## Using Tags
|
||||
|
||||
Open **Console > Management > Tags**. The page is titled **Tags Management**.
|
||||
The plus icon creates a tag.
|
||||
|
||||
The following example uses synthetic data. It shows the tag list with seven
|
||||
tags: a mix of automatic tags (**Automatic** column **Yes**) and manual tags,
|
||||
each with its color swatch, time, target, and device.
|
||||
|
||||

|
||||
|
||||
The filter bar has **Device**, **Search**, **Target**, **Type**, **Tags**,
|
||||
**Archive**, **Presets**, **From**, and **To**. The list columns are
|
||||
**Description**, **Tag time**, **Target**, **Device**, **Graph**, **Site**, and
|
||||
**Automatic**. Select tags and use the actions **Delete**, **Disable**,
|
||||
**Enable**, or **Archive**.
|
||||
|
||||
### Add a manual tag
|
||||
|
||||
1. Click the plus icon on **Tags Management**.
|
||||
2. Enter a **Description** of up to 64 characters.
|
||||
3. Choose **For which device**: **All devices**, **All devices with the same
|
||||
site id**, **Specific device**, **Specific graph**, or **Primary Cacti
|
||||
device**. Then select the **Device**, **Graph**, or **Site** that applies.
|
||||
4. Set **Date and time of tag** and **Choose color**.
|
||||
5. Leave **Enable** checked and save. A disabled tag is not shown in graphs.
|
||||
|
||||
### Hide tags on a graph
|
||||
|
||||
Tags are drawn on graphs unless **Hide tags in graphs** is set. The graph
|
||||
view adds a tag icon next to the graph. Clicking it toggles **Disable Tags**
|
||||
or **Enable Tags** for your session.
|
||||
|
||||
## Background Processing
|
||||
|
||||
At the end of every polling cycle, the `poller_bottom` hook runs these steps.
|
||||
|
||||
- On the main poller, it checks for poller overrun events.
|
||||
- On every poller, it starts `poller_tags.php` in the background.
|
||||
|
||||
`poller_tags.php` then:
|
||||
|
||||
- archives tags older than the **Data Retention** setting,
|
||||
- checks devices for restarts and new devices,
|
||||
- checks for a Cacti version change when **Cacti version automatic tag** is on,
|
||||
- checks for poller overrun events when **Poller overrun automatic tag** is on,
|
||||
- checks for plugin status changes when **Plugin status automatic tag** is on,
|
||||
- writes a `TAGS STATS` line to the Cacti log with the run time and the number
|
||||
of tags created, and saves it in the `plugin_tags_stats` setting.
|
||||
|
||||
Another run exits quietly if the previous one is still active. Reindex
|
||||
tags are created when a data query run changes its indexes, and device change
|
||||
tags are created when a device is saved. Archived tags move to the
|
||||
`plugin_tags_event_archive` table. The `plugin_tags_event` table grows with
|
||||
every tag, so set **Data Retention** to a value that suits your install.
|
||||
|
||||
## Command-Line Tools
|
||||
|
||||
`poller_tags.php` can be run by hand from the Cacti directory as the poller
|
||||
user, for testing.
|
||||
|
||||
```console
|
||||
usage: poller_tags.php [--force] [--debug]
|
||||
|
||||
--force - force execution, e.g. for testing
|
||||
--debug - debug execution, e.g. for testing
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- If the Cacti log shows `Cannot create tag, primary device not set`, choose a
|
||||
device in **Select Primary Device** on the **Tags** settings tab.
|
||||
- Selecting the **Primary Cacti device** target on the tag list without a
|
||||
primary device shows a message asking you to set one in the Tags settings.
|
||||
- `Another Tags Process Still Running` appears in debug output when a previous
|
||||
run has not finished.
|
||||
- Run `poller_tags.php --debug` to log debug messages under the `TAGS`
|
||||
category.
|
||||
|
||||
## More Information
|
||||
|
||||
- [Plugin repository](https://github.com/Cacti/plugin_tags)
|
||||
- [README](https://github.com/Cacti/plugin_tags/blob/develop/README.md)
|
||||
- [Plugin Management](Plugins.md)
|
||||
- [Supported plugins](supported-plugins.md)
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,60 @@
|
||||
# TopX
|
||||
|
||||
Use TopX to rank data sources across devices over the same time interval.
|
||||
For example, a network operator can find the busiest interfaces and open
|
||||
their graphs to see when a peak occurred. The plugin reads the rollups
|
||||
produced by Cacti's Data Source Statistics.
|
||||
|
||||
## Requirements and installation
|
||||
|
||||
The source revision described here declares TopX 1.2 and Cacti 1.2.32 as
|
||||
its minimum. For an older installation, check the requirements and
|
||||
instructions at the plugin tag you intend to install. The [plugin README]
|
||||
lists the differences between the source branch and older releases.
|
||||
|
||||
1. Enable **Data Source Statistics** in Cacti's **Settings > Data**.
|
||||
2. Install the plugin in `plugins/topx` and enable it in
|
||||
[Plugin Management](Plugins.md).
|
||||
3. Grant **Plugin TopX - View** to users who operate the dashboard. Grant
|
||||
**Manage TopX Data Sources** to administrators who edit definitions.
|
||||
4. Allow at least one statistics rollup to complete. Confirm that a
|
||||
source you expect to rank has a recent, populated graph in Cacti.
|
||||
|
||||
## Rank and investigate a source
|
||||
|
||||
Open the **TopX** tab. **Overview** shows the source catalog, uptime by
|
||||
host, and ranking cards. Open **Data Source**, choose a source and time
|
||||
window, then compare its ranking, average, peak, and value distribution.
|
||||
When comparing two interfaces, use the same window and units. Follow up
|
||||
on the underlying device graph before changing a capacity limit.
|
||||
|
||||

|
||||
|
||||
## Add a definition
|
||||
|
||||
Open **Console > Management > TopX Data Sources**. Filter by supported
|
||||
status, select a data template, and define the metric from its RRD fields.
|
||||
For traffic, verify whether the input is bytes per second and whether the
|
||||
definition converts to bits per second. Save the definition and check one
|
||||
ranked value against the underlying graph. Admins can also export or
|
||||
import source definitions. See the [source definition reference].
|
||||
|
||||
## Upgrade and troubleshoot
|
||||
|
||||
Back up the database and plugin directory, deploy the files for the new
|
||||
version, then open the console so the upgrade hook can refresh the schema
|
||||
and registration. Uninstalling drops the custom definitions and averages.
|
||||
|
||||
For an empty ranking, check that statistics collection is enabled, the
|
||||
selected interval has populated rollups, and the definition names the RRD
|
||||
fields for the intended data template. For a missing tab or edit screen,
|
||||
check the user's corresponding plugin realm.
|
||||
|
||||
[plugin README]:
|
||||
<https://github.com/Cacti/plugin_topx/blob/5e4f10c8507cf9f517f521abd633a59e3c0557c7/README.md>
|
||||
[source definition reference]:
|
||||
<https://github.com/Cacti/plugin_topx/blob/5e4f10c8507cf9f517f521abd633a59e3c0557c7/HOW_TO_ADD_YOUR_DATA.md>
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -0,0 +1,191 @@
|
||||
# Webseer
|
||||
|
||||
Webseer monitors web sites and web services from Cacti. An administrator adds
|
||||
a service check with a URL and, optionally, a string that a working response
|
||||
must contain. On every poller cycle Webseer requests the URL, records the HTTP
|
||||
code, the DNS, connect, redirect and total times, and sends email when a site
|
||||
goes down or recovers. It is for administrators who want availability and
|
||||
response-time checks for web sites next to their device monitoring.
|
||||
|
||||
This page follows the plugin's `develop` branch, which is unreleased and can
|
||||
change. The branch declares version 3.3 and Cacti compatibility 1.2.29 in its
|
||||
`INFO` file. Its display name in `INFO` is Service Monitor, and its menu entry
|
||||
is **Service Checks**. Do not treat this page as a description of a released
|
||||
version.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Version 3.3 and Cacti 1.2.29 or later, as declared in `INFO`. No other
|
||||
plugin is required.
|
||||
- The PHP cURL extension. The poller script prints "FATAL: You must install
|
||||
php-curl to use this Plugin" when `curl_init` is missing.
|
||||
- The Maintenance (`maint`) plugin is optional. When it is enabled, Webseer
|
||||
skips a check that has an active maintenance schedule.
|
||||
- The PHP binary path from Cacti's **Paths** settings, which the poller uses
|
||||
to start the check processes. If it is empty, `php` is used.
|
||||
|
||||
## Installation
|
||||
|
||||
Follow the generic steps in [Plugin Management](Plugins.md), installing the
|
||||
plugin in `plugins/webseer`. Grant the **Web Service Check Admin** realm to
|
||||
the users who create or edit service checks, servers and proxies. Then open
|
||||
**Console > Management > Service Checks**.
|
||||
|
||||
When you upgrade the plugin files, restart the Webseer background process:
|
||||
`poller_webseer.php` can keep running and holds the old code in memory. Stop
|
||||
the running `poller_webseer.php`, and Cacti's poller starts it again on the
|
||||
next cycle. On upgrade the plugin also removes its own development-only
|
||||
files, such as the `tests` directory.
|
||||
|
||||
On Cacti releases below 1.2.31, the Cancel buttons on forms need a click
|
||||
binding for the `cactiReturnTo` class in `include/layout.js`. The README has
|
||||
the snippet.
|
||||
|
||||
Uninstalling the plugin drops its tables, including all checks and history.
|
||||
|
||||
## Permissions
|
||||
|
||||
The plugin registers one realm in `setup.php`.
|
||||
|
||||
| Realm | Pages covered |
|
||||
| --- | --- |
|
||||
| Web Service Check Admin | `webseer.php`, `webseer_servers.php`, `webseer_proxies.php` |
|
||||
|
||||
## Settings
|
||||
|
||||
Webseer adds no tab to **Console > Configuration > Settings**. Configuration
|
||||
is done per service check, per server and per proxy on the pages described
|
||||
below.
|
||||
|
||||
## Using Webseer
|
||||
|
||||
Open **Console > Management > Service Checks**. The page has three tabs:
|
||||
**Checks**, **Servers** and **Proxies**.
|
||||
|
||||
The following screenshot shows the **Checks** tab with synthetic data: healthy
|
||||
checks, one failing check and one disabled check, with their status, HTTP
|
||||
code, timing columns and last check.
|
||||
|
||||
![Check list with synthetic checks in several states][img-webseer-checks]
|
||||
|
||||
The list columns are **Name**, **Status**, **Enabled**, **Compression**,
|
||||
**HTTP Code**, **Auth**, **DNS**, **Connect**, **Redirect**, **Total**,
|
||||
**Timeout** and **Last Check**. Each row has icons to edit the check, enable or
|
||||
disable it, and view its history. The history page lists each result with
|
||||
date, URL, error, HTTP code and the DNS, connect, redirect and total times, and
|
||||
the history of one check can be purged. Bulk actions are **Delete**,
|
||||
**Disable**, **Enable** and **Duplicate**.
|
||||
|
||||
### Add a service check
|
||||
|
||||
1. On the **Checks** tab, add a check.
|
||||
2. Under **General Settings**, set **Service Check Name** and **Enable Service
|
||||
Check** (default on), then enter the **URL** to monitor. **IP Address**
|
||||
forces a connection to a given address instead of DNS resolution.
|
||||
3. Select a **Proxy Server** if the connection needs one, otherwise choose
|
||||
**None**. **Compression** sets the compression the server requires. The
|
||||
description notes that most servers do not need it.
|
||||
4. Under **Available Checks**, tick **Requires Authentication** if the site
|
||||
normally returns a 401 error, and **Check Certificate** (default off in the
|
||||
form) to validate the TLS certificate. The description says to leave
|
||||
validation off for a site with a self-signed certificate.
|
||||
5. Under **Notification Timing**, set **Trigger** (default 3) and **Time Out**
|
||||
(default 4). **Trigger** is how many minutes the URL must be down before an
|
||||
alert is sent. For a **Site Recovered** email, the URL must also be up for
|
||||
that many minutes. **Time Out** is how many seconds to wait before the page
|
||||
is reported as down.
|
||||
6. Under **Verification Strings**, set **Response Search String**,
|
||||
**Response Search String - Maintenance Page** and **Response Search String
|
||||
- Failed**. The maintenance string marks a response that shows the service
|
||||
is under maintenance. The failed string alerts only when it is found,
|
||||
ignoring time-outs and the other strings.
|
||||
7. Under **Notification Settings**, set **Notify Format** (html or plain),
|
||||
**Notification List**, **Notify Accounts** and **Extra Alert Emails**.
|
||||
|
||||
### Servers
|
||||
|
||||
The **Servers** tab lists the servers that run checks. A server has a name,
|
||||
**Enable Server**, **Is this server the local server?**, **Master Server**,
|
||||
**IP Address**, **URL** (the address of `remote.php` on that server) and
|
||||
**Location**. The master server handles all email operations. Bulk actions are
|
||||
**Delete**, **Disable** and **Enable**, and a history page lists results
|
||||
reported by a server.
|
||||
|
||||
A registered server reports back to the main installation through
|
||||
`remote.php`, which accepts heartbeat and result requests only from the IP
|
||||
address of a registered server. The plugin replicates its server, proxy,
|
||||
contact and URL tables to remote pollers.
|
||||
|
||||
### Proxies
|
||||
|
||||
The **Proxies** tab holds web proxies. A proxy has a **Name**, **Hostname**,
|
||||
**HTTP Port** (default 80), **HTTPS Port** (default 443) and, if the proxy
|
||||
requires it, a **User Name** and **Password**. Select a proxy in a check.
|
||||
|
||||
## Background Processing
|
||||
|
||||
Webseer hooks into `poller_bottom` and starts `poller_webseer.php` in the
|
||||
background on every poller cycle. The script registers the local server,
|
||||
then starts one `webseer_process.php` for each enabled check of that poller,
|
||||
with at most 12 running at the same time, and waits for them to finish. Each
|
||||
check tries up to three times and stops at the first success. After a check
|
||||
finishes, Webseer evaluates the **Trigger** timing and sends a **Site Down** or
|
||||
**Site Recovered** email. A check with an active maintenance schedule is
|
||||
skipped.
|
||||
|
||||
At the end of a run, `poller_webseer.php` writes a `WEBSEER STATS` line to the
|
||||
Cacti log. On poller 1 it deletes history rows older than 30 days. The history
|
||||
table grows by one row per check per run, until the purge.
|
||||
|
||||
## Command-Line Tools
|
||||
|
||||
Run these as the Cacti poller user.
|
||||
|
||||
```console
|
||||
usage: poller_webseer.php [--debug] [--force]
|
||||
|
||||
This binary will exec all the Web Service check child processes.
|
||||
|
||||
--force - Force all the service checks to run now
|
||||
--debug - Display verbose output during execution
|
||||
```
|
||||
|
||||
```console
|
||||
usage: webseer_process.php --id=N [--debug]
|
||||
|
||||
--id=N - The url ID from the WebSeer database.
|
||||
--debug - Display verbose output during execution
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- Nothing is checked and the poller output says php-curl is required:
|
||||
install the PHP cURL extension.
|
||||
- A check never alerts: **Trigger** counts minutes of downtime. A site that
|
||||
recovers within the trigger time does not alert.
|
||||
- A site with a self-signed certificate shows as down: turn off **Check
|
||||
Certificate** for that check.
|
||||
- A check shows an error while the site is in a planned outage: set up a
|
||||
maintenance schedule with the Maintenance plugin, or use **Response Search
|
||||
String - Maintenance Page**.
|
||||
- The log shows "ERROR: Unable to obtain Proxy settings": the proxy selected
|
||||
in the check no longer exists. Select another proxy or **None**.
|
||||
- The log shows "ERROR: No users to send WEBSEER Notification": the check has
|
||||
no notification list, accounts or extra emails that resolve to an address.
|
||||
- A remote server does not report: `remote.php` accepts requests only from
|
||||
the IP address of a registered server, so the **IP Address** on the
|
||||
**Servers** tab must match the address the server connects from.
|
||||
|
||||
## More Information
|
||||
|
||||
- [Webseer repository](https://github.com/Cacti/plugin_webseer)
|
||||
- [Webseer README][readme]
|
||||
- [Plugin Management](Plugins.md)
|
||||
- [Supported plugins](supported-plugins.md)
|
||||
|
||||
[img-webseer-checks]: images/plugin-webseer-checks.png
|
||||
[readme]: https://github.com/Cacti/plugin_webseer/blob/develop/README.md
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -175,6 +175,8 @@ the maintained Enterprise Linux instructions.
|
||||
|
||||
7. [Upgrading Cacti Under FreeBSD](Upgrading-Cacti-Under-FreeBSD.md)
|
||||
|
||||
8. [Harden a Cacti installation](Hardening-Cacti-Installation.md)
|
||||
|
||||
### Cacti Overview
|
||||
|
||||
1. Overview
|
||||
@@ -353,6 +355,8 @@ the maintained Enterprise Linux instructions.
|
||||
|
||||
8. [Version Specific Release Notes](Version-Specific-Release-Notes.md)
|
||||
|
||||
9. [Themes and plugin appearance](Themes.md)
|
||||
|
||||
### Plugin Development
|
||||
|
||||
1. [Plugin Overview](Plugin-Development.md)
|
||||
@@ -367,6 +371,16 @@ the maintained Enterprise Linux instructions.
|
||||
|
||||
6. [Development and Testing](Development-and-Testing.md)
|
||||
|
||||
7. [Card API Developer Guide](Card-API.md)
|
||||
|
||||
8. [Build a Filterable Plugin Page](Plugin-Filterable-Page.md)
|
||||
|
||||
9. [Upgrade a Plugin with Existing Data](Plugin-Schema-Upgrades.md)
|
||||
|
||||
10. [Test a Plugin through the Browser](Plugin-Browser-Testing.md)
|
||||
|
||||
11. [Remote collector plugin output](Plugin-Remote-Collection.md)
|
||||
|
||||
### Plugins
|
||||
|
||||
1. [Supported Plugins](supported-plugins.md)
|
||||
@@ -408,6 +422,28 @@ the maintained Enterprise Linux instructions.
|
||||
19. [ReportIt legacy PDF manual](resource/pdf/manual_reportit.pdf)
|
||||
(older version, PDF format)
|
||||
|
||||
20. [Alarm Manager](Plugin-Alarmmanager.md)
|
||||
|
||||
21. [Audit](Plugin-Audit.md)
|
||||
|
||||
22. [Credentials](Plugin-Credentials.md)
|
||||
|
||||
23. [Cycle](Plugin-Cycle.md)
|
||||
|
||||
24. [Graph Export](Plugin-Gexport.md)
|
||||
|
||||
25. [GPSMap](Plugin-Gpsmap.md)
|
||||
|
||||
26. [Nagios Plugin for Cacti](Plugin-Npc.md)
|
||||
|
||||
27. [QuickTree](Plugin-Quicktree.md)
|
||||
|
||||
28. [Tags](Plugin-Tags.md)
|
||||
|
||||
29. [TopX](Plugin-Topx.md)
|
||||
|
||||
30. [Webseer](Plugin-Webseer.md)
|
||||
|
||||
### How Tos
|
||||
|
||||
1. [How To Work with Templates](How-To-Work-With-Templates.md)
|
||||
@@ -475,6 +511,8 @@ This section contains template specific configuration requirements.
|
||||
|
||||
2. [ESXi/VMWare Template](template_esxi_config.md)
|
||||
|
||||
3. [Graph Proxmox external storage usage](device-template-specific-proxmox.md)
|
||||
|
||||
[manual-dev]:<https://github.com/Cacti/documentation/tree/develop>
|
||||
[release]: https://github.com/Cacti/cacti/releases/tag/release%2F1.2.31
|
||||
[videos]: https://www.youtube.com/channel/UC6ROmUGuuLa9BdHWzvGSY1w
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# Themes and plugin appearance
|
||||
|
||||
Set the default **Theme** in [Visual Settings](Settings-Visual.md). A user
|
||||
with access to personal settings can select a different theme. Test with
|
||||
an account configured like the person who reported a display problem.
|
||||
|
||||

|
||||
|
||||
## Check a plugin after a theme change
|
||||
|
||||
1. Open the same populated plugin page under two installed themes using
|
||||
the same account, filters and time range.
|
||||
2. Compare headings, links, selected rows, input focus and status labels.
|
||||
Check a native Cacti page as well. A difference confined to one plugin
|
||||
helps its maintainer locate an overriding stylesheet.
|
||||
3. Record the Cacti and plugin versions, theme, browser and window size.
|
||||
Include the steps and a screenshot using sample data. If the graph is
|
||||
empty in both themes, check [data collection](Data-Debug.md).
|
||||
|
||||
Developers can run the [theme tests](Development-and-Testing.md) against
|
||||
the maintenance branch. The available themes depend on the installed build.
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
@@ -74,7 +74,10 @@ fi
|
||||
|
||||
# Keep the downloadable plugin alongside its guide in the offline manual.
|
||||
mkdir -p "${BASE_PATH}/${ODIR}/resources" || exit 1
|
||||
cp "${BASE_PATH}/resources/example.tgz" "${BASE_PATH}/${ODIR}/resources/" || exit 1
|
||||
for asset in example.tgz carddemo.zip workflowdemo-1.zip workflowdemo-2.zip workflowdemo-browser.cjs
|
||||
do
|
||||
cp "${BASE_PATH}/resources/${asset}" "${BASE_PATH}/${ODIR}/resources/" || exit 1
|
||||
done
|
||||
|
||||
# copy css resourse
|
||||
echo "Copying css..."
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Graph Proxmox external storage usage
|
||||
|
||||
When a storage pool is missing from the host disk query, first run
|
||||
`pvesm status` on the Proxmox host using an authorized account. Identify
|
||||
the storage name and its utilization column. A local filesystem graph can
|
||||
represent a different volume from the external pool.
|
||||
|
||||
1. Have the host administrator expose one numeric utilization value for
|
||||
the selected pool through the approved monitoring agent. For Net-SNMP,
|
||||
see the [SNMP extension walkthrough][extend]. Return no measurement
|
||||
when the pool is absent or the command fails. Zero is a valid reading.
|
||||
2. From the assigned Cacti collector, query the instance for that pool
|
||||
with its read-only credentials. Compare the numeric result with
|
||||
`pvesm status` from the same collection interval.
|
||||
3. [Graph the single OID](Graph-a-Single-SNMP-OID.md) as a gauge in
|
||||
percent. Include the pool name in the graph title. Repeat the comparison
|
||||
after another poll and check how the graph displays a missing sample.
|
||||
|
||||
Use a distinct instance and graph for each storage pool. If the agent
|
||||
cannot read a pool, confirm its permissions with the host administrator.
|
||||
|
||||
[extend]: How-To-SNMP-Custom-Script.md
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2004-2026 The Cacti Group
|
||||
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 227 KiB |
|
After Width: | Height: | Size: 125 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 128 KiB |
|
After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 144 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 42 KiB |
@@ -0,0 +1,50 @@
|
||||
const assert = require('node:assert/strict');
|
||||
const { chromium } = require('playwright');
|
||||
|
||||
(async () => {
|
||||
const browser = await chromium.launch(process.env.CHROME_BIN
|
||||
? { executablePath: process.env.CHROME_BIN } : {});
|
||||
try {
|
||||
for (const role of ['ALLOWED', 'DENIED']) {
|
||||
const context = await browser.newContext({ viewport: { width: 1100, height: 720 } });
|
||||
const page = await context.newPage();
|
||||
const root = new URL(process.env.CACTI_URL);
|
||||
await page.goto(new URL('index.php', root).href);
|
||||
await page.locator('[name=login_username]').fill(process.env[role + '_USER']);
|
||||
await page.locator('[name=login_password]').fill(process.env[role + '_PASSWORD']);
|
||||
await page.locator('input[type=submit], button[type=submit]').first().click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
assert.ok((await page.locator('body').innerText()).includes(process.env[role + '_USER']));
|
||||
await page.goto(new URL('plugins/workflowdemo/workflowdemo_devices.php', root).href);
|
||||
const rows = page.locator('#wf-results tbody td');
|
||||
if (role === 'DENIED') {
|
||||
assert.match(await page.locator('body').innerText(), /denied|permission|authorized/i);
|
||||
assert.equal(await rows.count(), 0);
|
||||
} else {
|
||||
await rows.first().waitFor();
|
||||
assert.deepEqual(await rows.allTextContents(), ['core-a', 'edge-a']);
|
||||
const filter = page.locator('input[name=filter]').first();
|
||||
await filter.fill('edge');
|
||||
await filter.press('Enter');
|
||||
await page.waitForFunction(() => document.querySelector('#wf-results td')?.textContent === 'edge-a');
|
||||
assert.deepEqual(await rows.allTextContents(), ['edge-a', 'edge-b']);
|
||||
await page.getByRole('link', { name: 'Name', exact: true }).click();
|
||||
await page.waitForFunction(() => document.querySelector('#wf-results td')?.textContent === 'edge-c');
|
||||
assert.deepEqual(await rows.allTextContents(), ['edge-c', 'edge-b']);
|
||||
await page.getByRole('link', { name: 'Next', exact: true }).click();
|
||||
await page.waitForFunction(() => document.querySelector('#wf-results td')?.textContent === 'edge-a');
|
||||
assert.deepEqual(await rows.allTextContents(), ['edge-a']);
|
||||
if (process.env.SCREENSHOT) {
|
||||
await page.screenshot({path:process.env.SCREENSHOT, clip:{x:0,y:0,width:1100,height:235}});
|
||||
}
|
||||
await page.locator('input[name=filter]').first().fill('absent');
|
||||
await page.locator('input[name=filter]').first().press('Enter');
|
||||
await page.getByText('No matching devices', {exact:true}).waitFor();
|
||||
assert.equal(await rows.count(), 0);
|
||||
}
|
||||
await context.close();
|
||||
}
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
})().catch(error => { console.error(error); process.exitCode = 1; });
|
||||
@@ -233,3 +233,20 @@ Here is a list of the plugins we support and a short description of them.
|
||||
|
||||
[WMI plugin homepage](https://github.com/Cacti/plugin_wmi)
|
||||
and [manual page](Plugin-Wmi.md)
|
||||
|
||||
## Additional plugin manuals
|
||||
|
||||
Check the minimum Cacti version on each page against your installation.
|
||||
A plugin’s current development branch can require a later 1.2.x build.
|
||||
|
||||
- [Alarm Manager](Plugin-Alarmmanager.md)
|
||||
- [Audit](Plugin-Audit.md)
|
||||
- [Credentials](Plugin-Credentials.md)
|
||||
- [Cycle](Plugin-Cycle.md)
|
||||
- [Graph Export](Plugin-Gexport.md)
|
||||
- [GPSMap](Plugin-Gpsmap.md)
|
||||
- [Nagios Plugin for Cacti](Plugin-Npc.md)
|
||||
- [QuickTree](Plugin-Quicktree.md)
|
||||
- [Tags](Plugin-Tags.md)
|
||||
- [TopX](Plugin-Topx.md)
|
||||
- [Webseer](Plugin-Webseer.md)
|
||||