【发布时间】:2020-02-28 11:01:34
【问题描述】:
您能否提供宝贵的建议/程序以在 Azure 中构建 App Insight 以监控 Linux 服务器中的 Inotify 服务
【问题讨论】:
标签: azure inotify appinsights
您能否提供宝贵的建议/程序以在 Azure 中构建 App Insight 以监控 Linux 服务器中的 Inotify 服务
【问题讨论】:
标签: azure inotify appinsights
pip install applicationinsights pip install inotify
然后是这样的:
import inotify.adapters
import sys
from applicationinsights import TelemetryClient
def _main():
tc = TelemetryClient('<YOUR INSTRUMENTATION KEY GOES HERE>')
i = inotify.adapters.Inotify()
i.add_watch('/tmp')
with open('/tmp/test_file', 'w'):
pass
for event in i.event_gen(yield_nones=False):
(_, type_names, path, filename) = event
print("PATH=[{}] FILENAME=[{}] EVENT_TYPES={}".format(
path, filename, type_names))
tc.track_trace({ 'path': path, 'filename': filename })
tc.flush()
if __name__ == '__main__':
_main()
【讨论】:
使用适用于 Python 的 Application Insights,并为您编写 Python 脚本,以便在您的文件系统发生更改时将数据发送到您的 App Insights。
有用的链接:
【讨论】:
您能否简要说明一下我如何为具有 inotify 工具的 Azure VM linux 构建它,以及由于非常新而逐步获得应用洞察力
【讨论】:
否则,请指导我如何使用 app Insights 记录任何 azure 服务的任何会话?分享此日志的程序出路。
【讨论】: