Ad Widget

Collapse

How simple checks work...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • monsieurcanard
    Member
    • Mar 2007
    • 40

    #1

    How simple checks work...

    Hey there,

    First of all, great work on Zabbix, it's a great app.

    1. I wanted to ask how the simple checks such as smtp_perf() work. Do they just check whether the port is open, or do they do service-related checks (for example, SMTP commands for smtp_perf())?

    2. What's the best way to check for a returned string on a service, for example an SMTP banner, or a word on a webpage? I realise that zabbix_agent can do this, but I'd like to do it centrally over the wire from the main Zabbix server - that way, I can be sure that the 'view' of the service that Zabbix is seeing is the same as my visitors.

    3. How can I run checks that complete full SMTP transactions? For example, sending a test email to a specific email address (to detect an open relay), or to test a server's reaction to a certain SMTP command.

    Many thanks,
    Matt
  • James Wells
    Senior Member
    • Jun 2005
    • 664

    #2
    Greetings,
    Originally posted by monsieurcanard
    I wanted to ask how the simple checks such as smtp_perf() work. Do they just check whether the port is open, or do they do service-related checks (for example, SMTP commands for smtp_perf())?
    The check just tests to see if it connects to the port, and how long it takes. to make the connection. It basically just checks the SYN->ACK->SYN/ACK->ACK connections sequence.

    What's the best way to check for a returned string on a service, for example an SMTP banner, or a word on a webpage?
    At present, you can do this from the Agent only. There was a patch submitted about 6 months ago that implemented server side scripting that could accomplish this, but it was never implemented in the main line code base. Another option that you can do, if you have to have it test from the server is to run an Agent on the server and have the server query it for the tests.

    How can I run checks that complete full SMTP transactions? For example, sending a test email to a specific email address (to detect an open relay), or to test a server's reaction to a certain SMTP command.
    The easiest way to do this would be to create a set of expect, tcl scripts that the Agent calls to perform these tests. Again, the Agent can run on the server if you wish.

    I hope this helps.
    Unofficial Zabbix Developer

    Comment

    • monsieurcanard
      Member
      • Mar 2007
      • 40

      #3
      Brilliant, thanks for all of your help James!

      Just to clarify on using zabbix_agent to do some of the things I mentioned, is it possible to have zabbix_agent run those tests from the main Zabbix server (centrally)? How do I pass the hostnames of the machine I want to test to the zabbix_agent on the central Zabbix server?

      Much appreciated,
      Matt

      Comment

      • James Wells
        Senior Member
        • Jun 2005
        • 664

        #4
        Originally posted by monsieurcanard
        Just to clarify on using zabbix_agent to do some of the things I mentioned, is it possible to have zabbix_agent run those tests from the main Zabbix server (centrally)?
        If you run an Agent on the server, then you can have the Server call query it. For example. On all of the deployments I do, the very first host I add in the UI is '__Zabbix Server__'. This host is configured to use the localhost ip address (127.0.0.1). I then start the Agent on the server, before I start the Server daemon. I then create various scripts to test functionality, such as your SMTP request. In the UI, I create items attached to the '__Zabbix Server__' host that queries these tests.

        Now, because of the way I do this, I am not able to add these items to the hosts that I am monitoring, but then I am not really monitoring the hosts, just the application. Additionally, when I write the scripts I write them so that they will accept at least two parameters, the first one being the actual host where the application runs, and the second one is for adding further functionality.

        So in your SMTP case, I would create a script with the first parameter being the host I want to connect to, and the second parameter would be the destination I want the email to go to. For example, if the script was called send_smtp.sh, and the SMTP host was smtp.zabbixtest.org, and I wanted to send the mail to root, I would configure the item as;
        Code:
        custom.smtp[smtp.zabbixtest.org,root]
        Then in the zabbix_agentd.conf file, I would add the following user parameter;
        Code:
        UserParameter=custom.smtp[*],/opt/zabbix/scripts/send_smtp.sh $1 $2
        Please note, I do not use system.run very often as I prefer to be able to control the arguments in the configuration file.
        Unofficial Zabbix Developer

        Comment

        • monsieurcanard
          Member
          • Mar 2007
          • 40

          #5
          Makes good sense :-) Thanks James! I might save some time and try using some of the nagios plugins and have zabbix_agent execute them. No point in redefining the wheel...

          Comment

          • monsieurcanard
            Member
            • Mar 2007
            • 40

            #6
            PS You may be interested in my thread here:

            Comment

            Working...