Zabbix – use web monitoring for FTP check

Zabbix web scenarios use cURL to check your web pages and cURL can be used to connect/download/upload to a FTP server, so I thought I could combine the two and see what happens. Well, this check works a lot better than the original FTP check I had created so I’d say it’s a success. As a bonus, you get download throughput and response time metrics for your FTP session checks.

Create web scenario

Here’s how you can set up web monitoring for FTP. First, create your web scenario under Configuration, Web. Select a host to assign this web check to and then select Create Scenario.
FTP create scenario

I kept everything at the default settings and created a single step to download a file from the FTP server as a test that everything is working properly.
FTP step 1

Application - web (or something similar)
Name - FTP check
Authentication - none (I pass username/password in URL)
Update interval - 60
Agent - Internet Explorer 6.0 ( default, haven't tried other agents)
Status - active
Variables - empty
Steps - 
     name - FTP check
     URL - ftp://username:password@servername.domain.com
     post - empty
     timeout - 15
     required - filename (this is the file you want to check for on the FTP server)
     status codes - 226 (FTP server response codes)

Trigger Configuration

Once your scenario is in place you can create a trigger to fire when something isn’t right. Select Configuration, Host and select the host you created the web scenario under. Select Triggers and Create Trigger. Name your new trigger and choose the expression to trigger off of. I usually choose the ‘failed step of scenario…’ expression and set it to ‘last value NOT N’ with a value of zero. This way anything that isn’t a success will cause a trigger to fire.

name - FTP check
expression - {HOST_A:web.test.fail[FTP check].last(0)}#0
event generation - normal
severity - high

FTP Trigger create

Once all of that is finished check your new monitor entry under Monitoring, Web. If you want to get a little more advanced with your FTP checks, you can add a trigger that fires when the response time is too long. Just a thought.

The web monitoring doesn’t have to be used only for monitoring actual web pages. cURL is very powerful and can allow for some great checks for your Zabbix environment. Learn more about cURL’s awesomeness here.

That’s it for now. Have fun with Zabbix web monitoring.


2 Comments on “Zabbix – use web monitoring for FTP check”

  1. asd says:

    it doesn’t works… Standard test are good but “Last error message of scenario” complain with: “Required pattern not found” … And yes, myfile.txt is present and is the only file in the ftp

    reproducing steps by open ftp via windows explorer, filezilla or firefox works good … I’m using zabbix 2.0.6

    can you help me?

    • Chris says:

      I would bet there is some strange character in your pattern that is causing the problem. Reduce the pattern that you are looking for down to one word and minimize the special characters.

      It’s probably a HTML character entity issue. An example is when you have a space but it’s not read correctly and you need to put in a “&nbsp” for the browser to read the space properly.

      Check out this page for more info

      Hope this helps.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s