Open-falcon Monitoring Windows Machines

Source: Internet
Author: User

Recently the company launched a new game, using the Windows machine, need to use Open-falcon to monitor the machine.

Open-falcon monitoring of Windows is not particularly perfect, Linux monitoring is done through the agent, but the agent under Windows has not been developed, refer to the Open-falcon documentation, there are 2 of the implementation method.

One is to use a Python script to get the data, then push the data to a single agent, and then push to the server, to achieve machine monitoring.

The script is as follows: windows_collect.py

In addition, it is through the Golong version of the Windows agent. The address is as follows: Https://github.com/LeonZYang/agent

I did this by using the first method of the Python script.

I will share with you my deployment process and the problems I have encountered.


First Step: Environment deployment

Using Python scripts to monitor, you need to install Python and 2 modules Psutil and requets modules

1. Install Python

Version: 2.7.11

Download directly online, then click on Install on the line, very simple

Then set the environment variables, self-Baidu can.


2. Installing the Requests module

Version: 2.9.1

Download the tar package, then extract it into the C:\Python27 directory and go to the command line interface for installation

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7F/6A/wKioL1cd8h3jG-vRAAAaR1bHAng803.png "title=" Qq20160425182631.png "alt=" Wkiol1cd8h3jg-vraaaar1bhang803.png "/>

3. Installing the Psutil module

Version: 4.1.0

Download directly online, double click to install, very simple


Step two: script Deployment and modification


Script Name: windows_collect.py

Script Location: C:\open-falcon\workspace\agent\ (this directory is specified by itself)

The main monitoring items for this script are described in GitHub, where you need to change them.

Cpu_interval = Push_interval = Push_interval_agent = Zh_decode = "GBK" endpoint = "******" ignore_interface = ["Loopback", "Teredo tunneling", "ISATAP", "6to4 Adapter"]push_url = "

Push_interval = 300

This is the push interval, the default is 300 seconds

Push_interval_agent = 60

This is my own set of push agent.alive interval, for host survival monitoring, will push a value of 1, do not need to be ignored.

Endpoint = "* * *"

This is to give the machine the name of the match, which itself designates

Push_url = "Http://192.168.221.22:1988/v1/push"

This is the push interface, because it is the script to obtain system information, need to borrow other agent's interface to push the information to the server side, this first difficult to understand, I also think for a long time.


Increased monitoring of agent.alive host survival:

There is no agent.alive in the windows_collect.py script, but if we need to monitor the survival of the machine,

Then you can use the following method:

1, timed push agent.alive value to Ope-falcon server side

2, if there is no data push, in NoData inside the agent.alive data set to 1

3, configure the alarm rules, if the value of agent.alive is less than 0, then send an alarm.


You need to add a push-agent.alive function to the script and push it separately.

Def agent_alive (): ts = Int (time.time ()) payload = [] data = {"Endpoint": Endpoint, "metric": "", "timestamp": TS, "Ste P ":p ush_interval_agent," value ":" "," CounterType ":" "," tags ":" "} data[" metric "] =" agent.alive "data[" value "] =" 1 "push A value of 1 data["countertype"] = "GAUGE" Payload.append (copy.copy (data))

Why do you want to push it alone?

Because the test found that the push interval is difficult to reconcile if Agent.alive is pushed along with other system data. If set to 300 seconds, then the interval is too long, will trigger the host to survive the alarm, if the setting is small, then the other system data obtained is incomplete, so they are separated to push, agent_alive alone set to 60 seconds, the other data to remain 300 seconds. The one with the top configuration.

Push_interval = Push_interval_agent = 60

Finally, after the main () function executes, the agent_alive function is executed.

if __name__ = = "__main__": Main () agent_alive ()

After the modification is completed, perform the following in the Windows terminal, if there is no error, then there is no problem, you can configure the scheduled task.


Step Three: Configure Scheduled Tasks

After the script has been modified, it needs to be executed in a scheduled task, set to 1 minutes to execute,

1, first set up a batch file, inside a word

C:\Python27\python.exe C:\open-falcon\workspace\agent\windows_collect.py

2. New Scheduled Tasks

Control Panel--Management tools--Task Scheduler

Click Create Basic task:

Fill in the name

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/80/4C/wKioL1c9fwqyiIFBAAB4a463W_U510.png "style=" width : 500px;height:394px; "title=" Qq20160519164507.png "width=" "height=" 394 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1c9fwqyiifbaab4a463w_u510.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/80/4C/wKioL1c9fwrA-Dp4AAB8wqg9AjY273.png "style=" width : 500px;height:394px; "title=" Qq20160519164534.png "width=" "height=" 394 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1c9fwra-dp4aab8wqg9ajy273.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/80/4C/wKioL1c9fwrB6RAeAACUuy7Hf1c857.png "style=" width : 500px;height:391px; "title=" Qq20160519164556.png "width=" "height=" 391 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1c9fwrb6raeaacuuy7hf1c857.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/80/4C/wKioL1c9fwuhu-0MAAB0nzR86HU191.png "style=" width : 500px;height:397px; "title=" Qq20160519164616.png "width=" "height=" 397 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1c9fwuhu-0maab0nzr86hu191.png "/>

Specify the program location, which is the bat file we just created, and also fill in the starting point, which is the path of the bat

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/80/4E/wKiom1c9fiDw3vXQAAD7AEvp2v8382.png "style=" width : 500px;height:391px; "title=" Qq20160519164824.png "width=" "height=" 391 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1c9fidw3vxqaad7aevp2v8382.png "/>

3. Modify the Scheduled task properties

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/80/4F/wKiom1c9gE7BXtKvAABRkgA68NA932.png "style=" width : 500px;height:427px; "title=" Qq20160519165543.png "width=" "height=" 427 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1c9ge7bxtkvaabrkga68na932.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/80/4F/wKiom1c9gE7DK-UUAAFQxcJtNZQ798.png "style=" width : 500px;height:294px; "title=" Qq20160519165739.png "width=" "height=" 294 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1c9ge7dk-uuaafqxcjtnzq798.png "/>

Once the modifications are complete, the scheduled task will be opened on the line.


Above, Windows machine Open-falcon monitoring is complete, can go to the web side to configure alarm rules and screen.



This article from "Love Jiangnan" blog, please be sure to keep this source http://zhuyuanpo.blog.51cto.com/8089272/1775108

Open-falcon Monitoring Windows Machines

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.