Ad Widget

Collapse

Zabbix returning incorrect status of systemd commands in template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • edlentz
    Member
    • Oct 2013
    • 31

    #1

    Zabbix returning incorrect status of systemd commands in template

    Zabbix version 6.4.7, Agent2 version 6.4

    I have over 300 servers that I need to monitor. They are basically clones of each other. They are individual Vultr instances of Freepbx. I want to monitor specificallly 7 services, http, mariadb, cron, chronyd, postfix, ssh, fail2ban, and freepbx.I want to know if they are running or not. I setup a template (That was an original Official Linux template that I cloned) with individual items for each of these services. A sample key would be: systemd.unit.is-active[crond] With a trigger of : last(/Nimbus System/systemd.unit.is-active[crond])=0. I have edited the agent2.conf file to include:
    UserParameter=systemd.unit.is-active[*],systemctl is-active --quiet '$1' && echo 1 || echo 0
    UserParameter=systemd.unit.is-failed[*],systemctl is-failed --quiet '$1' && echo 1 || echo 0
    UserParameter=systemd.unit.is-enabled[*],systemctl is-enabled --quiet '$1' && echo 1 || echo 0

    Value Mapping"
    =0⇒Service Down
    =1⇒Service Active
    ​​

    Here comes the part I need help with. I had the agent installed on the servers and I added the 7 services to my template, then I edited the .conf file to add the UserParameters, restarted the agent. I started with one server, all good the services are active and running, so far so good. I did another server, now I am two for two. On to the third one and Zabbix shows the services down. Getting a 0. I go to the server over ssh and check the service systemctl status cron shows active and running. I try another server and same thing the services are running but Zabbix doesn't think so. Should I have used the systemd for agent2 template as my base for the new template? Any ideas what could be going on? Thanks in advance
  • edlentz
    Member
    • Oct 2013
    • 31

    #2
    Well, I figured out that if I uninstall the agent, reinstall it, make the server and host changes along with the UserParameter entries then it will work. Now to figure out how to make these fixes to the other servers that I have setup already. Ideas??

    Comment

    Working...