Ad Widget

Collapse

Can't make MEDIA TYPE SCRIPT work HELP!!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phonores
    Junior Member
    • Jan 2010
    • 2

    #1

    Can't make MEDIA TYPE SCRIPT work HELP!!!

    Hi! i'm a newbie in this area, so bear with me.

    Well my problem is this, i have zabbix working but i want to implement the media type script to create some messages... The thing is i can't get zabbix to run the script, well that is what i guess is happening because i tried to run a simple code that creates a log file but when the trigger that runs the actions happens the log file never gets created...

    So i am working on windows but the zabbix is installed on a sun virtualbox so is a bit complicated... The version of zabbix is 1.8

    The steps i used was:

    1. Verify that the AlertScriptsPath in the zabbix_server.conf

    ### Option: AlertScriptsPath
    # Location of custom alert scripts
    #
    # Mandatory: no
    # Default:
    # AlertScriptsPath=/home/zabbix/bin/

    2. Put the send_sms.php script in the alertscriptspath and gave all the permission so zabbix can access the script.

    3. Creation of the media types

    Description: SMS Script
    Type: Script
    Script name: send_sms.php

    4. Creation of user that has the media added with all the use if severity check and included in a user group that has all the permisions (as a precaution)

    5. Creation of an action where the event source is a trigger, action condition is trigger severity "disaster" and action operations operation type: Send message
    send message to: single user "the user created"
    send only to: all
    default message "checked"

    I configure the media type email and is working fine but this is not, and what i don't get is in the dashboard the action is show as executed... but nothing happens.

    I apreciate your help!!!
    Last edited by phonores; 29-01-2010, 20:08.
  • arli
    Member
    • Jan 2008
    • 71

    #2
    I suggest you to use shell or python script.
    If you really want to use php, then call php script from shell script.
    I believe the parameters you have to pass were:
    1. contact
    2. subject
    3. message

    send_sms.sh
    Code:
    #!/bin/sh
    # for debugging - these are the variables you should pass to your script
    echo $1 >> /tmp/output.txt
    echo $2 >> /tmp/output.txt
    echo $3 >> /tmp/output.txt
    php -f /home/zabbix/bin/send_sms.php ... dunno how you'll pass parameters to php - maybe you could use wget with php script url instead

    Comment

    • phonores
      Junior Member
      • Jan 2010
      • 2

      #3
      Problem solve

      Hi Arli!

      Thanks for your reply!!! But i already fix my problem the thing was because i was using a virtual machine that dosent have a friendly interface, i was programming on windows and then uploading my code to linux and with that came problems of strange characters. Well the solution was using vim...

      And for php script you have to put the path #!/usr/bin/php and to obtain the information i had to use the global variables $argv not the $1 that we use in case of bash scripts...

      So if anyone is trying to do some scripts in php there you go!!!

      Thanks anyway for helping!!!

      Comment

      Working...