當前位置:首頁 » 雲伺服器 » 如何採集伺服器

如何採集伺服器

發布時間: 2022-09-26 01:11:05

❶ 如何把有線電視採集到伺服器上

用視頻錄象機

❷ 如何實現感測器數據採集上傳伺服器,並在網頁顯示實時數據

TCP/IP協議或者UDP協議。是通過安裝點最近的移動基站通信的。
MCU輸出一個串口, 然後接上AQ-6000模塊就可以實現遠程監控了。
3,奧企科技

❸ flume怎麼採集遠程伺服器上的日誌

log4j.rootLogger=INFO,A1,R

# ConsoleAppender out

log4j.appender.A1= org. apache.log4j.ConsoleAppender

log4j.appender.A1.layout= org. apache.log4j.PatternLayout

log4j.appender.A1.layout.ConversionPattern=%d{ yyyy/MM/ ddHH:mm:ss}%-5p%-10C {1} %m%n

# File out

//日誌Appender修改為flume提供的Log4jAppender

log4j.appender.R= org. apache. flume.clients.log4jappender.Log4jAppender

log4j.appender.R.File=${ catalina.home}/logs/ ultraIDCPServer.log

//日誌需要發送到的埠號,該埠要有ARVO類型的source在監聽

log4j.appender.R.Port =44444

//日誌需要發送到的主機ip,該主機運行著ARVO類型的source

log4j.appender.R.Hostname = localhost

log4j.appender.R.MaxFileSize=102400KB

# log4j.appender.R.MaxBackupIndex=5

log4j.appender.R.layout= org. apache.log4j.PatternLayout

log4j.appender.R.layout.ConversionPattern=%d{ yyyy/MM/ ddHH\: mm\: ss}%-5p%-10C {1} %m%n

log4j.appender.R.encoding=UTF-8

log4j.logger.com.ultrapower.ultracollector.webservice.=INFO, webservice

log4j.appender.webservice= org. apache.log4j.FileAppender

log4j.appender.webservice.File=${ catalina.home}/logs/.log

log4j.appender.webservice.layout= org. apache.log4j.PatternLayout

log4j.appender.webservice.layout.ConversionPattern=%d{ yyyy/MM/ ddHH\: mm\: ss}%-5p[%t]%l%X-%m%n

log4j.appender.webservice.encoding=UTF-8

註:Log4jAppender繼承自AppenderSkeleton,沒有日誌文件達到特定大小,轉換到新的文件的功能

1.1.3. flume agent配置

agent1.sources = source1

agent1.sinks = sink1

agent1.channels = channel1

# Describe/configure source1

agent1.sources.source1.type = avro

agent1.sources.source1.bind = 192.168.0.141

agent1.sources.source1.port = 44444

# Describe sink1

agent1.sinks.sink1.type = FILE_ROLL

agent1.sinks.sink1.sink.directory = /home/yubojie/flume/apache-flume-1.2.0/flume-out

# Use a channel which buffers events in memory

agent1.channels.channel1.type = memory

agent1.channels.channel1.capacity = 1000

agent1.channels.channel1.transactionCapactiy = 100

# Bind the source and sink to the channel

agent1.sources.source1.channels = channel1

agent1.sinks.sink1.channel = channel1

註:生成的文件的規則為每隔固定時間間隔生成一個新的文件,文件裡面保存該時間段agent接收到的信息

1.2. 分析

1. 使用簡便,工作量小。

2. 用戶應用程序使用log4j作為日誌記錄jar包,而且項目中使用的jar包要在log4j-1.2.15版本以上,

3. 應用系統必須將flume所需jar包引入到項目中。如下所示為所有必須jar包:可能會存在jar沖突,影響應用運行

4. 能夠提供可靠的數據傳輸,使用flume log4jAppender採集日誌可以不在客戶機上啟動進程,而只通過修改logapppender直接把日誌信息發送到採集機(參見圖一),此種情況可以保證採集機接受到數據之後的數據可靠性,但是客戶機與採集機連接失敗時候數據會丟失。改進方案是在客戶機上啟動一個agent,這樣可以保證客戶機和採集機不能連通時,當能連通是日誌也被採集上來,不會發送數據的丟失(參見圖二),為了可靠性,需在客戶機上啟動進程

1.3. 日誌代碼

Log.info(「this message has DEBUG in it」);

1.4. 採集到的數據樣例

this message has DEBUG in it

this message has DEBUG in it

2. Exec source(放棄)

The problem with ExecSource and other asynchronous sources is that thesource can not guarantee that if there is a failure to put the event into theChannel the client knows about it. In such cases, the data will be lost. As afor instance, one of the most commonly requested features is thetail -F [file]-like use casewhere an application writes to a log file on disk and Flume tails the file,sending each line as an event. While this is possible, there』s an obviousproblem; what happens if the channel fills up and Flume can』t send an event?Flume has no way of indicating to the application writing the log file that itneeds to retain the log or that the event hasn』t been sent, for some reason. Ifthis doesn』t make sense, you need only know this: Your application can neverguarantee data has been received when using a unidirectional asynchronousinterface such as ExecSource! As an extension of this warning - and to becompletely clear - there is absolutely zero guarantee of event delivery whenusing this source. You have been warned.

註:即使是agent內部的可靠性都不能保證

2.1. 使用說明

2.1.1. flume agent配置

# The configuration file needs to define the sources,

# the channels and the sinks.

# Sources, channels and sinks are defined per agent,

# in this case called 'agent'

# example.conf: A single-node Flume configuration

# Name the components on this agent

agent1.sources = source1

agent1.sinks = sink1

agent1.channels = channel1

# Describe/configure source1

#agent1.sources.source1.type = avro

agent1.sources.source1.type = exec

agent1.sources.source1.command = tail -f /home/yubojie/logs/ultraIDCPServer.log

#agent1.sources.source1.bind = 192.168.0.146

#agent1.sources.source1.port = 44444

agent1.sources.source1.interceptors = a

agent1.sources.source1.interceptors.a.type = org.apache.flume.interceptor.HostInterceptor$Builder

agent1.sources.source1.interceptors.a.preserveExisting = false

agent1.sources.source1.interceptors.a.hostHeader = hostname

# Describe sink1

#agent1.sinks.sink1.type = FILE_ROLL

#agent1.sinks.sink1.sink.directory = /home/yubojie/flume/apache-flume-1.2.0/flume-out

agent1.sinks.sink1.type = hdfs

agent1.sinks.sink1.hdfs.path = hdfs://localhost:9000/user/

agent1.sinks.sink1.hdfs.fileType = DataStream

# Use a channel which buffers events in memory

agent1.channels.channel1.type = memory

agent1.channels.channel1.capacity = 1000

agent1.channels.channel1.transactionCapactiy = 100

# Bind the source and sink to the channel

agent1.sources.source1.channels = channel1

agent1.sinks.sink1.channel = channel1

2.2. 分析

1. tail方式採集日誌需要宿主主機能夠執行tail命令,應該是只有linux系統可以執行,不支持window系統日誌採集

2. EXEC採用非同步方式採集,會發生日誌丟失,即使在節點內的數據也不能保證數據的完整

3. tail方式採集需要宿主操作系統支持tail命令,即原始的windows操作系統不支持tail命令採集

2.3. 採集到的數據樣例

2012/10/26 02:36:34 INFO LogTest this message has DEBUG 中文 in it

2012/10/26 02:40:12 INFO LogTest this message has DEBUG 中文 in it

2.4. 日誌代碼

Log.info(「this message has DEBUG 中文 in it」);

3. Syslog

Passing messages using syslogprotocol doesn't work well for longer messages. The syslog appender forLog4j is hardcoded to linewrap around 1024 characters in order to comply withthe RFC. I got a sample program logging to syslog, picking it up with asyslogUdp source, with a JSON layout (to avoid new-lines in stack traces) onlyto find that anything but the smallest stack trace line-wrapped anyway. Ican't see a way to reliably reconstruct the stack trace once it is wrapped andsent through the flume chain.(註:內容不確定是否1.2版本)

Syslog TCP需要指定eventsize,默認為2500

Syslog UDP為不可靠傳輸,數據傳輸過程中可能出現丟失數據的情況。

php怎樣web伺服器端的數據採集方法

class caiji{
private $reg;//正則
private $url;//數據源
private $dataArr;//返回結果數組

public function __construct($reg,$url){
$this->reg=$reg;
$this->url=$url;
$this->caijStar();
}

private function caijStar(){//採集方法
$conn=file_get_contents("{$this->url}");
$reg="{$this->reg}";
preg_match_all($reg,$conn,$this->dataArr);
}

public function getArr(){//數據獲取方法
return $this->dataArr;
}
}

❺ 數據採集伺服器

你的描述就是一個digital oscillograph
如果作項目的話建議去買一個agilent的

❻ 怎麼使用Bethune採集伺服器數據

玩乃是我心了,

❼ 如何實現感測器數據採集上傳伺服器,並在網頁顯示實時數據

感測器採集到的數據傳到電腦資料庫裡面,然後程序再從資料庫裡面讀取數據顯示在網頁上面,實現動態更新,就像股票網頁上面的行情一樣,一回事。

熱點內容
linux改變用戶所屬組 發布:2024-04-25 11:50:33 瀏覽:469
rsa加密演算法java代碼 發布:2024-04-25 11:40:07 瀏覽:883
如何改變拉桿箱上的初始密碼 發布:2024-04-25 11:17:23 瀏覽:799
內網掛代理虛擬機如何配置網卡 發布:2024-04-25 11:15:06 瀏覽:687
明日之後緩存怎麼清理 發布:2024-04-25 11:14:56 瀏覽:205
華為mate30怎麼退回安卓版 發布:2024-04-25 11:08:49 瀏覽:898
安卓新機使用前要注意什麼 發布:2024-04-25 11:03:46 瀏覽:811
藍鳥哪個配置有按摩 發布:2024-04-25 10:53:24 瀏覽:940
崩壞3要求什麼蘋果手機配置 發布:2024-04-25 10:36:59 瀏覽:142
培訓機構國內訪問學者 發布:2024-04-25 10:34:28 瀏覽:911