LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Trigger Linux Process or SNMP Event

    Employee
    Posted 04-24-2012 11:09

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: xathras

    Hi,

    I am working on some monitoring and have an idea were I could trigger a process or SNMP Event to alert someone of an issue. Has this ever been achieved by a Lavastorm customer before?
    We use 4.1.8 Server - soon to update to 4.5.2 (or 4.5.3)

    We use Linux and could install SNMPTRAP on the machine, if its possible to trigger a linux command.

    Thanks in advance.


  • 2.  RE: Trigger Linux Process or SNMP Event

    Employee
    Posted 04-24-2012 11:29

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: timonk

    Xathras,

    Have you considered using a Python node to execute a system command with the "os" module? You should be able to use os.system(" <command> ").

    In truth, os.system has been somewhat replaced by the "subprocess" module. Its just the quick system call module I'm used to using. Take a look here:

    http://docs.python.org/library/subpr...ule-subprocess.

    Does this look like it would do what you need?

    Regards,
    Timon Koufopoulos
    Lavastorm Support.


  • 3.  RE: Trigger Linux Process or SNMP Event

    Employee
    Posted 04-24-2012 15:30

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: xathras

    Hi Timon,

    thanks for the information. It possible, as always to get a working example of this. e.g. a sleep command.


  • 4.  RE: Trigger Linux Process or SNMP Event

    Employee
    Posted 04-25-2012 06:08

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    The attached node uses Python's sleep() function directly, without having to execute a unix command.
    sleep.brn


  • 5.  RE: Trigger Linux Process or SNMP Event

    Employee
    Posted 04-25-2012 11:24

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: xathras

    Hi,

    I'm looking for something that will do it on a linux machine. I used the sleep command as an example. But in reality I wanted to trigger a script.

    regards
    Wayne


  • 6.  RE: Trigger Linux Process or SNMP Event

    Employee
    Posted 04-25-2012 11:30

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: timonk

    Wayne,

    Using the subprocess module in python you can make a call like this:

    import subprocess
    >>> subprocess.call(['./test.sh'])
    0

    Obviously this is done from the python prompt in the relative directory. But just extend the example to an absolute path to wherever a script is, and run the call in a python node. Does this help?

    Regards,Timon