Hi, I'm working on a python script to send logging details to zabbix. The machine where I'm working (linux Ubuntu) is already monitored through the agent installed and it is sending everything to the server with no issues.
After some research i found that i can send to my server logging details from python script using this:
from pyzabbix import ZabbixMetric, ZabbixSender
# Send metrics to zabbix trapper
packet = [
ZabbixMetric('hostname1', 'test[cpu_usage]', 2),
ZabbixMetric('hostname1', 'test[system_status]', "OK"),
ZabbixMetric('hostname1', 'test[disk_io]', '0.1'),
ZabbixMetric('hostname1', 'test[cpu_usage]', 20, 1411598020),
]
result = ZabbixSender(use_config=True).send(packet)
source: https://github.com/adubkov/py-zabbix#readme
If I'm not wrong this should work without inserting any information, given that the python library is taking all the details from my config file: /etc/zabbix/zabbix_agentd.conf (source: https://py-zabbix.readthedocs.io/en/...art_guide.html), is this correct?
If i run the script no errors are showed up so i assume that my script is sending something?
Last and most important question how can i map this from the server side, i have already been inserting new items under "configuration" -> "Templates" -> items but i don't know how to instruct the server to look for that specific key, Type and so on...
Thanks
After some research i found that i can send to my server logging details from python script using this:
from pyzabbix import ZabbixMetric, ZabbixSender
# Send metrics to zabbix trapper
packet = [
ZabbixMetric('hostname1', 'test[cpu_usage]', 2),
ZabbixMetric('hostname1', 'test[system_status]', "OK"),
ZabbixMetric('hostname1', 'test[disk_io]', '0.1'),
ZabbixMetric('hostname1', 'test[cpu_usage]', 20, 1411598020),
]
result = ZabbixSender(use_config=True).send(packet)
source: https://github.com/adubkov/py-zabbix#readme
If I'm not wrong this should work without inserting any information, given that the python library is taking all the details from my config file: /etc/zabbix/zabbix_agentd.conf (source: https://py-zabbix.readthedocs.io/en/...art_guide.html), is this correct?
If i run the script no errors are showed up so i assume that my script is sending something?
Last and most important question how can i map this from the server side, i have already been inserting new items under "configuration" -> "Templates" -> items but i don't know how to instruct the server to look for that specific key, Type and so on...
Thanks
)
Comment