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

如何採集伺服器

發布時間: 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採集伺服器數據

玩乃是我心了,

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

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

熱點內容
python修改默認編碼 發布:2024-12-27 19:07:10 瀏覽:469
androidicon尺寸 發布:2024-12-27 18:59:42 瀏覽:867
為什麼安卓連上ios總顯示連接失敗 發布:2024-12-27 18:47:57 瀏覽:672
嵌入式linux怎麼學 發布:2024-12-27 18:44:20 瀏覽:479
nginxjs緩存 發布:2024-12-27 18:43:47 瀏覽:775
社保賬號密碼是什麼意思 發布:2024-12-27 18:37:31 瀏覽:697
python集合重復 發布:2024-12-27 18:24:49 瀏覽:420
安卓版黑暗之刃怎麼買裝備 發布:2024-12-27 18:22:28 瀏覽:47
sqlserver手冊 發布:2024-12-27 18:15:47 瀏覽:658
骰子控制腳本 發布:2024-12-27 18:11:34 瀏覽:682