Page 1 of 1

Bug in SNMP wizard?

Posted: Fri Apr 01, 2016 9:29 am
by User Name
I am using the SNMP Wizard to configure new Linux hosts on RHEL 6 for a Proof Of Concept project with XI. Unfortunately the generated service config files are not working. I see what happens but I do not know how to fix it.

- RHEL 6
- nagiosxi-5-2.0.el6.x86_64.tar.gz
- offline installation performed

Since we have hundreds of Linux servers to configure it would be nice if this feature worked properly.

See attachment - relevant settings circled in red.

When v3 is used with authNoPriv, username and password but no privileged password, the privileged protocol setting gets stored nevertheless.

The check_snmp_storage_wizard.pl (and other check_snmp* scripts) will be configured to work like this:

Code: Select all

/usr/local/nagios/libexec/check_snmp_storage_wizard.pl -v -H c1aadapp5001 --login='<secret>' --passwd='<secret>' --protocols=md5,des -m "\^/mnt/tibco\$" -w 80 -c 95 -f

The second argument to --protocols should not be there in this case, because we are NOT using a privileged password. Hence the command fails with the error "Put snmp V3 priv login info with priv protocols!"
Also, the parameter with the -m argument is incorrect and makes the command fail. It should be "/mnt/tibco", without the anchors and escapes.

When I tweak the command manually it works. However, a restart or reconfiguration will put the 'des' and the regex patterns back, causing failure.

Note that the 'Privileged Protocol' pulldown menu has only the two options DES and AES, and not an 'empty' choice.

Is there a solution to this?

Re: Bug in SNMP wizard?

Posted: Fri Apr 01, 2016 1:10 pm
by lmiltchev
In order to use Linux SNMP wizard with SNMP v3 and no privileged password, try the following "workaround". Make a backup of the "linux_snmp.inc.php" file:

Code: Select all

cp -p /usr/local/nagiosxi/html/includes/configwizards/linux_snmp/linux_snmp.inc.php /usr/local/nagiosxi/html/includes/configwizards/linux_snmp/linux_snmp.inc.php.orig
Open the "/usr/local/nagiosxi/html/includes/configwizards/linux_snmp/linux_snmp.inc.php" file, and modify it by changing this (around line 168):
<select name="snmpopts[v3_auth_proto]" class="form-control">
<option value="md5" ' . is_selected($snmpopts["v3_auth_proto"], "md5") . '>MD5</option>
<option value="sha" ' . is_selected($snmpopts["v3_auth_proto"], "sha") . '>SHA</option>
</select>
to this:
<select name="snmpopts[v3_priv_proto]" class="form-control">
<option value="" ' . is_selected($serviceargs["v3_priv_proto"], "") . '>None</option>
<option value="des" ' . is_selected($snmpopts["v3_priv_proto"], "des") . '>DES</option>
<option value="aes" ' . is_selected($snmpopts["v3_priv_proto"], "aes") . '>AES</option>
</select>
Also, change this (around line 235 & line 823):
if ($username != "")
$snmpargs .= " --login=" . $username;
if ($authpassword != "")
$snmpargs .= " --passwd=" . $authpassword;
if ($privacypassword != "")
$snmpargs .= " --privpass=" . $privacypassword;
if ($authproto != "")
$snmpargs .= " --protocols=" . $authproto . "," . $privproto;
to this:
if ($username != "")
$snmpargs .= " --login=" . $username;
if ($authpassword != "")
$snmpargs .= " --passwd=" . $authpassword;
if ($privacypassword != "")
$snmpargs .= " --privpass=" . $privacypassword;
if ($authproto != "" && $privproto != "") {
$snmpargs .= " --protocols=" . $authproto . "," . $privproto;
} else if ($authproto != "" ) {
$snmpargs .= " --protocols=" . $authproto;
Rerun the wizard (select authNoPriv), and see if this is going to fix your issue. Thank you!

Re: Bug in SNMP wizard?

Posted: Mon Apr 04, 2016 2:16 am
by User Name
Thank you very much, that works :)

Note: the last block is missing the closing curly brace.

Re: Bug in SNMP wizard?

Posted: Mon Apr 04, 2016 9:31 am
by lmiltchev
I am glad I could help! :)