Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Latest commit

 

History

History
71 lines (62 loc) · 2.14 KB

README.md

File metadata and controls

71 lines (62 loc) · 2.14 KB

netbox-service-dell

Dell Support Service APIs

You need to request access to the Dell Warranty Status API to be able to make API calls. More information can be found here.

NetBox

Preparation

Custom fields

You need to create the following custom fields and attatch them to the object type dcim > device. This formular can be found under Username > Admin > Extras > Custom fields.

  • service_until / Date
  • service_type / Text

API access

You need to create a User Token with read and write access. This option can be found under Username > Profile > API Tokens > Add a token.

Export templates

Maintenance Report

  • Content type: dcim > device
  • Name: Maintenance Report
  • Mime type: xhtml+xml
  • File extension: html
  • Template code:
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" href="https://unpkg.com/[email protected]/build/pure-min.css" integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>Device - Maintenance Report</title>
	</head>
	<body>
		<h1>Device - Maintenance Report</h1>
		<table class="pure-table sortable" style="width:100%;">
			<thead>
				<th>Hostname</th>
				<th>Serial</th>
				<th>Service Type</th>
				<th>Service duration</th>
				<th>Location</th>
			</thead>
			<tbody>
			{% for device in queryset %}
			<tr>
				<td>{{ device.name }}</td>
				<td>{{ device.serial }}</td>
				<td>{% if device.cf.service_type %}{{ device.cf.service_type }}{% endif %}</td>
				<td>{{ device.cf.service_until|date:"Y-m-d" }}</td>
				<td>{{ device.site.name }} > {{ device.rack.name }}{% if device.position %} > U{{ device.position }}{% endif %}</td>
			</tr>
			{% endfor %}
			</tbody>
		</table>
		<script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>
	</body>
</html>

Cronjob

@daily  cd /opt/netbox-service-dell && /usr/bin/python2.7 fetch.py >> /var/log/netbox-service-dell.log

Python 2.7

Install requirements via:

pip2 install -r requirements.txt