【问题标题】:Build App Insight in Azure for monitoring Inotify Services in Linux servers在 Azure 中构建 App Insight 以监控 Linux 服务器中的 Inotify 服务
【发布时间】:2020-02-28 11:01:34
【问题描述】:

您能否提供宝贵的建议/程序以在 Azure 中构建 App Insight 以监控 Linux 服务器中的 Inotify 服务

【问题讨论】:

    标签: azure inotify appinsights


    【解决方案1】:

    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()
    

    【讨论】:

      【解决方案2】:

      使用适用于 Python 的 Application Insights,并为您编写 Python 脚本,以便在您的文件系统发生更改时将数据发送到您的 App Insights。

      有用的链接:

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

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

      【讨论】:

        【解决方案3】:

        您能否简要说明一下我如何为具有 inotify 工具的 Azure VM linux 构建它,以及由于非常新而逐步获得应用洞察力

        【讨论】:

          【解决方案4】:

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

          【讨论】:

            猜你喜欢
            • 2021-08-21
            • 2016-07-24
            • 1970-01-01
            • 2014-04-16
            • 2021-09-06
            • 1970-01-01
            • 2011-07-31
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多