mosquitto命令引數說明

百聯達發表於2015-02-22
mosquitto命令引數說明


1. -c  配置檔案


從檔案中載入配置引數 如果沒有指定預設路徑為/etc/mosquitto/mosquitto.conf


2. -d   表示以後臺守護程式的形式啟動




3. -p   指定監聽埠 預設為1883


4. -v  監控日誌  類似於在配置檔案中把log_type 設定為all


mosquitto broker狀態監控


客戶端可以透過訂閱$SYS層級的話題來監控broker的相關資訊


1.$SYS/broker/bytes/received  收到的所有位元組數


2.$SYS/broker/bytes/sent  傳送的所有位元組數


3.$SYS/broker/clients/connected 當前線上的客戶端數


4.$SYS/broker/clients/expired  超時的連線數


5.$SYS/broker/clients/disconnected 斷開的連線數


6.$SYS/broker/clients/maximum  最大併發連線數


7.$SYS/broker/clients/total  所有連線數(活動的和非活動的)


8.$SYS/broker/heap/current size  當前用到的記憶體


9.$SYS/broker/heap/maximum size  用到的最大記憶體


$SYS/broker/load/connections/+
The moving average of the number of CONNECT packets received by the broker over different time intervals. The final "+" of the hierarchy can be 1min, 5min or 15min. The value returned represents the number of connections received in 1 minute, averaged over 1, 5 or 15 minutes.


$SYS/broker/load/bytes/received/+
The moving average of the number of bytes received by the broker over different time intervals. The final "+" of the hierarchy can be 1min, 5min or 15min. The value returned represents the number of bytes received in 1 minute, averaged over 1, 5 or 15 minutes.


$SYS/broker/load/bytes/sent/+
The moving average of the number of bytes sent by the broker over different time intervals. The final "+" of the hierarchy can be 1min, 5min or 15min. The value returned represents the number of bytes sent in 1 minute, averaged over 1, 5 or 15 minutes.


$SYS/broker/load/messages/received/+
The moving average of the number of all types of MQTT messages received by the broker over different time intervals. The final "+" of the hierarchy can be 1min, 5min or 15min. The value returned represents the number of messages received in 1 minute, averaged over 1, 5 or 15 minutes.


$SYS/broker/load/messages/sent/+
The moving average of the number of all types of MQTT messages sent by the broker over different time intervals. The final "+" of the hierarchy can be 1min, 5min or 15min. The value returned represents the number of messages send in 1 minute, averaged over 1, 5 or 15 minutes.


$SYS/broker/load/publish/dropped/+
The moving average of the number of publish messages dropped by the broker over different time intervals. This shows the rate at which durable clients that are disconnected are losing messages. The final "+" of the hierarchy can be 1min, 5min or 15min. The value returned represents the number of messages dropped in 1 minute, averaged over 1, 5 or 15 minutes.


$SYS/broker/load/publish/received/+
The moving average of the number of publish messages received by the broker over different time intervals. The final "+" of the hierarchy can be 1min, 5min or 15min. The value returned represents the number of publish messages received in 1 minute, averaged over 1, 5 or 15 minutes.


$SYS/broker/load/publish/sent/+
The moving average of the number of publish messages sent by the broker over different time intervals. The final "+" of the hierarchy can be 1min, 5min or 15min. The value returned represents the number of publish messages sent in 1 minute, averaged over 1, 5 or 15 minutes.


$SYS/broker/load/sockets/+
The moving average of the number of socket connections opened to the broker over different time intervals. The final "+" of the hierarchy can be 1min, 5min or 15min. The value returned represents the number of socket connections in 1 minute, averaged over 1, 5 or 15 minutes.


$SYS/broker/messages/inflight
The number of messages with QoS>0 that are awaiting acknowledgments.


$SYS/broker/messages/received
The total number of messages of any type received since the broker started.


$SYS/broker/messages/sent
The total number of messages of any type sent since the broker started.


$SYS/broker/messages/stored
The number of messages currently held in the message store. This includes retained messages and messages queued for durable clients.


$SYS/broker/publish/messages/dropped
The total number of publish messages that have been dropped due to inflight/queuing limits. See the max_inflight_messages and max_queued_messages options in mosquitto.conf(5) for more information.


$SYS/broker/publish/messages/received
The total number of PUBLISH messages received since the broker started.


$SYS/broker/publish/messages/sent
The total number of PUBLISH messages sent since the broker started.


$SYS/broker/retained messages/count
The total number of retained messages active on the broker.


$SYS/broker/subscriptions/count
The total number of subscriptions active on the broker.


$SYS/broker/timestamp
The timestamp at which this particular build of the broker was made. Static.


$SYS/broker/uptime
The amount of time in seconds the broker has been online.


$SYS/broker/version
The version of the broker. Static.


Wildcard Topic Subscriptions


In addition to allowing clients to subscribe to specific topics, mosquitto also allows the use of two wildcards in subscriptions. + is the wildcard used to match a single level of hierarchy. For example, for a topic of "a/b/c/d", the following example subscriptions will match:


a/b/c/d


+/b/c/d


a/+/c/d


a/+/+/d


+/+/+/+


The following subscriptions will not match:


a/b/c


b/+/c/d


+/+/+


The second wildcard is # and is used to match all subsequent levels of hierarchy. With a topic of "a/b/c/d", the following example subscriptions will match:


a/b/c/d


#


a/#


a/b/#


a/b/c/#


+/b/c/#


The $SYS hierarchy does not match a subscription of "#". If you want to observe the entire $SYS hierarchy, subscribe to $SYS/#.


Note that the wildcards must be only ever used on their own, so a subscription of "a/b+/c" is not valid use of a wildcard. The # wildcard must only ever be used as the final character of a subscription.


Bridges


Multiple brokers can be connected together with the bridging functionality. This is useful where it is desirable to share information between locations, but where not all of the information needs to be shared. An example could be where a number of users are running a broker to help record power usage and for a number of other reasons. The power usage could be shared through bridging all of the user brokers to a common broker, allowing the power usage of all users to be collected and compared. The other information would remain local to each broker.


For information on configuring bridges, see mosquitto.conf(5).


Signals


SIGHUP
Upon receiving the SIGHUP signal, mosquitto will attempt to reload configuration file data, assuming that the -c argument was provided when mosquitto was started. Not all configuration parameters can be reloaded without restarting. See mosquitto.conf(5) for details.


SIGUSR1
Upon receiving the SIGUSR1 signal, mosquitto will write the persistence database to disk. This signal is only acted upon if persistence is enabled.


SIGUSR2
The SIGUSR2 signal causes mosquitto to print out the current subscription tree, along with information about where retained messages exist. This is intended as a testing feature only and may be removed at any time.


Files


/etc/mosquitto/mosquitto.conf
Configuration file. See mosquitto.conf(5).


/var/lib/mosquitto/mosquitto.db
Persistent message data storage location if persist enabled.


/etc/hosts.allow, /etc/hosts.deny

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28624388/viewspace-1439810/,如需轉載,請註明出處,否則將追究法律責任。

相關文章