Use Opserver to monitor your ASP. NET project series (3. Monitor your server status), opserverasp.net
Preface
I have had two articles on how to monitor ASP. NET core projects. If you are interested, please refer to them.
Today we will mainly introduce how to use Opserver to monitor the status of our servers.
Opserver is actually very powerful. It can be used to connect to any monitoring data that supports Bosun, Orion, or direct WMI.
The approximate effect is as follows:
Body
1. Use Windows WMI Monitoring Server
First, find the relevant configuration file and modify the name of the configuration file.DashboardSettings.json.example
IsDashboardSettings.json
Modify DashboardSettings. json to set the connection address.
Providers, here we take WMI as an example, as follows:
{
"Providers ":{
"Wmi ":{
"Nodes": ["USER-20170316IW"], // List of nodes to monitor
"StaticDataTimeoutSeconds": 300, // (Optional) How long to cache static data (node name, hardware, etc.)-defaults to 5 minutes
"DynamicDataTimeoutSeconds": 5, // (Optional) How long to cache dynamic data (utilizations, etc.)-defaults to 30 seconds
"HistoryHours": 2, // (Optional) How long to retain data (in memory)-defaults to 24 hours
"Username": "Administrator"
}
}
Description of parameters:
nodes
You can enter the server name or IP address.
StaticDataTimeoutSeconds
How long static data is cached (node name, hardware, etc.)-5 minutes by default
DynamicDataTimeoutSeconds
How long it takes to cache dynamic data (CPU, loading time, etc.)-30 seconds by default
HistoryHours
Retention period. The default value is 2 hours.
Username
Account name of the remote server
Password
Remote Server password (PS, I don't need it because it is connected to the local machine .)
After setting the connection, we can set our alert value as follows:
Set alert Value
Key |
Description |
cpuWarningPercent |
Cpu usage warning (yellow) |
cpuCriticalPercent |
Cpu usage hazard (red) |
memoryWarningPercent |
Memory usage warning (yellow) |
memoryCriticalPercent |
Memory usage hazard (red) |
diskWarningPercent |
Disk space usage warning (yellow) |
diskCriticalPercent |
Dangerous disk space usage (red) |
JSON configuration can be directly added to the providers node.
As follows:
{
"Providers ":{
"CpuWarningPercent": 50,
"CpuCriticalPercent": 60,
"MemoryWarningPercent": 90,
"MemoryCriticalPercent": 95,
"DiskWarningPercent": 85,
"DiskCriticalPercent": 95
}
}
When there are multiple servers, the server configuration is not necessarily the same, so you need to set the alarm value separately according to the server configuration. we can add the categories node and configure it as follows:
"Categories ":[
{
"Name": "First server", // Name for this group of servers
"Pattern": "-SQL ",
"CpuWarningPercent": 20,
"CpuCriticalPercent": 60,
"MemoryWarningPercent": 98,
"MemoryCriticalPercent": 99.2
},
"Name": "second server ",
"Pattern": "-SQL ",
"CpuWarningPercent": 20,
"CpuCriticalPercent": 60,
"MemoryWarningPercent": 98,
"MemoryCriticalPercent": 99.2
}
]
In this way, we have used WMI to collect information and demonstrate all the work on the OpServer.
Of course, the official recommendation is to use bosun + scollector + OpServer to collect and display
So let's talk about it below (but I have not implemented it myself... resources are really Limited)
2. Monitor servers through bosun + scollector
1. quick installation of bosun(Of course, Docker is not used. But to be honest, it is too complicated. Maybe it is too complicated to put it in the container to simplify the installation)
.. Specific I will not say, directly step Installation Steps Official Website: https://docs.docker.com/engine/installation/
Run the"docker run -d -p 4242:4242 -p 8070:8070 stackexchange/bosun
", Install bosun, the file is about 200 MB, just wait.
Visit the website http: // docker-server-ip: 8070. The bosun interface is displayed, indicating that the installation is successful. At this time, the local monitoring data has been collected, you can view the corresponding data.
2. Server agent data collector (scollector)
You can download scollector from http://bosun.org/scollector.
Take windows as an example. Download “scollector-windows-amd64.exe "and run ”cmd.exe" with the administrator ID ". Cd to the file directory, enter "scollector-windows-amd64-h docker-server-ip: 8070" in the Command window"
The following information is displayed, indicating to establish a connection with the bosun service. The command is as follows:
C:\>scollector-windows-amd64 -h 192.168.1.101:80702016/11/18 15:59:19 info: main.go:213: OpenTSDB host: http://192.168.1.101:8070
Then you can see the server information on the bosun items interface.
Conclusion
So far, we have completed all the operations on the monitoring server. For more information, see ,~ If you think it is good, you can make a suggestion. Of course, you are welcome to criticize and correct it .~
Related Articles:
Redis configuration of. NET open-source MSSQL and Redis monitoring product Opserver
Opserver open-source server Monitoring System (ASP. NET)
Use Opserver to monitor your ASP. NET project series (2. Monitoring SQL Server and Asp. Net Projects)
Address: https://www.cnblogs.com/GuZhenYin/p/8135096.html
. NET community news, deep good article, welcome to visit the public number article summary http://www.csharpkit.com