SSH Protocol Custom Monitoring
From Custom Monitoring, you are familiar with how to customize types, Metrics, protocols, etc. Here we will introduce in detail how to use SSH protocol to customize Metric monitoring. SSH protocol custom monitoring allows us to easily monitor and collect the Linux Metrics we want by writing sh command script.
SSH protocol collection process
【System directly connected to Linux】->【Run shell command script statement】->【parse response data: oneRow, multiRow】->【Metric data extraction】
It can be seen from the process that we define a monitoring type of SSH protocol. We need to configure SSH request parameters, configure which Metrics to obtain, and configure query script statements.
Data parsing method
We can obtain the corresponding Metric data through the data fields queried by the SHELL script and the Metric mapping we need. At present, there are two mapping parsing methods:oneRow and multiRow which can meet the needs of most Metrics.
oneRow
Query out a column of data, return the field value (one value per row) of the result set through query and map them to the field.
eg:
Metrics of Linux to be queried hostname-host name,uptime-start time
Host name original query command:hostname
Start time original query command:uptime | awk -F "," '{print $1}'
Then the query script of the two Metrics in hertzbeat is(Use ; Connect them together):
hostname; uptime | awk -F "," '{print $1}'
The data responded by the terminal is:
tombook
14:00:15 up 72 days
At last collected Metric data is mapped one by one as:
hostname is tombook
uptime is 14:00:15 up 72 days
Here the Metric field and the response data can be mapped into a row of collected data one by one