Created
August 17, 2019 18:01
-
-
Save Sean-Bradley/986d6f0d7e63ff087dfb89fce8a05ab2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import random | |
import subprocess | |
while 1: | |
costprice = random.uniform(1, 100) | |
sellprice = costprice + (costprice * random.uniform(-0.20, 0.50)) | |
profit = sellprice - costprice | |
print(str(costprice) + " " + str(sellprice) + " " + str(profit)) | |
cmd = '"C:\\Program Files\\Zabbix Agent\\zabbix_sender" -z "your-proxy-or-server" -s "your-host" -k "costprice" -o "%s" ' % ( | |
costprice | |
) | |
print(cmd) | |
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) | |
output, error = process.communicate() | |
print(output) | |
time.sleep(0.2) | |
cmd = '"C:\\Program Files\\Zabbix Agent\\zabbix_sender" -z "your-proxy-or-server" -s "your-host" -k "sellprice" -o "%s" ' % ( | |
sellprice | |
) | |
print(cmd) | |
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) | |
output, error = process.communicate() | |
print(output) | |
time.sleep(0.2) | |
cmd = '"C:\\Program Files\\Zabbix Agent\\zabbix_sender" -z "your-proxy-or-server" -s "your-host" -k "profit" -o "%s" ' % ( | |
profit | |
) | |
print(cmd) | |
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) | |
output, error = process.communicate() | |
print(output) | |
print() | |
time.sleep(random.uniform(1, 10)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Edit the strings
your-proxy-or-server
with the ip or hostname of your proxy or Zabbix server,Edit the strings
your-host
with the name of your host as listed in the Zabbix Server GUIThis script is using
zabbix_sender.exe
to push data to 3 Zabbix trapper items configured for your host, namedcostprice
,sellprice
andprofit
. All three items are floats.