PAGER env var and less alias

I guess a lot of people defines alias for /usr/bin/less in ~/.bashrc or ~/.bash_profile. But I guess a large percentage of those people forget to propagate(synchronize) the less alias definition to PAGER environment variable.

I just set it today like below 🙂  and testd.  ‘man’ command reads PAGER env. var .

image

$ unset PAGER
$ man bash
$ alias less='less -I -j 3 -X'
$ export PAGER=${BASH_ALIASES[less]}
$ man bash
BASH(1)
[...omitted...]

If you look at last 10 lines carefully in above, you notice ‘less’ behaved differently because of options, i.e. “-j -3 -X”.

I hope this synchronization will be defined by default in future distribution, maybe Ubuntu. This is so easy to be overlooked.

curl multiple jmx URLs and pipe to jq

Cloudera Manager showing 3 Apache HBase Region servers.

image

All 3 HBase Region Servers has JMX endpoint. And I have a table named ‘my-table’. But I don’t know on which server table/region exists.

So, here’s the one-liner to check ‘my-table’ related JMX metrics from all 3 nodes in one shot.

$ eval curl --insecure --silent \
  https://server-{1,2,3}.domain:22102/jmx | 
  jq -r \
  '.beans[]|to_entries[]|select(.key|contains("_my-table_"))|
  "\(.value)\t\(.key|sub("^.*_my-table_";""))"'
1       region_d041e381782ab852f5346eccfdd5cf2a_metric_storeCount
2       region_d041e381782ab852f5346eccfdd5cf2a_metric_storeFileCount
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_memStoreSize
928172  region_d041e381782ab852f5346eccfdd5cf2a_metric_maxStoreFileAge
823802  region_d041e381782ab852f5346eccfdd5cf2a_metric_minStoreFileAge
875987  region_d041e381782ab852f5346eccfdd5cf2a_metric_avgStoreFileAge
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_numReferenceFiles
9986    region_d041e381782ab852f5346eccfdd5cf2a_metric_storeFileSize
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_compactionsCompletedCount
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_compactionsFailedCount
1589453147738   region_d041e381782ab852f5346eccfdd5cf2a_metric_lastMajorCompactionAge
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_numBytesCompactedCount
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_numFilesCompactedCount
5       region_d041e381782ab852f5346eccfdd5cf2a_metric_readRequestCount
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_filteredReadRequestCount
5       region_d041e381782ab852f5346eccfdd5cf2a_metric_writeRequestCount
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_replicaid
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_compactionsQueuedCount
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_flushesQueuedCount
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_maxCompactionQueueSize
1       region_d041e381782ab852f5346eccfdd5cf2a_metric_maxFlushQueueSize
5       region_d041e381782ab852f5346eccfdd5cf2a_metric_putCount
1       region_d041e381782ab852f5346eccfdd5cf2a_metric_getCount
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_incrementCount
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_appendCount
0       region_d041e381782ab852f5346eccfdd5cf2a_metric_deleteCount
4       region_d041e381782ab852f5346eccfdd5cf2a_metric_scanCount
0       metric_appendTime_num_ops
0       metric_appendTime_min
0       metric_appendTime_max
0       metric_appendTime_mean
0       metric_appendTime_25th_percentile
0       metric_appendTime_median
0       metric_appendTime_75th_percentile
0       metric_appendTime_90th_percentile
0       metric_appendTime_95th_percentile
0       metric_appendTime_98th_percentile
0       metric_appendTime_99th_percentile
0       metric_appendTime_99.9th_percentile
0       metric_putBatchTime_num_ops
0       metric_putBatchTime_min
0       metric_putBatchTime_max
0       metric_putBatchTime_mean
0       metric_putBatchTime_25th_percentile
0       metric_putBatchTime_median
0       metric_putBatchTime_75th_percentile
0       metric_putBatchTime_90th_percentile
0       metric_putBatchTime_95th_percentile
0       metric_putBatchTime_98th_percentile
0       metric_putBatchTime_99th_percentile
0       metric_putBatchTime_99.9th_percentile
1       metric_getTime_num_ops
0       metric_getTime_min
0       metric_getTime_max
0       metric_getTime_mean
0       metric_getTime_25th_percentile
0       metric_getTime_median
0       metric_getTime_75th_percentile
0       metric_getTime_90th_percentile
0       metric_getTime_95th_percentile
0       metric_getTime_98th_percentile
0       metric_getTime_99th_percentile
0       metric_getTime_99.9th_percentile
1       metric_getTime_TimeRangeCount_600000-inf
0       metric_incrementTime_num_ops
0       metric_incrementTime_min
0       metric_incrementTime_max
0       metric_incrementTime_mean
0       metric_incrementTime_25th_percentile
0       metric_incrementTime_median
0       metric_incrementTime_75th_percentile
0       metric_incrementTime_90th_percentile
0       metric_incrementTime_95th_percentile
0       metric_incrementTime_98th_percentile
0       metric_incrementTime_99th_percentile
0       metric_incrementTime_99.9th_percentile
0       metric_deleteBatchTime_num_ops
0       metric_deleteBatchTime_min
0       metric_deleteBatchTime_max
0       metric_deleteBatchTime_mean
0       metric_deleteBatchTime_25th_percentile
0       metric_deleteBatchTime_median
0       metric_deleteBatchTime_75th_percentile
0       metric_deleteBatchTime_90th_percentile
0       metric_deleteBatchTime_95th_percentile
0       metric_deleteBatchTime_98th_percentile
0       metric_deleteBatchTime_99th_percentile
0       metric_deleteBatchTime_99.9th_percentile
4       metric_scanTime_num_ops
0       metric_scanTime_min
0       metric_scanTime_max
0       metric_scanTime_mean
0       metric_scanTime_25th_percentile
0       metric_scanTime_median
0       metric_scanTime_75th_percentile
0       metric_scanTime_90th_percentile
0       metric_scanTime_95th_percentile
0       metric_scanTime_98th_percentile
0       metric_scanTime_99th_percentile
0       metric_scanTime_99.9th_percentile
4       metric_scanTime_TimeRangeCount_600000-inf
0       metric_deleteTime_num_ops
0       metric_deleteTime_min
0       metric_deleteTime_max
0       metric_deleteTime_mean
0       metric_deleteTime_25th_percentile
0       metric_deleteTime_median
0       metric_deleteTime_75th_percentile
0       metric_deleteTime_90th_percentile
0       metric_deleteTime_95th_percentile
0       metric_deleteTime_98th_percentile
0       metric_deleteTime_99th_percentile
0       metric_deleteTime_99.9th_percentile
5       metric_putTime_num_ops
0       metric_putTime_min
0       metric_putTime_max
0       metric_putTime_mean
0       metric_putTime_25th_percentile
0       metric_putTime_median
0       metric_putTime_75th_percentile
0       metric_putTime_90th_percentile
0       metric_putTime_95th_percentile
0       metric_putTime_98th_percentile
0       metric_putTime_99th_percentile
0       metric_putTime_99.9th_percentile
5       metric_putTime_TimeRangeCount_600000-inf
4       metric_scanSize_num_ops
0       metric_scanSize_min
0       metric_scanSize_max
0       metric_scanSize_mean
0       metric_scanSize_25th_percentile
0       metric_scanSize_median
0       metric_scanSize_75th_percentile
0       metric_scanSize_90th_percentile
0       metric_scanSize_95th_percentile
0       metric_scanSize_98th_percentile
0       metric_scanSize_99th_percentile
0       metric_scanSize_99.9th_percentile
4       metric_scanSize_SizeRangeCount_100000000-inf
5       metric_readRequestCount
5       metric_writeRequestCount
10      metric_totalRequestCount
0       metric_memstoreSize
9986    metric_storeFileSize
9986    metric_tableSize