在Azure中构建App Insight,以监视Linux服务器中的Inotify服务

问题描述 投票:0回答:4

您能否为Azure中的Build App Insight提供有价值的建议/过程以监视Linux服务器中的Inotify服务

azure inotify appinsights
4个回答
0
投票

pip安装应用程序的见解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()

0
投票

使用Application Insights for Python,并在文件系统发生变化时编写python脚本以将数据发送到您的App Insights。

有用的链接:

https://pypi.org/project/inotify/

https://github.com/microsoft/ApplicationInsights-Python


0
投票

您是否仍可以简要阐述我如何为具有inotify工具的Azure VM linux构建它,以及由于非常新而逐步了解应用程序的见解


0
投票

否则,请指导我如何使用App Insights记录任何Azure服务的任何会话?共享此日志的程序出路。

© www.soinside.com 2019 - 2024. All rights reserved.