Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_snmp_load.pl => SNMPv3 do not use the -p (port) option #27

Closed
DB-CL opened this issue Feb 15, 2017 · 3 comments
Closed

check_snmp_load.pl => SNMPv3 do not use the -p (port) option #27

DB-CL opened this issue Feb 15, 2017 · 3 comments
Labels
Milestone

Comments

@DB-CL
Copy link
Contributor

DB-CL commented Feb 15, 2017

Hi,

I'm not sure if it is a bug or an intentional behavior but the check_snmp_load (and maybe others) plugin is not using the -p (port) option when using SNMPv3

I made a few modifications and it's working now (at least for me).

Before :

if (defined($o_login) && defined($o_passwd)) {

    # SNMPv3 login
    verb("SNMPv3 login");
    if (!defined($o_privpass)) {
        verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto");
        ($session, $error) = Net::SNMP->session(
            -hostname     => $o_host,
            -version      => '3',
            -username     => $o_login,
            -authpassword => $o_passwd,
            -authprotocol => $o_authproto,
            -timeout      => $o_timeout,
            -domain       => $o_domain
        );
    } else {
        verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
        ($session, $error) = Net::SNMP->session(
            -hostname     => $o_host,
            -version      => '3',
            -username     => $o_login,
            -authpassword => $o_passwd,
            -authprotocol => $o_authproto,
            -privpassword => $o_privpass,
            -privprotocol => $o_privproto,
            -timeout      => $o_timeout,
            -domain       => $o_domain
        );
    }
}

After :

if (defined($o_login) && defined($o_passwd)) {

    # SNMPv3 login
    verb("SNMPv3 login");
    if (!defined($o_privpass)) {
        verb("SNMPv3 AuthNoPriv login : $o_login, $o_authproto");
        ($session, $error) = Net::SNMP->session(
            -hostname     => $o_host,
            -port         => $o_port,
            -version      => '3',
            -username     => $o_login,
            -authpassword => $o_passwd,
            -authprotocol => $o_authproto,
            -timeout      => $o_timeout,
            -domain       => $o_domain
        );
    } else {
        verb("SNMPv3 AuthPriv login : $o_login, $o_authproto, $o_privproto");
        ($session, $error) = Net::SNMP->session(
            -hostname     => $o_host,
            -port         => $o_port,
            -version      => '3',
            -username     => $o_login,
            -authpassword => $o_passwd,
            -authprotocol => $o_authproto,
            -privpassword => $o_privpass,
            -privprotocol => $o_privproto,
            -timeout      => $o_timeout,
            -domain       => $o_domain
        );
    }
}

Thx !

@dnsmichi
Copy link
Collaborator

Can you please turn that into a PR? Patch looks good to me :)

@DB-CL
Copy link
Contributor Author

DB-CL commented Feb 15, 2017

Done for this file, but I didn't look into the other files yet

@dnsmichi
Copy link
Collaborator

Merci 👍

@dnsmichi dnsmichi added the bug label Apr 27, 2017
@dnsmichi dnsmichi added this to the 2.1.0 milestone Apr 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants