howardjones / network-weathermap

Network Weathermap draws diagrams from data
http://www.network-weathermap.com/
MIT License
426 stars 95 forks source link

[0.98] Editor no longer uses editor-config.php #136

Closed kozfelipe closed 6 years ago

kozfelipe commented 6 years ago

Hi,

I am trying to integrate weathermap with centreon plataform.

I notice editor-config.php does not exist anymore, yet my editor misses it

image

Is there any existing built-in integration with centreon / nagios or shall I work it from scratch?

howardjones commented 6 years ago

If you don't have Cacti, then you don't need to worry about Cacti integration :-) You should be able to set $ignore_cacti to TRUE on line 37 of editor.php to disable the warning.

I thought someone had written a nagios data source for weathermap, but I can't find it now... take a look at an existing datasource like the MRTG one. They are pretty simple to write. You will need to update it again if/when you upgrade to weathermap 1.x though.

kozfelipe commented 6 years ago

@howardjones centreon generates rrd files for each traffic_in and traffic_out, unlike cacti which has both in a single data source

image

I think thats why im getting these warnings:

[root@OP-CENTREON weathermap]# ./weathermap --config configs/teste.conf --output mymap.png --htmloutput mymap.html WARNING: configs/teste.conf: RRD ReadData: At least one of your DS names (traffic_in and traffic_out) were not found, even though there was a valid data line. Maybe they are wrong? Valid DS names in this file are: value, [WMRRD06] WARNING: configs/teste.conf: ReadData: LINK RTED-BSA01-01-RTED-MNS07-01, target: /var/lib/centreon/metrics/4558.rrd on config line 55 of configs/teste.conf had no valid data, according to WeatherMapDataSource_rrd

howardjones commented 6 years ago

Yes, you will need to do something like:

TARGET /var/lib/centreon/4557.rrd:value:-  /var/lib/centreon/4558.rrd:-:value

This will take the DS named 'value' from 4557.rrd and use it as the 'in' data, and also the DS named 'value' for 4558.rrd and use that as the 'out' value. Multiple targets on one line are added together: in+in+in, out+out+out. But you will have only one in value and one out value in this case. The '-' for DS name means to ignore that channel for this target.

howardjones commented 6 years ago

Weathermap defaults to multiplying by 8 too (Cacti stores the byte counter value from SNMP). In your screenshot it says bits/sec. If Centreon really does store the bits/sec value, you might also need to tell weathermap not to multiply:

TARGET gauge:/var/lib/centreon/4557.rrd:value:-  gauge:/var/lib/centreon/4558.rrd:-:value

The gauge: prefix here means "don't multiply by 8".

kozfelipe commented 6 years ago

@howardjones excelent

Now I must make my editor create links with this kind of target by default. I have no idea where to start.

howardjones commented 6 years ago

Currently, you would need to make modifications to lib/Weathermap/Integrations/Cacti/EditorDataPicker.php, or (better) make a new Integrations subdirectory for Centreon, and make cacti-pick.php use that other class instead of the one in the Cacti directory. And write the class, of course. The EditorDataPicker class contains the database queries. You will also need to implement database.php, so that Weathermap can access the Centreon database (it has a function that should return a PDO connection).

However, the n+1 release is planned to have some kind of plugin architecture for the editor picker, like we have for data sources, for exactly this kind of reason. At that point, the user-interface stuff in the picker will be standard between data sources, and you will just need to provide the functions that return data.

In both cases, you would need to know how Centreon stores the locations of the RRD files in its database though, so that data can be presented to the user in a sensible way.