Skip to content

SNMP improvements #5852

Description

@eskyuu

Affected page

https://www.php.net/manual/en/book.snmp.php

Current issue

There are a few new functions, enums and options coming for SNMP in PHP 8.6. Some of these have already been included in the documentation, while others have not. I had a look at doing a PR, but it looks a bit daunting. I'm very happy to help describe what some of the options do if someone can help with the correct structure.

I'm also not sure if the documentation is waiting for the 8.6 release before being updated.

Suggested improvement

New enums:
Snmp\Mib - to control mib parsing
Snmp\OidOutput - to control the format of the OID in results
Snmp\Output - to control the format of values in results
Snmp\StringOutput - to control the output format of strings

New functions:
snmp_init_mib(?string $mibdirs) - Resets the loaded mib tree (unloads any MIBs loaded with snmp_read_mib). Also allows a colon separated list of mib directories to be provided to set the search path for auto-loading MIBs.
snmp_set_output_option(Snmp\Output $option, bool $enable) - Sets the SNMP library value for the given value formatting option on or off
snmp_set_string_output_format(Snmp\StringOutput $format) - Sets the SNMP library value for formatting strings to the selected value

Changed functions:
snmp_set_oid_output_format(Snmp\OidOutput|int $format) - Sets the OID output format in the SNMP library to the selected value, which can be the SNMP_OID_OUTPUT_* constant, or the Snmp\OidOutput enum

New properties for the SNMP class to control value output:
public bool $numeric_index;
public bool $numeric_timeticks;
public bool $extended_index;
public bool $dont_print_units;
public bool $escape_quotes;
public bool $print_hex_text;

New functions for the SNMP class to control OID and string output format:
public function setOidOutputFormat (Snmp\OidOutput $format): bool
public function setStringOutputFormat (Snmp\StringOutput $format): bool

Additional context (optional)

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions