Skip to content

Commit

Permalink
update exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
oussamarouabah committed Jun 7, 2024
1 parent 5bacba0 commit cc3e866
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
26 changes: 12 additions & 14 deletions exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,9 @@ def collect(self):
label_values.append(self.nsip)
else:
label_values = [self.nsip]
if entity_name == "lbvserver" and self.skip_metric(label_values, self.vlb_prefix_filter):
continue
if entity_name == "csvserver" and self.skip_metric(label_values, self.vcs_prefix_filter):
continue

if self.skip_metric(entity_name, data_item): continue

try:
c.add_metric(label_values, float(
data_item[ns_metric_name]))
Expand Down Expand Up @@ -396,10 +395,9 @@ def collect(self):
label_values.append(self.nsip)
else:
label_values = [self.nsip]
if entity_name == "lbvserver" and self.skip_metric(label_values, self.vlb_prefix_filter):
continue
if entity_name == "csvserver" and self.skip_metric(label_values, self.vcs_prefix_filter):
continue

if self.skip_metric(entity_name, data_item): continue

try:
g.add_metric(label_values, float(
data_item[ns_metric_name]))
Expand All @@ -410,12 +408,12 @@ def collect(self):
self.stats_access_pending = False
yield self.populate_probe_status(status)

def skip_metric(self, label_values, filter):
if filter:
match = re.match(filter, label_values[0])
if match:
return False
return True
def skip_metric(self, entity_name, data_item):
if entity_name == 'lbvserver' and self.vlb_prefix_filter:
return re.match(self.vlb_prefix_filter, data_item['name']) is None
if entity_name == 'csvserver' and self.vcs_prefix_filter:
return re.match(self.vcs_prefix_filter, data_item['name']) is None
return False

# Function to fire nitro commands and collect data from NS
def collect_data(self, entity):
Expand Down
2 changes: 1 addition & 1 deletion exporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
spec:
containers:
- name: netscaler-exporter-be
image: ghcr.io/thg-ice/netscaler-exporter:v0.0.4
image: ghcr.io/thg-ice/netscaler-exporter:v0.0.5
args:
- "--target-nsip=10.10.127.126"
- "--port=8888"
Expand Down

0 comments on commit cc3e866

Please sign in to comment.