Ad Widget

Collapse

text2speech and agent remote commands...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • topkoa
    Member
    • Oct 2007
    • 47

    #1

    text2speech and agent remote commands...

    In case anyone wanted to do this, I found a way.. Here are the instructions:

    Requirements:

    Any PC with linux compatible sound card
    Linux (I used Ubuntu, but not required)
    festival (an easy apt-get with debian/ubuntu)
    zabbix agent (with remote commands enabled)

    Steps:

    1) Install and get zabbix agent running and talking to the zabbix server
    2) Install and test festival on the agent box, and choose the voice type you like (rtfm for more info on this, I use default for this example)
    3) Set up an "Action" in the zabbix server and use the following string to call festival

    example of remote command inside the Action:

    host:festival -b '(SayText "Danger")'

    You can even use zabbix variables within the quotes to pass it information about your alert:

    for instance, I have a temperature sensor:

    (Note: below "temp_host" is the host with agent monitoring temp...)

    host:festival -b '(SayText "Warning, server room temperature is now {temp_host:temperature_sensor.last(0)}")'

    EDIT: As seen below, you can also do something like this: (so it only talks to you when the Trigger status = ON)

    host:echo "if [ {TRIGGER.STATUS} == ON ]; then festival -b '(SayText \"Warning, server room temperature is now {temp_host:temperature_sensor.last(0)}\")'; fi" > /tmp/wrap.sh; /bin/bash -e /tmp/wrap.sh; rm /tmp/wrap.sh

    ...

    Anyhow. Most people may find this a little too nerdy but hey. Someone out there might be a bigger nerd than I. heh.

    ...
    Enjoy!
    Last edited by topkoa; 09-11-2007, 22:22.
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    You may scare people a lot if your PC shouts "Danger!!!" too loud I like it anyway!
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • topkoa
      Member
      • Oct 2007
      • 47

      #3
      Heh. just a little humor mixed in..

      I was originally thinking of putting the phrase "Danger Will Robinson, Danger!" from Lost in Space- but I figured that would have been a little too over the top.

      Heh.

      But another use would be hooking up a speaker in a restricted area- imagine some un-authorized person entering a restricted room and out of nowhere it says: "You have entered a restricted area, you are being watched"...

      However- at the moment there is one small flaw in the logic of this, so far I have not been able to get it to NOT say it when the alert turns off. So when you open the door, the trigger says the phrase, and also when you close the door it says the same phrase. Is there a way to get a trigger to automatically go back to FALSE once its triggered to TRUE?

      Comment

      • nelsonab
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2006
        • 1233

        #4
        Oh that is awesome!

        I haven't played with external notifications much, but don't you also receive the trigger state too? You'd need to write a wrapper script for festival, but that way you could only say your message if the trigger condition is true. You may need to search the forum for more information, but I do recall reading something about that at one point.
        RHCE, author of zbxapi
        Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
        Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

        Comment

        • topkoa
          Member
          • Oct 2007
          • 47

          #5
          Good idea! Tested and it works!

          You'd need to write a wrapper script for festival, but that way you could only say your message if the trigger condition is true.
          Hey, you gave me a wonderful idea.. I made a command that essentially writes a temporary wrapper.sh .. check this out:

          Code:
          host:echo "if [ {TRIGGER.STATUS} == ON ]; then festival -b '(SayText \"You have entered into a restricted area\")'; fi" > /tmp/wrap.sh; /bin/bash -e /tmp/wrap.sh; rm /tmp/wrap.sh
          I just tested it. It works to my amazement!

          Comment

          • rxm8028
            Member
            • Apr 2005
            • 45

            #6
            Works with alternate synthesizers, also

            I just ran across this thread, and found it interesting. It also works well with the 'espeak' speach synthesizer. Espeak is a bit lighter that festival, and runs on Windows, also.


            UPDATE: eSpeak may be 'lighter' than festival, but is buggier, too. On Ubuntu 8.04, I frequently see eSpeak hang, locking access to the /dev/dsp device.
            Last edited by rxm8028; 10-03-2009, 16:34. Reason: Added info.

            Comment

            Working...