0

Can you Provide valuable suggestion/procedure for Build App Insight in Azure for monitoring Inotify Services in Linux servers

Anirudh B
  • 39
  • 6

4 Answers4

0

Use the Application Insights for Python, and write you python script to send data to your app Insights whenever there's a change in your filesystem.

Useful links:

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

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

Thiago Custodio
  • 17,332
  • 6
  • 45
  • 90
0

Can you Still elaborate briefly on how i can build it for an Azure VM linux which has inotify tool and to that for app insights on step basis becasue very new

Anirudh B
  • 39
  • 6
0

pip install applicationinsights pip install inotify

then something like this:

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()
Thiago Custodio
  • 17,332
  • 6
  • 45
  • 90
0

Otherwise direct me on how to use app Insights to log any session for any azure services? share the procedural way-out for this logs.

Anirudh B
  • 39
  • 6