[Nut-upsdev] [Nut-upsuser] Powerware 9155 with SNMP card

Bernd Markgraf Bernd.Markgraf at med.ovgu.de
Tue Aug 14 14:48:34 UTC 2007


On Tue, 2007-08-14 at 15:31 +0200, Arjen de Korte wrote:
> > I'm trying to add an instant command to pwmib:
> >
> > #define IETF_OID_UPS_TEST_ID	  "1.3.6.1.2.1.33.1.7.1.0"      /*
> > UPS-MIB::upsTestID.0 */
> > #define IETF_OID_UPS_TEST_QBATT   "1.3.6.1.2.1.33.1.7.7.4"      /*
> > UPS-MIB::upsTestQuickBatteryTest.0 */
> >
> > { "test.battery.start", ST_FLAG_STRING, SU_INFOSIZE,
> > IETF_OID_UPS_TEST_ID, IETF_OID_UPS_TEST_QBATT, SU_TYPE_CMD | SU_FLAG_OK,
> > NULL },
> >
> > what I hope it to do is write IETF_OID_UPS_TEST_QBATT into
> > IETF_OID_UPS_TEST_ID to trigger the test. I hope my understanding of the
> > code is right that in this way the string in snmp_info_t->dfl get
> > written to OID IETF_OID_UPS_TEST_ID?
> >
> > though for whatever reason upscmd -l ups doesnt list any instant
> > commands... is there anything else to be done to register an instant
> > command? apccmib.h and mgemib.h both seem to do nothing else?
> 
> The problem is in the upsdrv_initinfo() function in 'snmp-ups.c':
> 
> 	/* add instant commands to the info database. */
> 	for (su_info_p = &snmp_info[0]; su_info_p->info_type != NULL ; su_info_p++)
> 		su_info_p->flags |= SU_FLAG_OK;
> 		if (SU_TYPE(su_info_p) == SU_TYPE_CMD)
> 			dstate_addcmd(su_info_p->info_type);
>
> It looks like we're missing some curly brackets here. Unlike what the
> indentation suggests, the dstate_addcmd() will not be called in the for()
> loop, but only when it has finished. At that time, su_info_p->info_type is
> NULL, so regardless of what SU_TYPE(su_info_p) evaluates to, this never
> adds something useful.
yes this should be it... haven't had much time to read that yet... but I'll give 
that a shot...

> I guess you're the first to notice this, congratulations. Can we persuade
> to join the development team? :-)
hehe I'll definitely contribute all the stuff I'm doing to pwmib and
surroundings... so i guess thats kinda joining ;-)
I'll add some more stuff tomorrow and wait for Niels to put his changes
online so we don't duplicate too much...

  Bernd




More information about the Nut-upsdev mailing list