Ad Widget

Collapse

Automatic service restart when some service down

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rizal
    Junior Member
    • Dec 2014
    • 3

    #1

    Automatic service restart when some service down

    Hi, I new user with Zabbix

    I was configure and try zabbix from last week,
    My Problem is how to automatic restart webserver e.g Apache2 on zabbix-agent when webserver is down.

    My configuration is like that
    Zabbix-server 192.168.10.107
    Zabbix-agent 192.168.10.133
    Availability on Zabbix-Agent was Z green and I can graph some service like cpu load, disk, utilization etc.

    I was EnableRemoteCommands=1 on zabbix_agent configuration in /etc/zabbix/zabbix_agent.conf

    In Zabbix Server, Web Dashboard, Configuration - Actions
    Action tab,
    name = Auto start apache2.

    Condition tab,
    type of calcuilation = AND.
    condition label A Trigger severity = information
    condition label B Host Group = Zabbix Servers (zabbix-agent was on group zabbix servers)

    Operations tab,
    operation type = remote command
    target list host group = zabbix servers
    type costum script
    execute on = zabbbix agent
    command = /etc/init.d/apache2 restart

    Testing.
    On zabbix-agent i was stop apache2 service, but i wait until 10 minutes apache not autorestart. I check log zabbix_agentd.log and zabbix_server.log but not find information about this case (Remote Command)

    Anyone know how to set up remote command for automatic restart some services like apache2 when down on zabbix-agent.

    I hope found the answer,

    Thank you very much.
  • eduardobertobr
    Member
    • Jul 2014
    • 30

    #2
    Hi! First sorry my english!!

    In the zabbix_agentd.conf type LogRemoteCommands=1 for see logs from remote commands. After restart agent.

    Verify if zabbix user have permission in your sudoers archive. If don't edit /etc/sudoers (visudo) and add line:
    zabbix ALL=(ALL) NOPASSWD: /etc/init.d/apache2 restart

    Make a test!

    Verify when trigger started, in your Dashbord (Last 20 incidents), the action information if command worked or don't. If don't see zabbix logs. Probably the remote command will appear there.

    I hope you can understand me and this may help in something.

    Comment

    Working...