46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
|
|
#!/bin/python3
|
||
|
|
'''
|
||
|
|
Created on jun 7, 2016
|
||
|
|
author: tpweis
|
||
|
|
file name: scat_statusk2.py
|
||
|
|
This functions initiates a recipe to run s status check on a target machine.
|
||
|
|
This function also represent a segment of the SCAT. The SCAT contains
|
||
|
|
any required IP or URN identifiers.
|
||
|
|
'''
|
||
|
|
import os
|
||
|
|
import subprocess
|
||
|
|
import sys
|
||
|
|
import syslog
|
||
|
|
sys.path.insert(0,'/sl/lib')
|
||
|
|
|
||
|
|
from sleds_utilities import *
|
||
|
|
|
||
|
|
def main():
|
||
|
|
"function main"
|
||
|
|
|
||
|
|
argv = sys.argv[1:]
|
||
|
|
IPADDR, USER, URN, MONGO = slscatargs(argv)
|
||
|
|
rc = scat_statusk2(IPADDR, USER, URN, MONGO)
|
||
|
|
print("scat_statusk2 returned: " + str(rc))
|
||
|
|
slscatlog('I',"scat_statusk2: " + IPADDR + ", " + USER + ", " + URN + ", " + MONGO + ", rc = " + str(rc))
|
||
|
|
exit()
|
||
|
|
|
||
|
|
def scat_statusk2(ipaddr, user, urn, mongo):
|
||
|
|
"function scat_statusk2()"
|
||
|
|
|
||
|
|
cmd="k2_status"
|
||
|
|
ret_data = slscatfunction(cmd, ipaddr, user, urn, mongo)
|
||
|
|
ret_data = str(ret_data)
|
||
|
|
slscatlog('D',"return value: " + ret_data)
|
||
|
|
|
||
|
|
if "ON" in ret_data:
|
||
|
|
return (0)
|
||
|
|
else:
|
||
|
|
return (1)
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
# execute only if run as a script
|
||
|
|
main()
|
||
|
|
|