-
-
Notifications
You must be signed in to change notification settings - Fork 261
libpcp_web, pmproxy: support for optional labels #2591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,117 @@ | ||||||||||||||||||||||||||||||||
| #!/bin/sh | ||||||||||||||||||||||||||||||||
| # PCP QA Test No. 1744 | ||||||||||||||||||||||||||||||||
| # Test pmproxy / pmseries label storing mechanism | ||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||
| # Copyright (c) 2026 Red Hat. All Rights Reserved. | ||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||
| seq=`basename $0` | ||||||||||||||||||||||||||||||||
| echo "QA output created by $seq" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # get standard environment, filters and checks | ||||||||||||||||||||||||||||||||
| . ./common.python | ||||||||||||||||||||||||||||||||
| . ./common.keys | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| _check_series | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| status=1 # failure is the default! | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| _cleanup() | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| cd $here | ||||||||||||||||||||||||||||||||
| [ -n "$pmloggerpid" ] && $sudo kill -TERM $pmloggerpid 2>/dev/null | ||||||||||||||||||||||||||||||||
| if [ -n "$key_server_port" ]; then | ||||||||||||||||||||||||||||||||
| echo "Shutting down key server on port $key_server_port..." >>$here/$seq.full | ||||||||||||||||||||||||||||||||
| $keys_cli -p $key_server_port shutdown >>$here/$seq.full 2>&1 | ||||||||||||||||||||||||||||||||
| sleep 1 | ||||||||||||||||||||||||||||||||
| # Verify it's actually dead | ||||||||||||||||||||||||||||||||
| if $keys_cli -p $key_server_port PING >>$here/$seq.full 2>&1; then | ||||||||||||||||||||||||||||||||
| echo "WARNING: Key server still running after shutdown!" >>$here/$seq.full | ||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||
| echo "Key server shutdown confirmed" >>$here/$seq.full | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
| _sighup_pmcd | ||||||||||||||||||||||||||||||||
| _restore_config $PCP_SYSCONF_DIR/pmseries | ||||||||||||||||||||||||||||||||
| $sudo rm -rf $tmp $tmp.* | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| trap "_cleanup; exit \$status" 0 1 2 3 15 | ||||||||||||||||||||||||||||||||
| _stop_auto_restart pmcd | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
Comment on lines
+33
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Restore pmcd auto-restart policy in cleanup. Line 39 disables pmcd auto-restart via Suggested fix _cleanup()
{
cd $here
[ -n "$pmloggerpid" ] && $sudo kill -TERM $pmloggerpid 2>/dev/null
@@
fi
_sighup_pmcd
+ _restore_auto_restart pmcd
_restore_config $PCP_SYSCONF_DIR/pmseries
$sudo rm -rf $tmp $tmp.*
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it looks like there should be a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
_sighup_pmcd
+ _restore_auto_restart pmcd
_restore_config $PCP_SYSCONF_DIR/pmseries
$sudo rm -rf $tmp $tmp.*
} |
||||||||||||||||||||||||||||||||
| A="$here/archives/pcp-atop-nvidia" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| _filter() | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| # Replace machine-specific label values with placeholders | ||||||||||||||||||||||||||||||||
| sed \ | ||||||||||||||||||||||||||||||||
| -e "s/\"hostname\":\"[a-z]*\"/\"hostname\":\"HOSTNAME\"/g" \ | ||||||||||||||||||||||||||||||||
| -e 's/"uuid":"GPU-[0-9a-f-]*"/"uuid":"UUID"/g' | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| _filter_series() | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| sed \ | ||||||||||||||||||||||||||||||||
| -e 's/[0-9a-z]\{40\}/TIMESERIES/g' \ | ||||||||||||||||||||||||||||||||
| #end | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # real QA test starts here | ||||||||||||||||||||||||||||||||
| key_server_port=`_find_free_port` | ||||||||||||||||||||||||||||||||
| _save_config $PCP_SYSCONF_DIR/pmseries | ||||||||||||||||||||||||||||||||
| $sudo rm -f $PCP_SYSCONF_DIR/pmseries/* | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Create pmseries config pointing to our test key server | ||||||||||||||||||||||||||||||||
| $sudo tee $PCP_SYSCONF_DIR/pmseries/pmseries.conf > /dev/null <<EOF | ||||||||||||||||||||||||||||||||
| [pmseries] | ||||||||||||||||||||||||||||||||
| servers = localhost:$key_server_port | ||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| echo "Start test key server on port $key_server_port..." >>$seq.full | ||||||||||||||||||||||||||||||||
| $key_server --port $key_server_port --save "" > $tmp.keys 2>&1 & | ||||||||||||||||||||||||||||||||
| _check_key_server_ping $key_server_port | ||||||||||||||||||||||||||||||||
| _check_key_server $key_server_port | ||||||||||||||||||||||||||||||||
| echo | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| _check_key_server_version $key_server_port | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Check key server port and flush | ||||||||||||||||||||||||||||||||
| echo "Using key server on port $key_server_port" >>$seq_full | ||||||||||||||||||||||||||||||||
| echo "Flushing key server on port $key_server_port ..." | ||||||||||||||||||||||||||||||||
| flush_result=`echo "FLUSHALL" | $keys_cli -p $key_server_port 2>&1` | ||||||||||||||||||||||||||||||||
| echo "Flush result: $flush_result" >>$seq_full | ||||||||||||||||||||||||||||||||
| if [ "$flush_result" != "OK" ]; then | ||||||||||||||||||||||||||||||||
| echo "ERROR: Failed to flush key server, got: $flush_result" | ||||||||||||||||||||||||||||||||
| status=1 | ||||||||||||||||||||||||||||||||
| exit | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
| echo "Key server flushed successfully" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Load the archive into pmseries | ||||||||||||||||||||||||||||||||
| echo "Loading test archive into pmseries ..." | ||||||||||||||||||||||||||||||||
| pmseries $options --load "{source.path: \"$A\"}" 2>&1 | \ | ||||||||||||||||||||||||||||||||
| sed "s|$A|ARCHIVE|g" | tee -a $seq_full | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Wait for metrics to be indexed | ||||||||||||||||||||||||||||||||
| echo "Waiting for metrics to be indexed ..." | ||||||||||||||||||||||||||||||||
| pmsleep 2 | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Query for the first metric (identifying labels only) | ||||||||||||||||||||||||||||||||
| echo | ||||||||||||||||||||||||||||||||
| echo "=== nvidia.gpuactive (optional labels "gpu" & "uuid") ===" | ||||||||||||||||||||||||||||||||
| series1=`pmseries $options 'nvidia.gpuactive'` | ||||||||||||||||||||||||||||||||
| if [ -z "$series1" ]; then | ||||||||||||||||||||||||||||||||
| echo "ERROR: No series found for nvidia.gpuactive" | ||||||||||||||||||||||||||||||||
| status=1 | ||||||||||||||||||||||||||||||||
| exit | ||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||
| pmseries $series1 | _filter_series | _filter | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| echo == Note: check $seq.full for details | ||||||||||||||||||||||||||||||||
| echo == pmlogger LOG == >>$seq_full | ||||||||||||||||||||||||||||||||
| cat $tmp.pmlogger.log >>$seq_full 2>&1 | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # success, all done | ||||||||||||||||||||||||||||||||
| status=0 | ||||||||||||||||||||||||||||||||
| exit | ||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| QA output created by 1744 | ||
| PING | ||
| PONG | ||
|
|
||
| Flushing key server on port 54321 ... | ||
| Key server flushed successfully | ||
| Loading test archive into pmseries ... | ||
| pmseries: [Info] processed 11 archive records from ARCHIVE | ||
| Waiting for metrics to be indexed ... | ||
|
|
||
| === nvidia.gpuactive (optional labels gpu & uuid) === | ||
|
|
||
| TIMESERIES | ||
| PMID: 120.0.7 | ||
| Data Type: 32-bit unsigned int InDom: 120.0 0x1e000000 | ||
| Semantics: instant Units: none | ||
| Source: TIMESERIES | ||
| Metric: nvidia.gpuactive | ||
| inst [0 or "gpu0"] series TIMESERIES | ||
| inst [0 or "gpu0"] labels {"agent":"nvidia","device_type":"gpu","gpu":0,"hostname":"HOSTNAME","indom_name":"per gpu","uuid":"UUID"} | ||
| == Note: check 1744.full for details |
Uh oh!
There was an error while loading. Please reload this page.