Search Windows and Linux Networking

Wednesday, June 1, 2011

Sending test notification from Zabbix



Testing Zabbix server by sending Test Notification 

For now we have installed zabbix and configure zabbix for Mail configuration and for action. But how do we know that it is actually working. For so we have to do something that is working and then we have to manually create trouble on that zabbix will monitor that and it find that there is problem with that item. So it take action against that by sending mail to admin as we configure last time . so what we will do we add localhost in zabbix and create item to monitor /tmp/text.txt file exsit and create trigger if file not exist. After that we delete that file so trigger will execute and zabbix take action by sending notification mail to admin.
For testing purposes we have to do following tasks:-
  1. Add HOST
  2. Create Item
  3. Create Trigger
  4. Create problem

Adding HOST: - By default zabbix_server host is added and it is disable for monitoring . do not enable it. For testing, we add host manually. So to add host first of all login in to zabbix  with user name admin and default password zabbix. Then go to Configuration > Hosts and then select Create Host. In New host window type the hostname for example zabbix. In Group field windows remove zabbix_server and add Linux Server. In IP address box type the IP address 127.0.0.1 for monitor localhost and insure that status is equal to monitored is selected then click to save the host.



Create Item:- create file as /tmp/test.txt using command
# touch /tmp/test.txt
 Now next to zabbix (host we just added ) there are no item . Select item next to zabbix and select Create Item . In new item windows host equal to zabbix will already selected. Type Description “/tmp/test.txt file exists for testing” , Type equal to Zabbix agent and then type most important thing Key is equal to vfs.file.exists[/tmp/test.txt] there are many field s there but for testing purpose it is in up for us . Click Save to Save the newly created item.

Create Trigger :-  Now we crate trigger for /tmp/test.txt file. Now next to zabbix host in trigger field select trigger then click Create Trigger . In New trigger Name file give the identical name for identify . For example /tmp/test.txt file does not exist and then type {zabbix:vfs.file.exists[/tmp/test.txt].last(0)}=0 in expression field and select warning in Severity drop down list. And click Save to save our trigger.

Create Problem :- Now every thing is looking ok . Now we have to crate problem by deleting the test.txt file so that zabbix will check that there is not such file so it take the action

# rm -rf /tmp/test.txt

After few min you got an email with subject zabbix /tmp/test.txt file does not exist: Problem

Now troubleshoot the problem by create same file using command

# touch /tmp/test.txt

After few min you got another email with subject zabbix /tmp/test.txt file does not exist: OK


4 comments:

  1. This was very helpful, but you didn't mention creating the action that actually sends the email. Mind adding that part?

    ReplyDelete
    Replies
    1. Please check following link for action http://winlinuxnet.blogspot.in/2011/06/configure-action-on-zabbix.html

      Delete
  2. i can't receive email yet,i just create host,item,trigger and Action and then
    i create test.txt file in my zabbix server and i delete (rm -rf /tmp/test.txt) that file.
    how can i do receive email for trigger.i think need the trigger name and trigger
    status in Action.if you don't mind,you'll left message for me..thanks.........
    my email (tinminnwe@gmail.com)..........

    ReplyDelete
    Replies
    1. Have you configure SMTP server Configure Parameter to send mail ??

      http://winlinuxnet.blogspot.in/2011/05/configure-zabbix-for-email-notification.html

      Delete