-2 heartbeat when no collection specified for jsr160 collector
Description
I started a JSR160 collector without a configuration parameter of 'collection' and recieved an exception:
org.opennms.netmgt.rrd.RrdException: An error occured creating rrdfile /usr/local/OpenNMS/share/rrd/snmp/1/jsr160/CurThreadCpuTime.jrb: org.jrobin.core.RrdException: Invalid heartbeat, must be positive: -2 at org.opennms.netmgt.rrd.RrdUtils.createRRD(RrdUtils.java:198) at org.opennms.netmgt.collectd.PersistOperationBuilder.commit(PersistOperationBuilder.java:110) at org.opennms.netmgt.collectd.BasePersister.commitBuilder(BasePersister.java:72) at org.opennms.netmgt.collectd.OneToOnePersister.completeAttribute(OneToOnePersister.java:57) at org.opennms.netmgt.collectd.AbstractCollectionAttribute.visit(AbstractCollectionAttribute.java:65) at org.opennms.netmgt.collectd.AttributeGroup.visit(AttributeGroup.java:75) at org.opennms.netmgt.collectd.AbstractCollectionResource.visit(AbstractCollectionResource.java:103) at org.opennms.netmgt.collectd.JMXCollector$JMXCollectionSet.visit(JMXCollector.java:913) at org.opennms.netmgt.collectd.CollectableService.doCollection(CollectableService.java:354) at org.opennms.netmgt.collectd.CollectableService.run(CollectableService.java:296) at org.opennms.netmgt.scheduler.LegacyScheduler$1.run(LegacyScheduler.java:292) at org.opennms.core.concurrent.RunnableConsumerThreadPool$FiberThreadImpl.run(RunnableConsumerThreadPool.java:422) at java.lang.Thread.run(Thread.java:619) Caused by: org.jrobin.core.RrdException: Invalid heartbeat, must be positive: -2 at org.jrobin.core.DsDef.validate(DsDef.java:146) at org.jrobin.core.DsDef.<init>(DsDef.java:83) at org.jrobin.core.RrdDef.addDatasource(RrdDef.java:230) at org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy.createDefinition(JRobinRrdStrategy.java:105) at org.opennms.netmgt.rrd.QueuingRrdStrategy.createDefinition(QueuingRrdStrategy.java:732) at org.opennms.netmgt.rrd.RrdUtils.createRRD(RrdUtils.java:193)
this is because the return value of getStep(collection) isnt being checked, and error condition is -1.
Shouldn't we perhaps reopen 2446 instead of this one?
DJ Gregor June 6, 2008 at 4:17 PM
Reopening. The fact that we ever try to use an RRD heartbeat of -2, even in the case of a configuration error, is a bug.
Jeff Gehlbach June 5, 2008 at 5:50 PM
Sorry for the terse tone of my previous reply – the second sentence should have gone more like this:
Thanks for taking the time to report a bug. In the future, ...
Jeff Gehlbach June 5, 2008 at 5:33 PM
This report is a duplicate of . Please search existing bugs before creating a new one – a search for "Invalid heartbeat, must be positive" would have turned up 2446.
I started a JSR160 collector without a configuration parameter of 'collection' and recieved an exception:
org.opennms.netmgt.rrd.RrdException: An error occured creating rrdfile /usr/local/OpenNMS/share/rrd/snmp/1/jsr160/CurThreadCpuTime.jrb: org.jrobin.core.RrdException: Invalid heartbeat, must be positive: -2
at org.opennms.netmgt.rrd.RrdUtils.createRRD(RrdUtils.java:198)
at org.opennms.netmgt.collectd.PersistOperationBuilder.commit(PersistOperationBuilder.java:110)
at org.opennms.netmgt.collectd.BasePersister.commitBuilder(BasePersister.java:72)
at org.opennms.netmgt.collectd.OneToOnePersister.completeAttribute(OneToOnePersister.java:57)
at org.opennms.netmgt.collectd.AbstractCollectionAttribute.visit(AbstractCollectionAttribute.java:65)
at org.opennms.netmgt.collectd.AttributeGroup.visit(AttributeGroup.java:75)
at org.opennms.netmgt.collectd.AbstractCollectionResource.visit(AbstractCollectionResource.java:103)
at org.opennms.netmgt.collectd.JMXCollector$JMXCollectionSet.visit(JMXCollector.java:913)
at org.opennms.netmgt.collectd.CollectableService.doCollection(CollectableService.java:354)
at org.opennms.netmgt.collectd.CollectableService.run(CollectableService.java:296)
at org.opennms.netmgt.scheduler.LegacyScheduler$1.run(LegacyScheduler.java:292)
at org.opennms.core.concurrent.RunnableConsumerThreadPool$FiberThreadImpl.run(RunnableConsumerThreadPool.java:422)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.jrobin.core.RrdException: Invalid heartbeat, must be positive: -2
at org.jrobin.core.DsDef.validate(DsDef.java:146)
at org.jrobin.core.DsDef.<init>(DsDef.java:83)
at org.jrobin.core.RrdDef.addDatasource(RrdDef.java:230)
at org.opennms.netmgt.rrd.jrobin.JRobinRrdStrategy.createDefinition(JRobinRrdStrategy.java:105)
at org.opennms.netmgt.rrd.QueuingRrdStrategy.createDefinition(QueuingRrdStrategy.java:732)
at org.opennms.netmgt.rrd.RrdUtils.createRRD(RrdUtils.java:193)
this is because the return value of getStep(collection) isnt being checked, and error condition is -1.
public RrdRepository getRrdRepository(String collectionName) {
RrdRepository repo = new RrdRepository();
repo.setRrdBaseDir(new File(getRrdPath()));
repo.setRraList(getRRAList(collectionName));
repo.setStep(getStep(collectionName));
repo.setHeartBeat((2 * getStep(collectionName)));
return repo;
//return m_config.getRrdRepository();
}