Last active
August 29, 2015 14:28
-
-
Save ujuc/31505cb649ee8712db99 to your computer and use it in GitHub Desktop.
zabbix FC host check
This file contains 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
UserParameter=fchost.discovery, /etc/zabbix/fchost_discovery.py | |
UserParameter=fchost.status[*], /etc/zabbix/fchost_status.py $1 |
This file contains 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
#!/usr/bin/env python | |
# coding: utf-8 | |
import os | |
import json | |
pwd = '/sys/class/fc_host/' | |
hosts = list() | |
get_hosts = os.listdir(pwd) | |
for host in get_hosts: | |
dc = {"{#FCHOST}": host} | |
hosts.append(dc) | |
data = {'data': hosts} | |
print json.dumps(data) |
This file contains 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
#!/usr/bin/env python | |
# coding: utf-8 | |
import sys | |
import subprocess as sub | |
host_name = sys.argv[1] | |
pwd = '/sys/class/fc_host/' | |
get_host_state = sub.Popen(['cat', '{0}{1}/port_state'.format(pwd, host_name)], stdout=sub.PIPE).communicate() | |
host_state = get_host_state[0].split['\n'][0] | |
print host_state |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment