Ad Widget

Collapse

No such file or directory error for Script Media Type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yatin
    Junior Member
    • Sep 2017
    • 5

    #1

    No such file or directory error for Script Media Type

    Hi,

    I was using the Slack Integration for Sending notifications from here
    Zabbix AlertScript for Slack.com chat. Contribute to ericoc/zabbix-slack-alertscript development by creating an account on GitHub.


    Setup was done fine, but I am facing one issue, whenever I run the script from command line, the Message is pushed to Slack successfully but when the script is invoked by Action to send Notification, I get error as
    /usr/lib/zabbix/alertscripts/slack.sh: [2] No such file or directory
    (The script file is at this location only)

    I have tried changing the owner of script to zabbix, and group also as zabbix, still it didn't work.

    I am using Zabbix 3.2.7 which has alertscripts location as /usr/lib/zabbix/alertscripts/

    Click image for larger version

Name:	No such file or directory.png
Views:	1
Size:	12.4 KB
ID:	318339
    Last edited by yatin; 19-09-2017, 06:59.
  • vesper1978
    Member
    • Nov 2016
    • 59

    #2
    Looks like you're not running the right thing. From the git repo you linked, the script is slack.sh not slack.ch.

    If you run this following from your Zabbix Server:

    ls -l /usr/lib/zabbix/alertscripts/

    Does it show that slack.ch exists? Or does it show slack.sh? If it shows slack.sh make sure you correct that in your Media Type you set up for the Slack Integration.

    Comment

    • yatin
      Junior Member
      • Sep 2017
      • 5

      #3
      Hi

      Sorry for the typo in post (I rectified it now).

      The script is slack.sh only and even when i execute the same path which is given by error, the script runs successfully and pushed message to Slack, but this script is unable to be called by Zabbix.


      [root@zabbix alertscripts]# /usr/lib/zabbix/alertscripts/slack.sh
      ok[root@zabbix alertscripts]#
      [root@zabbix alertscripts]#
      [root@zabbix alertscripts]# ls -l /usr/lib/zabbix/alertscripts/
      total 4
      -rwxrwxr-x 1 zabbix zabbix 1594 Sep 19 04:45 slack.sh



      Please find below screenshot.

      Click image for larger version

Name:	Untitled2.png
Views:	1
Size:	6.4 KB
ID:	313939

      Comment

      • Atsushi
        Senior Member
        • Aug 2013
        • 2028

        #4
        Please check your media setting.

        What is set for the script name?
        Have you specified "slack.sh"?

        Comment

        • yatin
          Junior Member
          • Sep 2017
          • 5

          #5
          Yes,

          Media is all correct.


          Click image for larger version

Name:	Screenshot_9.png
Views:	1
Size:	11.4 KB
ID:	313940

          Comment

          • vesper1978
            Member
            • Nov 2016
            • 59

            #6
            Can you post the output of:

            ls -l /usr/lib | grep -i zabbix

            and

            ls -l /usr/lib/zabbix | grep -i alert

            I'm thinking the zabbix user, even though it has correct permissions on the script, doesn't have correct permissions on one of those directories.

            Comment

            • yatin
              Junior Member
              • Sep 2017
              • 5

              #7
              Nevermind.

              I figured out a way

              created a directory /home/zabbix (owned by zabbix:zabbix)

              and changed the path of scripts in Conf file to this directory

              and placed slack.sh here /home/zabbix/slack.sh

              Script worked now to send Slack Notification.

              Comment

              Working...