jjethwa / icinga2

GNU General Public License v3.0
222 stars 187 forks source link

Question: Combine two services / two check_commands #192

Open mfg94 opened 5 years ago

mfg94 commented 5 years ago

I have Icinga2 installation writing to InfluxDB.

I have two different check_commands running in two different service objects returning the same type of value.

Is there a way to run this services exactly at the same time and sum up their result?

Further explanation: I have two dhcp servers. One serving each half of the IP addresses for the network. E.g.: 192.168.0.1 - 192.168.0.128 comes from server1 and 192.168.0.129 - 192.168.0.255 comes from server2.

I check free IP addresses on each server with nrpe BUT with two different check_commands. Then in Grafana I want to display server1.value + server2.value to have all free IP addresses in the network.

I think my root problem is that I do use two different check_commands for that. But even if I had one check_command for both services, they will not run exactly at same time, will they? So i will not have a "primary key" to add two values given at the same time.

Is there a way to combine values out of Icinga2 check_commands / services and to run services exactly at the same time?

jjethwa commented 5 years ago

Hi @mfg94

I'm on vacation for a few weeks and in a remote location, so internet access is spotty at best. Check commands are usually spread out with a small interval so they do not overload the target server. I think in your case, you might need to write a script to execute the nrpe checks and use that as it's own check command. Although, I'm not sure why you need need both servers to be checked at the same time. It's better to check each server separately.

mfg94 commented 5 years ago

Hi @jjethwa,

thank you for your reply! Since I want to add both values I need an indicator for adding them up and I thought the best key would be the time. If the are not running synchrounus I have no indicator to add the values, do I?

jjethwa commented 5 years ago

Hi @mfg94

No problem! Sorry I can't be more helpful, it's hard enough to pull up this page with the bandwidth available right now hehe. I think since you're using a time series database, there should not be a need to have both calls execute synchronously as you can extrapolate the values using a slightly fuzzy query. If you really need exact time values then writing your own script to do that would be the best bet.

mfg94 commented 5 years ago

Yes you are right. I am on that path right now that the root cause are not the checks, rather than my InfluxDB query...

Thanks you very much!

jjethwa commented 5 years ago

That's great! Good luck! :smile: