Alignak-monitoring-contrib / alignak-module-backend

Alignak modules (arbiter, broker, scheduler) for the backend
GNU Affero General Public License v3.0
0 stars 2 forks source link

Tests do not always have the same results #80

Open mohierf opened 7 years ago

mohierf commented 7 years ago

In test_arbiter_full_conf.py:

    def test_services(self):
        # mohierf: I got 76 locally but 74 on Travis ... :/
        self.assertEqual(len(self.objects['services']), 74)
mohierf commented 7 years ago

Services list got by the Alignak backend arbiter after having imported the same configuration in the backend!

On Travis build:

alignak-backend-import, inserted elements: 
 - 105 command(s)
 - 14 host(s)
 - 23 host_template(s)
 - 3 hostdependency(s)
 - 2 hostescalation(s)
 - 8 hostgroup(s)
 - 5 realm(s)
 - 82 service(s)
 - 77 service_template(s)
 - 1 servicedependency(s)
 - 3 serviceescalation(s)
 - 5 servicegroup(s)
 - 4 timeperiod(s)
 - 8 user(s)
 - 2 user_template(s)
 - 3 usergroup(s)

INFO:alignak.module.backend_arbiter:Got 82 services
INFO:alignak.module.backend_arbiter:- vm-fred/nsca_network
INFO:alignak.module.backend_arbiter:- vm-fred/nsca_memory
INFO:alignak.module.backend_arbiter:- vm-fred/Swap
INFO:alignak.module.backend_arbiter:- vm-fred/nsca_cpu
INFO:alignak.module.backend_arbiter:- vm-fred/Uptime
INFO:alignak.module.backend_arbiter:- vm-fred/Net_LAN1
INFO:alignak.module.backend_arbiter:- vm-fred/nsca_disk
INFO:alignak.module.backend_arbiter:- vm-fred/System
INFO:alignak.module.backend_arbiter:- vm-fred/Fs_C:
INFO:alignak.module.backend_arbiter:- remotepoller/Uptime
INFO:alignak.module.backend_arbiter:- remotepoller/Fs_/
INFO:alignak.module.backend_arbiter:- remotepoller/System
INFO:alignak.module.backend_arbiter:- remotepoller/nsca_disk
INFO:alignak.module.backend_arbiter:- remotepoller/nsca_network
INFO:alignak.module.backend_arbiter:- remotepoller/nsca_memory
INFO:alignak.module.backend_arbiter:- remotepoller/nsca_cpu
INFO:alignak.module.backend_arbiter:- remotepoller/Swap
INFO:alignak.module.backend_arbiter:- remotepoller/Net_eth0
INFO:alignak.module.backend_arbiter:- webui/Shinken2-receiver
INFO:alignak.module.backend_arbiter:- webui/Shinken2-poller
INFO:alignak.module.backend_arbiter:- webui/Memory
INFO:alignak.module.backend_arbiter:- webui/Load
INFO:alignak.module.backend_arbiter:- webui/Cpu
INFO:alignak.module.backend_arbiter:- webui/Shinken2-broker
INFO:alignak.module.backend_arbiter:- webui/Shinken2-scheduler
INFO:alignak.module.backend_arbiter:- webui/Disks
INFO:alignak.module.backend_arbiter:- webui/NetworkUsage
INFO:alignak.module.backend_arbiter:- webui/Shinken2-arbiter
INFO:alignak.module.backend_arbiter:- webui/Shinken2-reactionner
INFO:alignak.module.backend_arbiter:- Shinken/Memory
INFO:alignak.module.backend_arbiter:- Shinken/Shinken2-scheduler
INFO:alignak.module.backend_arbiter:- Shinken/NetworkUsage
INFO:alignak.module.backend_arbiter:- Shinken/Load
INFO:alignak.module.backend_arbiter:- Shinken/Shinken2-reactionner
INFO:alignak.module.backend_arbiter:- Shinken/Cpu
INFO:alignak.module.backend_arbiter:- Shinken/Shinken2-receiver
INFO:alignak.module.backend_arbiter:- Shinken/Shinken2-arbiter
INFO:alignak.module.backend_arbiter:- Shinken/Disks
INFO:alignak.module.backend_arbiter:- Shinken/Shinken2-poller
INFO:alignak.module.backend_arbiter:- Shinken/Shinken2-broker
INFO:alignak.module.backend_arbiter:- sim-vm2/InactiveSessions
INFO:alignak.module.backend_arbiter:- sim-vm2/DisksIO
INFO:alignak.module.backend_arbiter:- sim-vm2/Reboot
INFO:alignak.module.backend_arbiter:- sim-vm2/LoadAverage
INFO:alignak.module.backend_arbiter:- sim-vm2/EachCpu
INFO:alignak.module.backend_arbiter:- sim-vm2/Network Interface
INFO:alignak.module.backend_arbiter:- sim-vm2/BigProcesses
INFO:alignak.module.backend_arbiter:- sim-vm2/Services
INFO:alignak.module.backend_arbiter:- KNM-Shinken/Http
INFO:alignak.module.backend_arbiter:- KNM-Shinken/Https
INFO:alignak.module.backend_arbiter:- KNM-Shinken/HttpsCertificate
INFO:alignak.module.backend_arbiter:- tony/InterfaceErrors
INFO:alignak.module.backend_arbiter:- tony/san_switch_sensors
INFO:alignak.module.backend_arbiter:- tony/InterfaceUsage
INFO:alignak.module.backend_arbiter:- tony/InterfaceStatus
INFO:alignak.module.backend_arbiter:- tony/san_switch_status
INFO:alignak.module.backend_arbiter:- sim-vm3/LoadAverage
INFO:alignak.module.backend_arbiter:- sim-vm3/DisksIO
INFO:alignak.module.backend_arbiter:- sim-vm3/Network Interface
INFO:alignak.module.backend_arbiter:- sim-vm3/Reboot
INFO:alignak.module.backend_arbiter:- sim-vm3/BigProcesses
INFO:alignak.module.backend_arbiter:- sim-vm3/Services
INFO:alignak.module.backend_arbiter:- sim-vm3/InactiveSessions
INFO:alignak.module.backend_arbiter:- sim-vm3/EachCpu
INFO:alignak.module.backend_arbiter:- graphite/Memory
INFO:alignak.module.backend_arbiter:- graphite/Load
INFO:alignak.module.backend_arbiter:- graphite/Cpu
INFO:alignak.module.backend_arbiter:- graphite/NetworkUsage
INFO:alignak.module.backend_arbiter:- graphite/Disks
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-arbiter
INFO:alignak.module.backend_arbiter:- shinkenspare/Memory
INFO:alignak.module.backend_arbiter:- shinkenspare/NetworkUsage
INFO:alignak.module.backend_arbiter:- shinkenspare/Cpu
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-poller
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-receiver
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-scheduler
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-reactionner
INFO:alignak.module.backend_arbiter:- shinkenspare/Load
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-broker
INFO:alignak.module.backend_arbiter:- shinkenspare/Disks
INFO:alignak.module.backend_arbiter:- KNM-Glpi/HttpsCertificate
INFO:alignak.module.backend_arbiter:- KNM-Glpi/Https

On local build:

alignak-backend-import, inserted elements: 
 - 105 command(s)
 - 14 host(s)
 - 23 host_template(s)
 - 3 hostdependency(s)
 - 2 hostescalation(s)
 - 8 hostgroup(s)
 - 5 realm(s)
 - 76 service(s)
 - 77 service_template(s)
 - 1 servicedependency(s)
 - 3 serviceescalation(s)
 - 5 servicegroup(s)
 - 4 timeperiod(s)
 - 8 user(s)
 - 2 user_template(s)
 - 3 usergroup(s)

INFO:alignak.module.backend_arbiter:Got 76 services
INFO:alignak.module.backend_arbiter:- vm-fred/Swap
INFO:alignak.module.backend_arbiter:- vm-fred/System
INFO:alignak.module.backend_arbiter:- vm-fred/Net_LAN1
INFO:alignak.module.backend_arbiter:- vm-fred/Uptime
INFO:alignak.module.backend_arbiter:- vm-fred/nsca_cpu
INFO:alignak.module.backend_arbiter:- vm-fred/nsca_disk
INFO:alignak.module.backend_arbiter:- vm-fred/nsca_memory
INFO:alignak.module.backend_arbiter:- vm-fred/nsca_network
INFO:alignak.module.backend_arbiter:- vm-fred/Fs_C:
INFO:alignak.module.backend_arbiter:- sim-vm3/Disks
INFO:alignak.module.backend_arbiter:- sim-vm3/DisksIO
INFO:alignak.module.backend_arbiter:- sim-vm3/BigProcesses
INFO:alignak.module.backend_arbiter:- sim-vm3/Services
INFO:alignak.module.backend_arbiter:- sim-vm3/Cpu
INFO:alignak.module.backend_arbiter:- sim-vm3/LoadAverage
INFO:alignak.module.backend_arbiter:- sim-vm3/Reboot
INFO:alignak.module.backend_arbiter:- sim-vm3/Network Interface
INFO:alignak.module.backend_arbiter:- sim-vm3/Memory
INFO:alignak.module.backend_arbiter:- sim-vm3/InactiveSessions
INFO:alignak.module.backend_arbiter:- sim-vm3/EachCpu
INFO:alignak.module.backend_arbiter:- webui/Load
INFO:alignak.module.backend_arbiter:- webui/Shinken2-scheduler
INFO:alignak.module.backend_arbiter:- webui/Shinken2-reactionner
INFO:alignak.module.backend_arbiter:- webui/Shinken2-receiver
INFO:alignak.module.backend_arbiter:- webui/NetworkUsage
INFO:alignak.module.backend_arbiter:- webui/Shinken2-broker
INFO:alignak.module.backend_arbiter:- webui/Shinken2-poller
INFO:alignak.module.backend_arbiter:- webui/Shinken2-arbiter
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-poller
INFO:alignak.module.backend_arbiter:- shinkenspare/NetworkUsage
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-scheduler
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-receiver
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-broker
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-reactionner
INFO:alignak.module.backend_arbiter:- shinkenspare/Load
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-arbiter
INFO:alignak.module.backend_arbiter:- sim-vm2/BigProcesses
INFO:alignak.module.backend_arbiter:- sim-vm2/Cpu
INFO:alignak.module.backend_arbiter:- sim-vm2/Reboot
INFO:alignak.module.backend_arbiter:- sim-vm2/EachCpu
INFO:alignak.module.backend_arbiter:- sim-vm2/Memory
INFO:alignak.module.backend_arbiter:- sim-vm2/Services
INFO:alignak.module.backend_arbiter:- sim-vm2/LoadAverage
INFO:alignak.module.backend_arbiter:- sim-vm2/InactiveSessions
INFO:alignak.module.backend_arbiter:- sim-vm2/DisksIO
INFO:alignak.module.backend_arbiter:- sim-vm2/Disks
INFO:alignak.module.backend_arbiter:- sim-vm2/Network Interface
INFO:alignak.module.backend_arbiter:- graphite/NetworkUsage
INFO:alignak.module.backend_arbiter:- graphite/Load
INFO:alignak.module.backend_arbiter:- remotepoller/System
INFO:alignak.module.backend_arbiter:- remotepoller/nsca_memory
INFO:alignak.module.backend_arbiter:- remotepoller/Net_eth0
INFO:alignak.module.backend_arbiter:- remotepoller/Swap
INFO:alignak.module.backend_arbiter:- remotepoller/nsca_cpu
INFO:alignak.module.backend_arbiter:- remotepoller/nsca_network
INFO:alignak.module.backend_arbiter:- remotepoller/Fs_/
INFO:alignak.module.backend_arbiter:- remotepoller/nsca_disk
INFO:alignak.module.backend_arbiter:- remotepoller/Uptime
INFO:alignak.module.backend_arbiter:- KNM-Glpi/HttpsCertificate
INFO:alignak.module.backend_arbiter:- KNM-Glpi/Https
INFO:alignak.module.backend_arbiter:- KNM-Shinken/Http
INFO:alignak.module.backend_arbiter:- KNM-Shinken/Https
INFO:alignak.module.backend_arbiter:- KNM-Shinken/HttpsCertificate
INFO:alignak.module.backend_arbiter:- tony/InterfaceUsage
INFO:alignak.module.backend_arbiter:- tony/InterfaceStatus
INFO:alignak.module.backend_arbiter:- tony/InterfaceErrors
INFO:alignak.module.backend_arbiter:- tony/san_switch_sensors
INFO:alignak.module.backend_arbiter:- tony/san_switch_status
INFO:alignak.module.backend_arbiter:- Shinken/Shinken2-arbiter
INFO:alignak.module.backend_arbiter:- Shinken/Shinken2-poller
INFO:alignak.module.backend_arbiter:- Shinken/Shinken2-receiver
INFO:alignak.module.backend_arbiter:- Shinken/Load
INFO:alignak.module.backend_arbiter:- Shinken/Shinken2-scheduler
INFO:alignak.module.backend_arbiter:- Shinken/Shinken2-broker
INFO:alignak.module.backend_arbiter:- Shinken/Shinken2-reactionner
INFO:alignak.module.backend_arbiter:- Shinken/NetworkUsage

Obviously the problem happens when importing: 82 services vs 76 services 😞

mohierf commented 7 years ago

Note that when Alignak imports this configuration from the flat files, we get:

        assert len(self.arbiter.conf.commands) == 106
        assert len(self.arbiter.conf.timeperiods) == 4
        assert len(self.arbiter.conf.contacts) == 7
        assert len(self.arbiter.conf.contactgroups) == 3
        assert len(self.arbiter.conf.hosts) == 13
        assert len(self.arbiter.conf.hostgroups) == 8
        assert len(self.arbiter.conf.services) == 76
        assert len(self.arbiter.conf.servicegroups) == 5

It is almost the same as on local build except for the Alignak and Alignak backend self-created items ... specific commands for instance.

What I conclude is that the alignak-backend-import do not seem to be buggy, but 6 more services are created or provided by the Alignak backend when the tests runs on Travis, but I clearly do not explain this behavior !

mohierf commented 7 years ago

If we look attentively at a specific host...

On Travis build, we get:

INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-arbiter
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-poller
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-receiver
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-scheduler
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-reactionner
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-broker
INFO:alignak.module.backend_arbiter:- shinkenspare/Memory
INFO:alignak.module.backend_arbiter:- shinkenspare/NetworkUsage
INFO:alignak.module.backend_arbiter:- shinkenspare/Cpu
INFO:alignak.module.backend_arbiter:- shinkenspare/Load
INFO:alignak.module.backend_arbiter:- shinkenspare/Disks

Locally, we get:

INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-arbiter
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-poller
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-scheduler
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-receiver
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-broker
INFO:alignak.module.backend_arbiter:- shinkenspare/Shinken2-reactionner
INFO:alignak.module.backend_arbiter:- shinkenspare/NetworkUsage
INFO:alignak.module.backend_arbiter:- shinkenspare/Load

Some services inherited from the linux-snmp template are missing in the list: Disk, Memory, ... !!!!!

An those missing services are also missing when Alignak directly loads the configuration from the flat files, this is why the alignak-backend-import script does not import those services into the backend ...