| | |
| | | */ |
| | | @Override |
| | | public String getDsApplIfProtocol() { |
| | | String portNumber = (String)this.monitor.getAttribute |
| | | (this.connectionHandlerName, "ds-connectionhandler-listener"); |
| | | Object listener = this.monitor.getAttribute( |
| | | this.connectionHandlerName, "ds-connectionhandler-listener"); |
| | | if (listener instanceof Object[]) { |
| | | // A connection handler with several listen addresses reports them as an array. |
| | | Object[] listeners = (Object[]) listener; |
| | | listener = listeners.length > 0 ? listeners[0] : null; |
| | | } |
| | | String portNumber = listener != null ? String.valueOf(listener) : null; |
| | | if (portNumber==null) { |
| | | return this.DsApplIfProtocol; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the value of the provided connection handler statistic as a |
| | | * counter, or zero if the statistic is not available or does not hold a |
| | | * number. |
| | | * |
| | | * @param statisticName the name of the connection handler statistic |
| | | * @return the counter value of the statistic |
| | | */ |
| | | private Long getCounter32Statistic(String statisticName) { |
| | | if (stats == null) { |
| | | stats = this.monitor.getConnectionHandlerStatistics( |
| | | connectionHandlerName); |
| | | } |
| | | if (stats == null) { |
| | | return 0L; |
| | | } |
| | | try { |
| | | long value = Long.parseLong( |
| | | String.valueOf(this.monitor.getAttribute(stats, statisticName))); |
| | | return SNMPMonitor.counter32Value(value); |
| | | } catch (NumberFormatException e) { |
| | | // The statistic is not available or is not a number. |
| | | return 0L; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | * @return DsApplIfSearchOps |
| | | */ |
| | | @Override |
| | | public Long getDsApplIfSearchOps() { |
| | | if (stats == null) { |
| | | stats = this.monitor.getConnectionHandlerStatistics( |
| | | connectionHandlerName); |
| | | } |
| | | if (stats != null) { |
| | | long value = Long.parseLong((String) this.monitor.getAttribute(stats, |
| | | "searchRequests")); |
| | | return SNMPMonitor.counter32Value(value); |
| | | } else { |
| | | return 0L; |
| | | } |
| | | return getCounter32Statistic("searchRequests"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public Long getDsApplIfOneLevelSearchOps() { |
| | | if (stats == null) { |
| | | stats = this.monitor.getConnectionHandlerStatistics( |
| | | connectionHandlerName); |
| | | } |
| | | if (stats != null) { |
| | | long value = Long.parseLong((String) this.monitor.getAttribute(stats, |
| | | "searchOneRequests")); |
| | | return SNMPMonitor.counter32Value(value); |
| | | } else { |
| | | return 0L; |
| | | } |
| | | return getCounter32Statistic("searchOneRequests"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public Long getDsApplIfWholeSubtreeSearchOps() { |
| | | if (stats == null) { |
| | | stats = this.monitor.getConnectionHandlerStatistics( |
| | | connectionHandlerName); |
| | | } |
| | | if (stats != null) { |
| | | long value = Long.parseLong((String) this.monitor.getAttribute(stats, |
| | | "searchSubRequests")); |
| | | return SNMPMonitor.counter32Value(value); |
| | | } else { |
| | | return 0L; |
| | | } |
| | | return getCounter32Statistic("searchSubRequests"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public Long getDsApplIfModifyRDNOps() { |
| | | if (stats == null) { |
| | | stats = this.monitor.getConnectionHandlerStatistics( |
| | | connectionHandlerName); |
| | | } |
| | | if (stats != null) { |
| | | long value = Long.parseLong((String) this.monitor.getAttribute( |
| | | stats, "modifyDNRequests")); |
| | | return SNMPMonitor.counter32Value(value); |
| | | } else { |
| | | return 0L; |
| | | } |
| | | return getCounter32Statistic("modifyDNRequests"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public Long getDsApplIfModifyEntryOps() { |
| | | if (stats == null) { |
| | | stats = this.monitor.getConnectionHandlerStatistics( |
| | | connectionHandlerName); |
| | | } |
| | | if (stats != null) { |
| | | long value = Long.parseLong((String) this.monitor.getAttribute( |
| | | stats, "modifyRequests")); |
| | | return SNMPMonitor.counter32Value(value); |
| | | } else { |
| | | return 0L; |
| | | } |
| | | return getCounter32Statistic("modifyRequests"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public Long getDsApplIfRemoveEntryOps() { |
| | | if (stats == null) { |
| | | stats = this.monitor.getConnectionHandlerStatistics( |
| | | connectionHandlerName); |
| | | } |
| | | if (stats != null) { |
| | | long value = Long.parseLong((String) this.monitor.getAttribute( |
| | | stats, "deleteRequests")); |
| | | return SNMPMonitor.counter32Value(value); |
| | | } else { |
| | | return 0L; |
| | | } |
| | | return getCounter32Statistic("deleteRequests"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public Long getDsApplIfAddEntryOps() { |
| | | if (stats == null) { |
| | | stats = this.monitor.getConnectionHandlerStatistics( |
| | | connectionHandlerName); |
| | | } |
| | | if (stats != null) { |
| | | long value = Long.parseLong((String) this.monitor.getAttribute( |
| | | stats, "addRequests")); |
| | | return SNMPMonitor.counter32Value(value); |
| | | } else { |
| | | return 0L; |
| | | } |
| | | return getCounter32Statistic("addRequests"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public Long getDsApplIfCompareOps() { |
| | | if (stats == null) { |
| | | stats = this.monitor.getConnectionHandlerStatistics( |
| | | connectionHandlerName); |
| | | } |
| | | if (stats != null) { |
| | | long value = Long.parseLong((String) this.monitor.getAttribute( |
| | | stats, "compareRequests")); |
| | | return SNMPMonitor.counter32Value(value); |
| | | } else { |
| | | return 0L; |
| | | } |
| | | return getCounter32Statistic("compareRequests"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public Long getDsApplIfOutBytes() { |
| | | if (stats == null) { |
| | | stats = this.monitor.getConnectionHandlerStatistics( |
| | | connectionHandlerName); |
| | | } |
| | | if (stats != null) { |
| | | long value = Long.parseLong((String) this.monitor.getAttribute( |
| | | stats, "bytesWritten")); |
| | | return SNMPMonitor.counter32Value(value); |
| | | } else { |
| | | return 0L; |
| | | } |
| | | return getCounter32Statistic("bytesWritten"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public Long getDsApplIfInBytes() { |
| | | if (stats == null) { |
| | | stats = this.monitor.getConnectionHandlerStatistics( |
| | | connectionHandlerName); |
| | | } |
| | | if (stats != null) { |
| | | long value = Long.parseLong((String) this.monitor.getAttribute( |
| | | stats, "bytesRead")); |
| | | return SNMPMonitor.counter32Value(value); |
| | | } else { |
| | | return 0L; |
| | | } |
| | | return getCounter32Statistic("bytesRead"); |
| | | } |
| | | |
| | | /** |