Zabbix-Network-Weathermap
Zabbix-Network-Weathermap copied to clipboard
Two problems
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.
Hi, Template add to zabbix server host:
- Copy /template/userparemeter_weathermap.conf to zabbix server host /etc/zabbix/zabbix_agentd.d/
- Reload zabbix-agent daemon
- Import template
Template work with hosts where installed zabbix-agent Manual: https://www.zabbix.com/documentation/3.0/manual/config/items/userparameters
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
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.
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.
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.
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.
When you add template to zabbix server host, whats wrong?
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:
- '#908C8C'
- '#FFFFFF'
- '#8000FF'
- '#0000FF'
- '#00EAEA'
- '#00FF00'
- '#FFFF00'
- '#FF9933'
- '#FF0000' link: bandwidth: 100 width: 10 ...
- Add to map two hosts and linking them.
- Save map
- Run /srv/data/weather/weathermap.py -s IdM -z http://nms02.idm.wan -l map -p XXXX
- Show IdM.yaml
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:
- '#908C8C'
- '#FFFFFF'
- '#8000FF'
- '#0000FF'
- '#00EAEA'
- '#00FF00'
- '#FFFF00'
- '#FF9933'
- '#FF0000' link: bandwidth: 100 width: 10 node-5: name: cor-a-06-001.idm.wan x: 375 y: 225 node-6: name: cor-a-14-001.idm.wan x: 575 y: 225 link-1: node1: node-6 node2: node-5 name1: cor-a-14-001.idm.wan name2: cor-a-06-001.idm.wan hostname: '' itemin: '' itemout: '' ...
Ok. For run scripts from template, need change owner scripts and maps config to zabbix.
chown -R zabbix:zabbix /srv/data/weather
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?
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.