<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Well, did file two bugs.  I believe that I might have found two...</div>

<div>I will take the source package and fix #708397 myself.  I will wait for the maintainer what he says about the other one.</div>

<div>I will post the changed apc-mib.c here.  Ok?  Or shall I send it to someone else?</div>

<div>-lutzn</div>

<div> </div>

<div>
<div>Debian Bug #708397:  nut: APC SNMP set value does not work (wrong mib type declarations)<br/>
Package: nut<br/>
Version: 2.6.4-1<br/>
Severity: normal</div>

<div>Unable to set Values such as "Minimum battery level for restart after power off (percent)" on an APC Smart-UPS with AP9617. Can set battery change date.</div>

<div>I tried to set "Minimum battery level for restart after power off (percent)" to 90. And this gave "90". See below.<br/>
I saw in apc-mib.c that the type for this is declared as ST_FLAG_STRING. This is abolutely no string (so no 's' but 'i' would be correct).</div>

<div>Here comes the tcpdump:<br/>
snmpset -c private -v 1 10.100.200.30 1.3.6.1.4.1.318.1.1.1.5.2.6.0 i 90 makes this:<br/>
14:01:02.725830 IP 10.100.200.1.40893 > 10.100.200.30.161: C=private SetRequest(35) .1.3.6.1.4.1.318.1.1.1.5.2.6.0=90<br/>
14:01:02.759972 IP 10.100.200.30.161 > 10.100.200.1.40893: C=private GetResponse(35) .1.3.6.1.4.1.318.1.1.1.5.2.6.0=90</div>

<div>And the same with nut's upsset.cgi makes this:<br/>
13:58:40.196924 IP 10.100.200.1.38704 > 10.100.200.30.161: C=private SetRequest(36) .1.3.6.1.4.1.318.1.1.1.5.2.6.0="90"<br/>
13:58:40.223239 IP 10.100.200.30.161 > 10.100.200.1.38704: C=private GetResponse(36) badValue@1 .1.3.6.1.4.1.318.1.1.1.5.2.6.0="90"</div>

<div>So maybe a problem with "90" vs 90 ?</div>

<div>From the sources I saw that the same is true for the latest version of nut.</div>

<div>Please see this thread on nut ml http://lists.alioth.debian.org/pipermail/nut-upsuser/2013-May/008400.html</div>

<div><br/>
-- System Information:<br/>
Debian Release: wheezy/sid<br/>
APT prefers stable-updates<br/>
APT policy: (500, 'stable-updates'), (500, 'stable')<br/>
Architecture: amd64 (x86_64)</div>

<div>Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)<br/>
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)<br/>
Shell: /bin/sh linked to /bin/dash</div>

<div>Versions of packages nut depends on:<br/>
ii nut-client 2.6.4-1<br/>
ii nut-server 2.6.4-1</div>

<div>nut recommends no packages.</div>

<div>nut suggests no packages.</div>

<div>-- no debconf information</div>

<div> </div>

<div>Debian Bug #708400:  nut: Shutdown error "genError" with APC and SNMP<br/>
Package: nut<br/>
Version: 2.6.4-1<br/>
Severity: normal</div>

<div>Cannot shutdown APC Smart-UPS with AP9617 and get the following error:</div>

<div>root@abex:~# /lib/nut/snmp-ups -DDDD -a apc10001 -k<br/>
Network UPS Tools - Generic SNMP UPS driver 0.66 (2.6.4)<br/>
0.000000 debug level is '4'<br/>
0.000446 SNMP UPS driver : entering upsdrv_initups()<br/>
0.000471 SNMP UPS driver : entering nut_snmp_init(snmp-ups)<br/>
0.018439 SNMP UPS driver : entering load_mib2nut(apcc)<br/>
0.018467 load_mib2nut: trying classic method with 'apcc' mib<br/>
0.018478 Entering nut_snmp_get_str()<br/>
0.018499 nut_snmp_get(.1.3.6.1.4.1.318.1.1.1.1.1.1.0)<br/>
0.035932 load_mib2nut: using apcc mib<br/>
0.035963 su_find_info: "ups.model" found<br/>
0.035980 Entering nut_snmp_get_str()<br/>
0.036007 nut_snmp_get(.1.3.6.1.4.1.318.1.1.1.1.1.1.0)<br/>
0.055572 Detected Smart-UPS 1000 on host 10.100.200.30 (mib: apcc 1.1)<br/>
0.055610 su_find_info: unknown info type (load.off.delay)<br/>
0.055630 su_find_info: unknown info type (load.on.delay)<br/>
0.055668 su_find_info: unknown info type (load.off.delay)<br/>
0.055687 Initiating UPS shutdown<br/>
0.055705 upsdrv_shutdown...<br/>
0.055721 entering su_instcmd(shutdown.return, (null))<br/>
0.055740 su_find_info: "shutdown.return" found<br/>
0.055771 entering nut_snmp_set (.1.3.6.1.4.1.318.1.1.1.6.1.1.0, i, 2)<br/>
0.098838 [apc10001] nut_snmp_set: can't set .1.3.6.1.4.1.318.1.1.1.6.1.1.0: Error in packet: (genError) A general failure occured<br/>
0.098870 su_instcmd: cannot set value for shutdown.return<br/>
0.098888 entering su_instcmd(shutdown.reboot, (null))<br/>
0.098919 su_find_info: unknown info type (shutdown.reboot)<br/>
0.098938 su_instcmd: shutdown.reboot unavailable<br/>
0.098955 entering su_instcmd(load.off.delay, (null))<br/>
0.098981 su_find_info: unknown info type (load.off.delay)<br/>
0.098993 su_instcmd: load.off.delay unavailable<br/>
0.099026 Shutdown failed!</div>

<div><br/>
tcpdump output:<br/>
15:22:22.063065 IP 10.100.200.1.43571 > 10.100.200.30.161: C=private GetRequest(34) .1.3.6.1.4.1.318.1.1.1.1.1.1.0<br/>
15:22:22.080085 IP 10.100.200.30.161 > 10.100.200.1.43571: C=private GetResponse(52) .1.3.6.1.4.1.318.1.1.1.1.1.1.0="Smart-UPS 1000"<br/>
15:22:22.080286 IP 10.100.200.1.43571 > 10.100.200.30.161: C=private GetRequest(34) .1.3.6.1.4.1.318.1.1.1.1.1.1.0<br/>
15:22:22.098435 IP 10.100.200.30.161 > 10.100.200.1.43571: C=private GetResponse(52) .1.3.6.1.4.1.318.1.1.1.1.1.1.0="Smart-UPS 1000"<br/>
15:22:22.098717 IP 10.100.200.1.43571 > 10.100.200.30.161: C=private SetRequest(35) .1.3.6.1.4.1.318.1.1.1.6.1.1.0=2<br/>
15:22:22.135136 IP 10.100.200.30.161 > 10.100.200.1.43571: C=private GetResponse(35) genErr@1 .1.3.6.1.4.1.318.1.1.1.6.1.1.0=2</div>

<div><br/>
ups.conf contains:<br/>
user = nut<br/>
[apc10001]<br/>
driver = snmp-ups<br/>
port = 10.100.200.30<br/>
snmp_version = v1<br/>
mibs = apcc<br/>
pollfreq = 15<br/>
desc = "APC Smart-UPS 1000I"<br/>
community=private</div>

<div><br/>
-- System Information:<br/>
Debian Release: wheezy/sid<br/>
APT prefers stable-updates<br/>
APT policy: (500, 'stable-updates'), (500, 'stable')<br/>
Architecture: amd64 (x86_64)</div>

<div>Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)<br/>
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)<br/>
Shell: /bin/sh linked to /bin/dash</div>

<div>Versions of packages nut depends on:<br/>
ii nut-client 2.6.4-1<br/>
ii nut-server 2.6.4-1</div>

<div>nut recommends no packages.</div>

<div>nut suggests no packages.</div>

<div>-- no debconf information</div>

<div> </div>
</div>

<div> 
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On May 15, 2013, at 8:50 AM, lutz.niederer@gmx.net wrote:
<div name="quoted-content"><br/>
> I tried to set "Minimum battery level for restart after power off (percent)" to 90. And this gave "90" as mentioned below. I saw in apc-mib.c that the type for this is declared as ST_FLAG_STRING. This is abolutely no string (so no 's' but 'i' would be correct).<br/>
<br/>
I agree with that assessment, but what about the error for the following call?<br/>
<br/>
0.055771 entering nut_snmp_set (.1.3.6.1.4.1.318.1.1.1.6.1.1.0, i, 2)<br/>
<br/>
0.098838 [apc10001] nut_snmp_set: can't set .1.3.6.1.4.1.318.1.1.1.6.1.1.0: Error in packet: (genError) A general failure occured<br/>
<br/>
That seems to be specifying an integer, which agrees with this:<br/>
<br/>
<<a href="http://www.mibdepot.com/cgi-bin/getmib3.cgi?win=mib_a&i=1&n=PowerNet-MIB&r=dell&f=powernet.mib&v=v1&t=sca&o=upsBasicControlConserveBattery" target="_blank">http://www.mibdepot.com/cgi-bin/getmib3.cgi?win=mib_a&i=1&n=PowerNet-MIB&r=dell&f=powernet.mib&v=v1&t=sca&o=upsBasicControlConserveBattery</a>><br/>
<br/>
Does this call to nut_snmp_set() not result in a proper packet as seen in tcpdump?<br/>
<br/>
Since you're using Debian, and this bug would be present in the latest package version as well, I would recommend filing a bug there (and post a link to the bug here). That will make sure it doesn't fall through the cracks. We can continue to debug here as well.<br/>
<br/>
It is also possible to compile NUT from source with the same options that Debian uses, and just swap in the snmp-ups driver for testing.<br/>
<br/>
--<br/>
Charles Lepple<br/>
clepple@gmail<br/>
<br/>
<br/>
 </div>
</div>
</div>
</div></div></body></html>