Files
cacti/tests/fixtures/snmp_command_probe.php
Thomas VincentandTheWitness 40d49ef495 fix(snmp): preserve session errors and enforce 100% coverage (#7613)
* Improve native SNMP session error logging

* Preserve SNMP warnings when operations throw

* Add complete SNMP coverage gate

* Simplify four-byte SNMP hex formatting

* fix(snmp): reject invalid v3 protocol combinations

* ci(coverage): isolate SNMP coverage workflow

* Exclude isolated SNMP coverage from unit suite

* fix: Properly initialize snmp_value variable

---------

Co-authored-by: TheWitness <thewitness@cacti.net>
2026-08-10 14:37:43 -04:00

30 lines
533 B
PHP
Executable File

#!/usr/bin/env php
<?php
$mode = getenv('CACTI_SNMP_PROBE_MODE') ?: 'get';
if ($mode === 'timeout') {
print 'Timeout: No Response';
exit(1);
}
if ($mode === 'error') {
print 'probe failure';
exit(2);
}
if ($mode === 'tooBig') {
print 'Error in packet: (tooBig)';
exit(1);
}
if ($mode === 'walk') {
print ".1.3.6.1.2.1.1.1.0 = STRING: coverage agent\n";
print " continuation\n";
print "invalid-oid = STRING: rejected\n";
print ".1.3.6.1.2.1.1.2.0 = STRING: End of MIB\n";
exit(0);
}
print 'STRING: "coverage value"';