Original: Use Opserver to monitor your ASP. NET Project Series (third, monitor your server status)
before words
There have been 2 articles on how to monitor the ASP. NET Core project.
Today we mainly introduce how to use Opserver to monitor the state of our servers.
The Opserver feature is actually very powerful and he can be used to connect any support bosun, Orion, or direct WMI monitoring data.
The approximate effect is as follows:
Body1. Through the WMI monitoring server that comes with Windows
First, we find the relevant configuration file, modify the configuration file name DashboardSettings.json.example
toDashboardSettings.json
然后修改DashboardSettings.json设置连接地址
providers,这里我们以WMI为例,如下:
{ "providers": {"WMI": { // List of nodes to monitor // (Optional) How long to cache static data (node name, hardware, etc.)-defaults to 5 minutes // (Optional) How long to cache Dynamic Data (utilizations, etc.)-defaults to seconds // (Optional) How long to retain data (in memory) – defaults to hours " Username ":" Administrator " }}
Explain the parameter description:
nodes
Can have more than one, can fill the server name or IP address
StaticDataTimeoutSeconds
How long does it take to cache static data (node name, hardware, and so on)-default is 5 minutes
DynamicDataTimeoutSeconds
How long it takes to cache Dynamic Data (CPU, load time, etc.)-default is 30 seconds
HistoryHours
The duration of the record is retained by default of 2 hours
Username
The account name of the remote server
Password
The remote server's password (PS, I am here because the connection is the local machine so it is not necessary.)
After setting up the connection, we can set our alert value as follows:
Set Alert values
Key |
explain |
cpuWarningPercent |
CPU Usage alert (yellow) |
cpuCriticalPercent |
CPU usage hazard (red) |
memoryWarningPercent |
Memory usage alert (yellow) |
memoryCriticalPercent |
Memory usage hazard (red) |
diskWarningPercent |
Disk space usage alert (yellow) |
diskCriticalPercent |
Disk space usage hazard (red) |
The JSON configuration is added directly under the providers node.
As follows:
{"providers""cpuwarningpercent" : "cpucriticalpercent": " Memorywarningpercent ": " memorycriticalpercent ":" Diskwarningpercent ": "diskcriticalpercent":
Multiple servers, the configuration of the server is not necessarily the same, so we need to set the alarm value separately according to the server configuration, we can add the Categories node, and configure the following:
"Categories": [ { // Name for this group of servers "pattern": "-sql", " Cpuwarningpercent ":", "cpucriticalpercent": " memorywarningpercent": 98, "Memorycriticalpercent" : 99.2 }, "name": "Second set", "pattern": "-sql", "cpuwarningpercent": Cpucriticalpercent ":", "Memorywarningpercent": 98, "Memorycriticalpercent": 99.2 }]
In this way, we have completed our use of WMI to gather information and show all the work on Opserver.
Of course, the official recommendation is to use the form of Bosun +scollector+opserver to collect and display
So, let's talk about it below (but I didn't practice it myself.) Limited resources)
2. Monitoring server via Bosun +scollector
1, Bosun Rapid installation (of course, there is no use of Docker. But to tell the truth. It's too complicated. Maybe it's because it's too complicated, just put it in the container and simplify the installation.
.. I'm not going to talk about it. Installation steps directly website: https://docs.docker.com/engine/installation/
- Installing Bosun in Docker
Use the command " docker run -d -p 4242:4242 -p 8070:8070 stackexchange/bosun
", install Bosun, file about 200 m, waiting to complete.
- Check if the installation is successful
Visit website http://docker-server-ip:8070, display the Bosun interface, that is, the installation is successful. At this time, the native monitoring data has been collected, you can view the corresponding data.
2. Server Agent Data Collector (Scollector)
You can download Scollector to http://bosun.org/scollector/.
In Windows, for example, after downloading "Scollector-windows-amd64.exe", run "cmd.exe" as administrator. CD to file directory, enter "Scollector-windows-amd64-h docker-server-ip:8070" in the command window
The following information is displayed to establish a connection to 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
You can then see this server information in the Bosun items interface.
written in the last
At this point we have completed all the operations of the monitoring server. Like, please pay attention to, ~ feel good can order a recommendation, of course, also welcome the great god criticism.
Use Opserver to monitor your ASP (third, monitor your server status)