Ad Widget

Collapse

Running a script on a server and monitoring the result

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • samjwalker20
    Junior Member
    • Jan 2023
    • 2

    #1

    Running a script on a server and monitoring the result

    Hi,

    We have Zabbix 4.2.8 for monitoring our systems and I'd like to monitor a bash script which someone has placed on our Linux WMS server. The script is for monitoring whether another script, which is copying Oracle RMAN backup files from the Linux server to another location, has been successful. The script is is checking that the number of files in the local backup directory and share mount backup directory and returns 0 if they are the same. I'd like Zabbix to run the script and if not 0 raise an alert. Please could someone help me with how to do this?
  • LenR
    Senior Member
    • Sep 2009
    • 1005

    #2
    Send the result with zabbix_sender, zabbix doesn't have to run the script. Just define a trapper item and send it.

    If you need an example, I think I have one I can put on my github project.

    Comment

    • samjwalker20
      Junior Member
      • Jan 2023
      • 2

      #3
      Thank you LenR, sorry I don't know what you mean by send the result to Zabbix_sender though, although we've used Zabbix for years, I didn't set it up so my Zabbix skills are fairly basic.

      Comment

      • fvilarnovo
        Junior Member
        • Jan 2023
        • 17

        #4
        Hi samjwalker20, as LenR said the proper way to achieve this is via zabbix_sender. This is a binary that you could use to send data to zabbix using the zabbix protocol, however in order for this to work, first you should have a trapper item:

        For 4.2:


        Once that you have your host with the trapper item, then you could use zabbix_sender to "insert" values to that item:



        Example:
        "zabbix_sender [-v] -z server [-p port] [-I IP-address] -s host -k key -o value​"

        So, in a nutshell you can make a call to zabbix_sender from you script and pass that value that you will monitor. The main benefit of doing it this way is that as zabbix_sender sends the value, zabbix does not has to use any poller or wait any timeout, so it's more performant.

        Hope that helps!

        Comment

        Working...