Ad Widget

Collapse

Script Update / Upgrade Linux machine

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wiwi's Lab
    Junior Member
    • Feb 2022
    • 2

    #1

    Script Update / Upgrade Linux machine

    Hello people,
    I'm quiet new on zabbix, and I'm still leraning a lot with the documentation.
    I recently migrate from Zabbix server 5.4 to 6.0 and agent for hosts are 5.4 or 6.0
    Still there is something I'm not sure to understand well with script that can be execute on remote host which have agent.

    My goal is to have 2 commands for update and upgrade my linux hosts.
    I enable the remote command on one of my host and create a manual script for updating with "sudo apt update && apt list --upgradable"
    That works well

    But when I try with a manual script for upgrade with "sudo apt upgrade -y", it broke my package and I have the below error when I connect SSH to the host
    E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
    I don't figure out why and how to solve it.
    Maybe I should not upgrade my hosts like that ? so what would be the best practice ?

    Thank you for you help !
  • LenR
    Senior Member
    • Sep 2009
    • 1005

    #2
    Are these zabbix remote commands? If so, you probably can't use those to update the agent. The upgrade of the package would probably restart the agent, in the middle of the command the zabbix server is trying to run. A remote command must also complete within the timeout interval of the server.

    Agent update is a job for something like ansible or rundect, outside of Zabbix.

    Comment

    • Wiwi's Lab
      Junior Member
      • Feb 2022
      • 2

      #3
      Hello LenR,
      Ahhhh, I see, make sens.

      So I finally I managed it in a diferent way, I did 2 script (update and upgrade) on my hosts and I execute the script with remote commands.
      This way, the upgrade can finish properly as it's executed locally.
      I just needed to allow zabbix user on host to execute the script as sudo without password and now it's working well !
      I increase the timeout to 10 sec because I got few time timout error with default settings (3 sec)

      Still not sure is it's best practice in a security point of view, but it do the job.

      Thanks a lot for your help !

      Comment

      Working...