Skip to content

Commit

Permalink
add get_ip
Browse files Browse the repository at this point in the history
Signed-off-by: cecile <cecile@ProjectZero>
  • Loading branch information
AtaxyaNetwork authored and cecile committed Aug 30, 2024
1 parent e799ddf commit 89ff9ca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,18 @@ xe host-call-plugin host-uuid=<uuid> plugin=smartctl.py fn=health

## IPMI-sensors parser
A xapi plugin to get information about the host via the BMC
### `get_info`:
```
xe host-call-plugin host-uuid=<uuid> plugin=2crsi-sensors.py fn="get_info"
[{"Name": "Outlet_Temp", "Event": "'OK'", "Units": "C", "Reading": "32.00", "Type": "Temperature"}, {"Name": "CPU0_Temp", "Event": "'OK'", "Units": "C", "Reading": "63.00", "Type": "Temperature"}, {"Name": "CPU1_Temp", "Event": "'OK'", "Units": "C", "Reading": "59.00", "Type": "Temperature"}, {"Name": "CPU0_DIMM_T", "Event": "'OK'", "Units": "C", "Reading": "38.00", "Type": "Temperature"}, {"Name": "CPU1_DIMM_T", "Event": "'OK'", "Units": "C", "Reading": "37.00", "Type": "Temperature"}, {"Name": "PSU_Inlet_Temp", "Event": "'OK'", "Units": "C", "Reading": "36.00", "Type": "Temperature"}, {"Name": "CPU0_VR_Temp", "Event": "'OK'", "Units": "C", "Reading": "43.00", "Type": "Temperature"}, {"Name": "CPU1_VR_Temp", "Event": "'OK'", "Units": "C", "Reading": "43.00", "Type": "Temperature"}, {"Name": "OCP_NIC_Temp", "Event": "'OK'", "Units": "C", "Reading": "60.00", "Type": "Temperature"} [...] }
```

### `get_ip`:
```
xe host-call-plugin host-uuid=<uuid> plugin=2crsi-sensors.py fn="get_ip"
10.10.1.191
```

## Netdata

A xapi plugin to install and get api keys of netdata on the host.
Expand Down
11 changes: 10 additions & 1 deletion SOURCES/etc/xapi.d/plugins/2crsi-sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,17 @@ def get_data(session, args):

return json.dumps(result)

def get_ip(session,args):
IP = subprocess.check_output(["ipmitool lan print | grep 'IP Address '"], shell=True)
IP = str(IP)
IP = IP.replace(" ", "")
result = re.findall(r"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b", IP)
return result[0]


_LOGGER = configure_logging('2crsi-sensors')
if __name__ == "__main__":
XenAPIPlugin.dispatch({
'get_info': get_data
'get_info': get_data,
'get_ip': get_ip
})

0 comments on commit 89ff9ca

Please sign in to comment.