Prototype-X / Zabbix-Network-Weathermap

Network weathermap for Zabbix
GNU General Public License v3.0
89 stars 38 forks source link

Two problems #12

Open ktoczyski opened 7 years ago

ktoczyski commented 7 years ago

Hi,

I have to problems with Weathermap in Zabbix.

First: When I add Template Weathermap to my equiment in Zabbix and i have this error:

Cannot update host Details Created: Application "Weathermap" on "cor-a-14-001.idm.wan". Cannot find host interface on "cor-a-14-001.idm.wan" for item key "weathermap.scan.file[{$SCANFILE}]".

What is wrong?

Second porblem: This tamplate only works in host zabbix server but is error in status for key:

weathermap.scan.file[{$SCANFILE}] weathermap.update.only[{$UPDATE}] weathermap.update.upload[{$UPLOAD}]

with information:

Unsupported item key.

Prototype-X commented 7 years ago

Hi, Template add to zabbix server host:

  1. Copy /template/userparemeter_weathermap.conf to zabbix server host /etc/zabbix/zabbix_agentd.d/
  2. Reload zabbix-agent daemon
  3. Import template

Template work with hosts where installed zabbix-agent Manual: https://www.zabbix.com/documentation/3.0/manual/config/items/userparameters

ktoczyski commented 7 years ago

I have the same sytuation.

My configuration:

cat /usr/local/etc/zabbix32/zabbix_agentd.conf.d/userparameter_weathermap.conf UserParameter=weathermap.update.upload[],/srv/data/weather/starter.py $1 UserParameter=weathermap.update.only[],/srv/data/weather/starter.py $1 UserParameter=weathermap.scan.file[],/srv/data/weather/starter.py $1 UserParameter=weathermap.scan.map[],/srv/data/weather/starter.py $1

My macros in template:

{$SCANFILE} => -s IdM -f {$SCANMAP} => -s IdM -z http://nms02.idm.wan -l map -p XXXX {$UPDATE} => -m IdM.yaml -i /srv/data/weather {$UPLOAD} => -m IdM.yaml -u

Prototype-X commented 7 years ago

Configuration look good. What version of zabbix? This template work with hosts where installed zabbix-agent. Hosts->example-host->Agent interfaces-> not empty, must set. For debug run: /srv/data/weather/weathermap.py -s IdM -z http://nms02.idm.wan -l map -p XXXX /srv/data/weather/weathermap.py -s IdM -f /srv/data/weather/weathermap.py -m IdM.yaml -u Show me output.

ktoczyski commented 7 years ago

My version: Zabbix 3.2.3

root@mon01:/# /srv/data/weather/weathermap.py -s IdM -z http://nms02.idm.wan -l map -p XXXX /srv/data/weather/config.py:58: UnsafeLoaderWarning: The default 'Loader' for 'load(stream)' without further arguments can be unsafe. Use 'load(stream, Loader=ruamel.yaml.Loader)' explicitly if that is OK. Alternatively include the following in your code:

import warnings warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning)

In most other cases you should consider using 'safe_load(stream)' self.cfg_dict = yaml3ed.load(stream) root@mon01:/# /srv/data/weather/weathermap.py -s IdM -f /srv/data/weather/config.py:58: UnsafeLoaderWarning: The default 'Loader' for 'load(stream)' without further arguments can be unsafe. Use 'load(stream, Loader=ruamel.yaml.Loader)' explicitly if that is OK. Alternatively include the following in your code:

import warnings warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning)

In most other cases you should consider using 'safe_load(stream)' self.cfg_dict = yaml3ed.load(stream) root@mon01:/# /srv/data/weather/weathermap.py -m IdM.yaml -u /srv/data/weather/config.py:58: UnsafeLoaderWarning: The default 'Loader' for 'load(stream)' without further arguments can be unsafe. Use 'load(stream, Loader=ruamel.yaml.Loader)' explicitly if that is OK. Alternatively include the following in your code:

import warnings warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning)

In most other cases you should consider using 'safe_load(stream)' self.cfg_dict = yaml3ed.load(stream)

I have installed zabbix-agent only on Zabbix-server. Other my equipment it Cisco routers and switches and I can not install agent.

Prototype-X commented 7 years ago

This trouble in last versions library ruamel.yaml. API changed. Show current version library: pip3 search ruamel.yaml Use previous version library ruamel.yaml. sudo pip3 install ruamel.yaml==0.12.14 Try again.

ktoczyski commented 7 years ago

root@mon01:/srv/data/weather/mapcfgs# pip3 search ruamel.yaml ruamel.yaml (0.15.6) - ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order INSTALLED: 0.15.6 (latest) ruamel.yaml.cmd (0.2.4) - commandline utility to manipulate YAML files ruamel.yaml.convert (0.2.2) - data format conversion routines to/from YAML yamlfmt (0.1.4) - An opinionated yaml formatter based on ruamel.yaml root@mon01:/srv/data/weather/mapcfgs# pip3 install ruamel.yaml==0.12.14 Collecting ruamel.yaml==0.12.14 Downloading ruamel.yaml-0.12.14.tar.gz (228kB) 100% |████████████████████████████████| 235kB 1.7MB/s Installing collected packages: ruamel.yaml Found existing installation: ruamel.yaml 0.15.6 Uninstalling ruamel.yaml-0.15.6: Successfully uninstalled ruamel.yaml-0.15.6 Running setup.py install for ruamel.yaml ... done Successfully installed ruamel.yaml-0.12.14 root@mon01:/srv/data/weather/mapcfgs# pip3 search ruamel.yaml ruamel.yaml (0.15.6) - ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order INSTALLED: 0.12.14 LATEST: 0.15.6 ruamel.yaml.cmd (0.2.4) - commandline utility to manipulate YAML files ruamel.yaml.convert (0.2.2) - data format conversion routines to/from YAML yamlfmt (0.1.4) - An opinionated yaml formatter based on ruamel.yaml

root@mon01:/srv/data/weather/mapcfgs# /srv/data/weather/weathermap.py -s IdM -z http://nms02.idm.wan -l map -p XXXX root@mon01:/srv/data/weather/mapcfgs# /srv/data/weather/weathermap.py -s IdM -f root@mon01:/srv/data/weather/mapcfgs# /srv/data/weather/weathermap.py -m IdM.yaml -u

But I can't still add template to host and edit map via WWW.

Prototype-X commented 7 years ago

When you add template to zabbix server host, whats wrong?

ktoczyski commented 7 years ago

For zabbix server I can add template without error. But when I add this host to map via WWW IdM.yaml config have only base settings.

root@mon01:/srv/data/weather/mapcfgs# cat IdM.yaml %YAML 1.2

map: name: IdM bgcolor: '' fontsize: 10 width: 1920 height: 1080 zabbix: url: http://nms02.idm.wan login: map password: XXX table: show: false x: 1820 y: 780 palette:

Prototype-X commented 7 years ago
  1. Add to map two hosts and linking them.
  2. Save map
  3. Run /srv/data/weather/weathermap.py -s IdM -z http://nms02.idm.wan -l map -p XXXX
  4. Show IdM.yaml
ktoczyski commented 7 years ago

I see progress :)

root@mon01:/srv/data/weather/mapcfgs# cat IdM.yaml %YAML 1.2

map: name: IdM bgcolor: '' fontsize: 10 width: 1920 height: 1080 zabbix: url: http://nms02.idm.wan login: map password: XXXX table: show: false x: 1820 y: 780 palette:

Prototype-X commented 7 years ago

Ok. For run scripts from template, need change owner scripts and maps config to zabbix. chown -R zabbix:zabbix /srv/data/weather

ktoczyski commented 7 years ago

I change permission but config still is not updated. Only works via cli.

Traffic on links I can add only via manual editing configuration file?

Prototype-X commented 7 years ago

Traffic on links I can add only via manual editing configuration file? yes

I change permission but config still is not updated. Only works via cli. Template -> weathermap.scan.file[{$SCANFILE}] -> interval -> 1hour Change interval. Check owner configuration file.