Skip to content

Instantly share code, notes, and snippets.

@Sean-Bradley
Created August 17, 2019 18:01
Show Gist options
  • Save Sean-Bradley/986d6f0d7e63ff087dfb89fce8a05ab2 to your computer and use it in GitHub Desktop.
Save Sean-Bradley/986d6f0d7e63ff087dfb89fce8a05ab2 to your computer and use it in GitHub Desktop.
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))
@Sean-Bradley
Copy link
Author

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 GUI

This script is using zabbix_sender.exe to push data to 3 Zabbix trapper items configured for your host, named costprice, sellprice and profit. All three items are floats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment