Skip to content

Commit

Permalink
Merge branch 'pmdauwsgi-qa-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
natoscott committed Apr 3, 2024
2 parents 6f50573 + dffc96f commit 0c52b50
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 10 additions & 3 deletions qa/1992
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,18 @@ pmdauwsgi_install()
echo
echo "=== uwsgi agent installation ==="
$sudo ./Install </dev/null >$tmp.out 2>&1
# Check metrics have appeared ... X metrics and Y values
# Check metrics have appeared ... X metrics and Y values (or)
# Check metrics have appeared ... N warnings, X metrics and 0 values
_filter_pmda_install <$tmp.out \
| $PCP_AWK_PROG '
/Check uwsgi metrics have appeared/ { if ($7 == 15) $7 = "X"
if ($10 >= 0 || $10 == 0) $10 = "Y"
/Check uwsgi metrics have appeared/ { if ($NF > 10) {
if ($8 == "warnings,") $7 = $8 = ""
if ($9 >= 9) $9 = "X"
if ($12 == 0) $12 = "Y"
} else {
if ($7 >= 15) $7 = "X"
if ($10 >= 0) $10 = "Y"
}
}
{ print }'
}
Expand Down
6 changes: 5 additions & 1 deletion src/pmdas/uwsgi/pmdauwsgi.python
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ from cpmapi import (
PM_TYPE_DOUBLE,
PM_TYPE_U64,
PM_SEM_COUNTER,
PM_ERR_AGAIN,
PM_ERR_INST,
PM_ERR_PMID
)
Expand Down Expand Up @@ -262,7 +263,10 @@ class UwsgiPMDA(PMDA):

item_lookup = [summary_attr[0] for summary_attr in UWSGISUMMARY._fields_]
if 0 <= item <= (len(UWSGISUMMARY._fields_) - 1):
return [getattr(self.summary, item_lookup[item]), 1]
try:
return [getattr(self.summary, item_lookup[item]), 1]
except AttributeError: # most likely GET failed
return [PM_ERR_AGAIN, 0]
else:
return [PM_ERR_INST, 0]

Expand Down

0 comments on commit 0c52b50

Please sign in to comment.