banshee est en développement actif : les collecteurs vont encore changer, et une version que vous publiez demandera sans doute des ajustements. Pour un usage stable, attendez la version 1.0.0.

Windows

banshee/windows-collection/windows/snmp/

services

The started services of a Windows and their state, by SNMP

  • windows
  • snmp
  • services

par banshee1 installation2 versions

v2Dernière

Publiée le 28 octobre 2026. One naming convention across collections; documentation completed.

Keen 1.0.0 · 36 lignes
// The services of a Windows, by SNMP, from svSvcTable (LanMgr-Mib-II, 1.3.6.1.4.1.77).
// Windows lists only the started services there: a stopped service disappears from the table, and it
// is the watch "Service stopped" that sees it, on the names it is given. The name of a service
// is its display name, in the language of the system ("Windows Event Log", "Journal d'événements
// Windows").
need('protocol:snmp');

per('service', 'Services');
output('state', 'text', array('label' => 'State', 'per' => 'service'));

// The event log is expected by default, under its English name. On a Windows in another language it reads
// missing and the probe turns red at once, which shows: the administrator writes the local name on the probe.
// A default that named nothing would stay green on a stopped service, which nobody sees.
watch.missing('stopped', 'Service stopped', 'state', array('critical' => array('Windows Event Log')));
watch.expect('not-active', 'Service paused or in transition', 'state', array('warning' => array('active')));

// Indexed by the name of the service written as an OID: svSvcName and svSvcOperatingState, which is active (1),
// continue-pending (2), pause-pending (3) or paused (4).
$services = snmp.table(array(
    'name'  => '1.3.6.1.4.1.77.1.2.3.1.1',
    'state' => '1.3.6.1.4.1.77.1.2.3.1.3',
));
$states = array(1 => 'active', 2 => 'continue-pending', 3 => 'pause-pending', 4 => 'paused');

$found = 0;
foreach ($services as $row) {
    if (list.has($row, 'name') && list.has($row, 'state')) {
        value('state', list.get($states, $row['state'], 'unknown'), $row['name']);
        $found = $found + 1;
    }
}
// The SNMP service that answers is itself a started service: no service read means the agent does not serve
// LanMgr-Mib-II, never that every service stopped.
if ($found == 0) {
    fail('misconfigured', 'The agent does not serve the service table (svSvcTable, LanMgr-Mib-II)');
}