OCSInventory-NG / OCSInventory-Server

Communication server of OCS Inventory
http://www.ocsinventory-ng.org/
GNU General Public License v2.0
341 stars 139 forks source link

[FEATURE] Integrate OCS Inventory with Grafana or Zabbix to Monitoring PC's #280

Open lexcorp opened 3 years ago

lexcorp commented 3 years ago

Integrate OCS Inventory with Grafana or Zabbix to Monitoring PC's

lexcorp commented 3 years ago

How does this work? Is it running on the OCS Inventory side or on the nagios side?

https://metacpan.org/pod/Ocs::Nagios

NAME Ocs::Nagios - Import OCS Inventory devices in Nagios VERSION Version 0.02

lexcorp commented 3 years ago

https://github.com/gitpan/Ocs-Nagios/blob/master/lib/Ocs/Nagios.pm

gillesdubois commented 3 years ago

Hi @lexcorp

These implementation are most likely really old. For compatibility reason, I can't recommend you to use them.

It would be indeed a nice thing to add, however we currently have a lot going on in our roadmap.

If this request is really important for you, developpment can be done faster trough the ocs professional offer :

In any case it will be added to our roadmap but don't expect it anytime soon.

Regards, Gilles.

thenextuser commented 1 year ago

Hello, I just stumbled across this and wanted to make a quick comment.

I am not familiar with Nagios or Grafana, but in Zabbix the OCS inventory can be used in a rudimentary way if you know which values you want to monitor. It might be possible to apply the procedure to the other applications as well.

Since the OCS is based on an SQL database, it is of course possible to read out values and set triggers for alarms via SQL queries from Zabbix.

To do this, place a shell script on the OCS server with which the SQL database can be read (preferably with a dedicated user who only has read access to the database).

For example, my script looks like this:

#!/bin/bash NL=$'\n' OUTPUT=$(mysql -u ocsread --password=SUPERSAFEPASSWORD -e "$1" ocs -s -N) printf "%s\n" "$NL$OUTPUT"

In Zabbix you can then create a template and put items in there and formulate SQL queries in them. The query can then be sent to the script, for example like this:

ocs.check["SELECT NAME FROM hardware WHERE OSVERSION = '10.0.19044' AND OSNAME NOT LIKE '%erve%'\"]

The function 'ocs.check' must of course be connected to the shell script in the Zabbix agent config beforehand, like this: UserParameter=ocs.check[*],/home/ocs/ocs_check.sh $1

Here you can then work with the usual Zabbix macros, mappings and triggers to generate the desired information and alarms.

For example, in Zabbix we monitor the hard disk space and the supported Windows release versions of our client computers.

This is of course the 'quick&dirty' method and should only be used within encrypted communication channels between Zabbix and OCS inventory, but works wonderfully as an alternative to an official integration of OCS into the mentioned applications.

Perhaps someone here can use this as food for thought.

Have fun with it and best regards.