banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for version 1.0.0.

Network

banshee/network-collection/network/fortinet/snmp/

ha

The high-availability cluster of a FortiGate by SNMP: its mode, its members, their configuration sync, and a failover.

  • network
  • snmp
  • fortinet
  • fortigate
  • fortios
  • firewall
  • ha
  • cluster

by banshee1 installation2 versions

v2Latest

Published on October 28, 2026. One naming convention across collections; documentation completed.

Keen 1.0.0 · 67 lines
// The high-availability cluster of a FortiGate, by SNMP (FORTINET-FORTIGATE-MIB, fgHighAvailability): its
// mode, the number of its members, whether each member has its configuration in sync, and which member is
// primary, to see a failover. A member is named by its host name. A FortiGate that is not in a cluster
// stops the collector: there is no cluster to watch.
need('protocol:snmp');

per('member', 'Members');
output('mode', 'text', array('label' => 'Cluster mode'));
output('members', 'number', array('label' => 'Members'));
output('primary', 'text', array('label' => 'Primary member'));
output('sync', 'text', array('label' => 'Configuration sync', 'per' => 'member'));

watch.below('member-lost', 'Cluster member missing', 'members', array('critical' => 2));
watch.state('out-of-sync', 'Configuration out of sync', 'sync', array('critical' => array('unsynchronized'), 'for' => '3 runs'));
watch.expect('primary', 'Failover', 'primary', array(
    'help'    => 'Raises when the primary is another member than the one given: the cluster has failed over.',
    'enabled' => false,
));
watch.missing('missing', 'Member missing', 'sync', array('enabled' => false));

// fgHaSystemMode: standalone (1), activeActive (2), activePassive (3).
$modes = array(1 => 'standalone', 2 => 'active-active', 3 => 'active-passive');
$mode = list.get($modes, snmp.get('1.3.6.1.4.1.12356.101.13.1.1.0'), 'unknown');
if ($mode == 'standalone') {
    fail('misconfigured', 'The FortiGate is not in a cluster (fgHaSystemMode standalone)');
}
value('mode', $mode);

// fgHaStatsTable, by fgHaStatsIndex: fgHaStatsSerial, fgHaStatsHostname, fgHaStatsSyncStatus
// (unsynchronized 0, synchronized 1) and fgHaStatsMasterSerial, the serial number of the primary at the
// last sync.
$members = snmp.table(array(
    'serial'  => '1.3.6.1.4.1.12356.101.13.2.1.1.2',
    'host'    => '1.3.6.1.4.1.12356.101.13.2.1.1.11',
    'sync'    => '1.3.6.1.4.1.12356.101.13.2.1.1.12',
    'primary' => '1.3.6.1.4.1.12356.101.13.2.1.1.16',
));

$count = 0;
$primary_serial = '';
$hosts = array();
foreach ($members as $index => $row) {
    $name = list.get($row, 'host', '');
    if ($name == '') {
        $name = list.get($row, 'serial', 'member ' . $index);
    }
    $hosts[list.get($row, 'serial', '')] = $name;
    $count = $count + 1;
    $sync = 'unknown';
    if (list.get($row, 'sync', '') == 0) {
        $sync = 'unsynchronized';
    } elseif (list.get($row, 'sync', '') == 1) {
        $sync = 'synchronized';
    }
    value('sync', $sync, $name);
    if (list.get($row, 'primary', '') != '') {
        $primary_serial = $row['primary'];
    }
}
value('members', $count);

// The primary by its host name when it is a member listed, otherwise by its serial number.
$primary = list.get($hosts, $primary_serial, $primary_serial);
if ($primary == '') {
    $primary = 'unknown';
}
value('primary', $primary);