snipeit-eosl 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snipeit_eosl-1.0.0/LICENSE +201 -0
- snipeit_eosl-1.0.0/PKG-INFO +130 -0
- snipeit_eosl-1.0.0/README.md +108 -0
- snipeit_eosl-1.0.0/pyproject.toml +35 -0
- snipeit_eosl-1.0.0/setup.cfg +4 -0
- snipeit_eosl-1.0.0/snipeit_eosl/__init__.py +0 -0
- snipeit_eosl-1.0.0/snipeit_eosl/cli.py +91 -0
- snipeit_eosl-1.0.0/snipeit_eosl/eosl.py +83 -0
- snipeit_eosl-1.0.0/snipeit_eosl/matching.py +140 -0
- snipeit_eosl-1.0.0/snipeit_eosl/report.py +160 -0
- snipeit_eosl-1.0.0/snipeit_eosl/snipeit.py +130 -0
- snipeit_eosl-1.0.0/snipeit_eosl.egg-info/PKG-INFO +130 -0
- snipeit_eosl-1.0.0/snipeit_eosl.egg-info/SOURCES.txt +16 -0
- snipeit_eosl-1.0.0/snipeit_eosl.egg-info/dependency_links.txt +1 -0
- snipeit_eosl-1.0.0/snipeit_eosl.egg-info/entry_points.txt +2 -0
- snipeit_eosl-1.0.0/snipeit_eosl.egg-info/top_level.txt +1 -0
- snipeit_eosl-1.0.0/tests/test_clients.py +160 -0
- snipeit_eosl-1.0.0/tests/test_report.py +134 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and do
|
|
117
|
+
not modify the License. You may add Your own attribution notices
|
|
118
|
+
within Derivative Works that You distribute, alongside or as an
|
|
119
|
+
addendum to the NOTICE text from the Work, provided that such
|
|
120
|
+
additional attribution notices cannot be construed as modifying
|
|
121
|
+
the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions for
|
|
125
|
+
use, reproduction, or distribution of Your modifications, or for any
|
|
126
|
+
such Derivative Works as a whole, provided Your use, reproduction,
|
|
127
|
+
and distribution of the Work otherwise complies with the conditions
|
|
128
|
+
stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 EOSL.ai
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snipeit-eosl
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Audit a Snipe-IT inventory against the EOSL.ai hardware end-of-service-life database.
|
|
5
|
+
Author-email: "EOSL.ai" <hello@eosl.ai>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://eosl.ai
|
|
8
|
+
Project-URL: Source, https://github.com/EOSL-AI/snipeit-eosl
|
|
9
|
+
Project-URL: Issues, https://github.com/EOSL-AI/snipeit-eosl/issues
|
|
10
|
+
Project-URL: Dataset, https://eosl.ai/dataset/
|
|
11
|
+
Keywords: snipe-it,snipeit,itam,asset-management,eol,eosl,end-of-life,lifecycle
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: System :: Systems Administration
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# snipeit-eosl
|
|
24
|
+
|
|
25
|
+
Audit a [Snipe-IT](https://snipeitapp.com/) inventory against the
|
|
26
|
+
[EOSL.ai](https://eosl.ai) hardware end-of-service-life database.
|
|
27
|
+
|
|
28
|
+
Snipe-IT knows what hardware you own. It does not know when the manufacturer stops supporting it.
|
|
29
|
+
This tells you, and links the manufacturer's own bulletin for every date so you can check it.
|
|
30
|
+
|
|
31
|
+
**Read-only. Zero dependencies. One HTTP request to EOSL.ai regardless of inventory size.**
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
$ snipeit-eosl --url https://snipe.example.com
|
|
35
|
+
|
|
36
|
+
EOSL.ai audit of Snipe-IT inventory
|
|
37
|
+
==============================================================
|
|
38
|
+
Past end of service life 3 models 129 units
|
|
39
|
+
Tracked, still supported 2 models 18 units
|
|
40
|
+
Not tracked by EOSL.ai 3 models 13 units
|
|
41
|
+
TOTAL 8 models 160 units
|
|
42
|
+
|
|
43
|
+
PAST END OF SERVICE LIFE (3)
|
|
44
|
+
--------------------------------------------------------------
|
|
45
|
+
Catalyst 3850 24-port 40 units EOS 2020-10 EOSL 2025-10
|
|
46
|
+
source: https://www.cisco.com/c/en/us/products/collateral/...
|
|
47
|
+
MR33-HW 85 units EOS 2021-05 EOSL 2026-07
|
|
48
|
+
source: https://documentation.meraki.com/...
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Install
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install snipeit-eosl
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Use
|
|
58
|
+
|
|
59
|
+
Generate an API token in Snipe-IT under **Account → API Keys**. A read-only user is enough.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
export SNIPEIT_URL=https://snipe.example.com
|
|
63
|
+
export SNIPEIT_TOKEN=eyJ0eXAi...
|
|
64
|
+
|
|
65
|
+
snipeit-eosl # human-readable summary
|
|
66
|
+
snipeit-eosl --all # include current and untracked models
|
|
67
|
+
snipeit-eosl --format csv -o eol-audit.csv
|
|
68
|
+
snipeit-eosl --format json | jq '.rows[] | select(.status=="unsupported")'
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Exit codes:** `0` nothing past end of service life · `1` something is · `2` the audit could not run.
|
|
72
|
+
That third one matters: a failed audit must never be mistakable for a clean one. Use it in CI:
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
- run: snipeit-eosl # fails the job when EOL hardware appears in the inventory
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## How matching works
|
|
79
|
+
|
|
80
|
+
Deterministic and conservative, in this order:
|
|
81
|
+
|
|
82
|
+
1. **Exact** match on the part number.
|
|
83
|
+
2. **Loose** match ignoring case and punctuation — `ws c3850 24t l` finds `WS-C3850-24T-L`.
|
|
84
|
+
3. **Vendor-gated alias** — `FG-60E` finds `FortiGate-60E`, but *only* when the Snipe-IT manufacturer
|
|
85
|
+
is Fortinet, so one vendor's SKU can never land on another vendor's record.
|
|
86
|
+
|
|
87
|
+
**It never fuzzy- or substring-matches.** `WS-C3850` does not resolve to `WS-C3850-24T-L`. An unknown
|
|
88
|
+
part returns nothing rather than a plausible neighbour, because a confident wrong end-of-life date is
|
|
89
|
+
worse than no date.
|
|
90
|
+
|
|
91
|
+
It reads `model_number` first and falls back to the model `name`, since many real installs leave
|
|
92
|
+
`model_number` blank. Which field matched is reported in `matched_on`, so a result is always
|
|
93
|
+
traceable.
|
|
94
|
+
|
|
95
|
+
### Snipe-IT already has an "EOL" field. It does not mean this.
|
|
96
|
+
|
|
97
|
+
Snipe-IT models carry their own `eol` value, and its API returns it as a string like `"36 months"`.
|
|
98
|
+
That is a **depreciation-style estimate of useful life measured from purchase** — a number somebody
|
|
99
|
+
at your organisation typed in. It is not a manufacturer date and it has no source behind it.
|
|
100
|
+
|
|
101
|
+
This tool reports the **manufacturer's published end-of-service-life date**, with a link to the
|
|
102
|
+
bulletin it came from. The two answer different questions, and the built-in field is the one people
|
|
103
|
+
mistake for this. `snipeit-eosl` reads it never and writes it never.
|
|
104
|
+
|
|
105
|
+
### "Not tracked" is not "supported"
|
|
106
|
+
|
|
107
|
+
Models EOSL.ai has no record for are reported as **unknown**, never folded in with the healthy ones.
|
|
108
|
+
It means this database holds no date for that part — not that the part is fine. The tooling says so
|
|
109
|
+
in every output format on purpose.
|
|
110
|
+
|
|
111
|
+
## What this does not do
|
|
112
|
+
|
|
113
|
+
- **It never writes to Snipe-IT.** Snipe-IT is a system of record, and a tool that quietly edits one
|
|
114
|
+
is a tool nobody should point at production. Write-back into a custom field was considered and
|
|
115
|
+
deliberately left out.
|
|
116
|
+
- **It does not warrant the dates.** Every record links the manufacturer's bulletin. That bulletin
|
|
117
|
+
governs; this is a convenience layer over it.
|
|
118
|
+
- **It does not invent dates.** If a manufacturer has published nothing, nothing is shown.
|
|
119
|
+
|
|
120
|
+
## Related integrations
|
|
121
|
+
|
|
122
|
+
Same data, same matching logic, different place to stand:
|
|
123
|
+
|
|
124
|
+
- **[netbox-eosl](https://github.com/EOSL-AI/netbox-eosl)** — NetBox plugin
|
|
125
|
+
- **[ansible-eosl](https://github.com/EOSL-AI/ansible-eosl)** — `eosl.lifecycle` Ansible collection
|
|
126
|
+
- **[EOSL.ai API](https://eosl.ai/api/)** — public JSON API, MCP server, and CC BY dataset
|
|
127
|
+
|
|
128
|
+
## Licence
|
|
129
|
+
|
|
130
|
+
Apache-2.0. The underlying dataset is **CC BY 4.0** — free for commercial use with attribution.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# snipeit-eosl
|
|
2
|
+
|
|
3
|
+
Audit a [Snipe-IT](https://snipeitapp.com/) inventory against the
|
|
4
|
+
[EOSL.ai](https://eosl.ai) hardware end-of-service-life database.
|
|
5
|
+
|
|
6
|
+
Snipe-IT knows what hardware you own. It does not know when the manufacturer stops supporting it.
|
|
7
|
+
This tells you, and links the manufacturer's own bulletin for every date so you can check it.
|
|
8
|
+
|
|
9
|
+
**Read-only. Zero dependencies. One HTTP request to EOSL.ai regardless of inventory size.**
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
$ snipeit-eosl --url https://snipe.example.com
|
|
13
|
+
|
|
14
|
+
EOSL.ai audit of Snipe-IT inventory
|
|
15
|
+
==============================================================
|
|
16
|
+
Past end of service life 3 models 129 units
|
|
17
|
+
Tracked, still supported 2 models 18 units
|
|
18
|
+
Not tracked by EOSL.ai 3 models 13 units
|
|
19
|
+
TOTAL 8 models 160 units
|
|
20
|
+
|
|
21
|
+
PAST END OF SERVICE LIFE (3)
|
|
22
|
+
--------------------------------------------------------------
|
|
23
|
+
Catalyst 3850 24-port 40 units EOS 2020-10 EOSL 2025-10
|
|
24
|
+
source: https://www.cisco.com/c/en/us/products/collateral/...
|
|
25
|
+
MR33-HW 85 units EOS 2021-05 EOSL 2026-07
|
|
26
|
+
source: https://documentation.meraki.com/...
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install snipeit-eosl
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Use
|
|
36
|
+
|
|
37
|
+
Generate an API token in Snipe-IT under **Account → API Keys**. A read-only user is enough.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
export SNIPEIT_URL=https://snipe.example.com
|
|
41
|
+
export SNIPEIT_TOKEN=eyJ0eXAi...
|
|
42
|
+
|
|
43
|
+
snipeit-eosl # human-readable summary
|
|
44
|
+
snipeit-eosl --all # include current and untracked models
|
|
45
|
+
snipeit-eosl --format csv -o eol-audit.csv
|
|
46
|
+
snipeit-eosl --format json | jq '.rows[] | select(.status=="unsupported")'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Exit codes:** `0` nothing past end of service life · `1` something is · `2` the audit could not run.
|
|
50
|
+
That third one matters: a failed audit must never be mistakable for a clean one. Use it in CI:
|
|
51
|
+
|
|
52
|
+
```yaml
|
|
53
|
+
- run: snipeit-eosl # fails the job when EOL hardware appears in the inventory
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## How matching works
|
|
57
|
+
|
|
58
|
+
Deterministic and conservative, in this order:
|
|
59
|
+
|
|
60
|
+
1. **Exact** match on the part number.
|
|
61
|
+
2. **Loose** match ignoring case and punctuation — `ws c3850 24t l` finds `WS-C3850-24T-L`.
|
|
62
|
+
3. **Vendor-gated alias** — `FG-60E` finds `FortiGate-60E`, but *only* when the Snipe-IT manufacturer
|
|
63
|
+
is Fortinet, so one vendor's SKU can never land on another vendor's record.
|
|
64
|
+
|
|
65
|
+
**It never fuzzy- or substring-matches.** `WS-C3850` does not resolve to `WS-C3850-24T-L`. An unknown
|
|
66
|
+
part returns nothing rather than a plausible neighbour, because a confident wrong end-of-life date is
|
|
67
|
+
worse than no date.
|
|
68
|
+
|
|
69
|
+
It reads `model_number` first and falls back to the model `name`, since many real installs leave
|
|
70
|
+
`model_number` blank. Which field matched is reported in `matched_on`, so a result is always
|
|
71
|
+
traceable.
|
|
72
|
+
|
|
73
|
+
### Snipe-IT already has an "EOL" field. It does not mean this.
|
|
74
|
+
|
|
75
|
+
Snipe-IT models carry their own `eol` value, and its API returns it as a string like `"36 months"`.
|
|
76
|
+
That is a **depreciation-style estimate of useful life measured from purchase** — a number somebody
|
|
77
|
+
at your organisation typed in. It is not a manufacturer date and it has no source behind it.
|
|
78
|
+
|
|
79
|
+
This tool reports the **manufacturer's published end-of-service-life date**, with a link to the
|
|
80
|
+
bulletin it came from. The two answer different questions, and the built-in field is the one people
|
|
81
|
+
mistake for this. `snipeit-eosl` reads it never and writes it never.
|
|
82
|
+
|
|
83
|
+
### "Not tracked" is not "supported"
|
|
84
|
+
|
|
85
|
+
Models EOSL.ai has no record for are reported as **unknown**, never folded in with the healthy ones.
|
|
86
|
+
It means this database holds no date for that part — not that the part is fine. The tooling says so
|
|
87
|
+
in every output format on purpose.
|
|
88
|
+
|
|
89
|
+
## What this does not do
|
|
90
|
+
|
|
91
|
+
- **It never writes to Snipe-IT.** Snipe-IT is a system of record, and a tool that quietly edits one
|
|
92
|
+
is a tool nobody should point at production. Write-back into a custom field was considered and
|
|
93
|
+
deliberately left out.
|
|
94
|
+
- **It does not warrant the dates.** Every record links the manufacturer's bulletin. That bulletin
|
|
95
|
+
governs; this is a convenience layer over it.
|
|
96
|
+
- **It does not invent dates.** If a manufacturer has published nothing, nothing is shown.
|
|
97
|
+
|
|
98
|
+
## Related integrations
|
|
99
|
+
|
|
100
|
+
Same data, same matching logic, different place to stand:
|
|
101
|
+
|
|
102
|
+
- **[netbox-eosl](https://github.com/EOSL-AI/netbox-eosl)** — NetBox plugin
|
|
103
|
+
- **[ansible-eosl](https://github.com/EOSL-AI/ansible-eosl)** — `eosl.lifecycle` Ansible collection
|
|
104
|
+
- **[EOSL.ai API](https://eosl.ai/api/)** — public JSON API, MCP server, and CC BY dataset
|
|
105
|
+
|
|
106
|
+
## Licence
|
|
107
|
+
|
|
108
|
+
Apache-2.0. The underlying dataset is **CC BY 4.0** — free for commercial use with attribution.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "snipeit-eosl"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Audit a Snipe-IT inventory against the EOSL.ai hardware end-of-service-life database."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
authors = [{ name = "EOSL.ai", email = "hello@eosl.ai" }]
|
|
13
|
+
keywords = ["snipe-it", "snipeit", "itam", "asset-management", "eol", "eosl", "end-of-life", "lifecycle"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Intended Audience :: System Administrators",
|
|
18
|
+
"License :: OSI Approved :: Apache Software License",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Topic :: System :: Systems Administration",
|
|
21
|
+
]
|
|
22
|
+
# Zero runtime dependencies, matching the rest of the EOSL.ai project. stdlib only.
|
|
23
|
+
dependencies = []
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://eosl.ai"
|
|
27
|
+
Source = "https://github.com/EOSL-AI/snipeit-eosl"
|
|
28
|
+
Issues = "https://github.com/EOSL-AI/snipeit-eosl/issues"
|
|
29
|
+
Dataset = "https://eosl.ai/dataset/"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
snipeit-eosl = "snipeit_eosl.cli:main"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools]
|
|
35
|
+
packages = ["snipeit_eosl"]
|
|
File without changes
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""snipeit-eosl — audit a Snipe-IT inventory against the EOSL.ai lifecycle database.
|
|
2
|
+
|
|
3
|
+
Read-only. Exit codes: 0 nothing past EOSL, 1 something past EOSL (so it is usable in CI),
|
|
4
|
+
2 an error occurred. The distinction matters: "the check failed to run" must never look like
|
|
5
|
+
"the check passed".
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import argparse
|
|
9
|
+
import csv
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
import sys
|
|
13
|
+
|
|
14
|
+
from . import eosl, report
|
|
15
|
+
from .snipeit import SnipeIt, SnipeItError
|
|
16
|
+
|
|
17
|
+
__version__ = "1.0.0"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def build_parser():
|
|
21
|
+
p = argparse.ArgumentParser(
|
|
22
|
+
prog="snipeit-eosl",
|
|
23
|
+
description="Audit a Snipe-IT inventory against the EOSL.ai hardware lifecycle database.",
|
|
24
|
+
epilog="Credentials may also come from SNIPEIT_URL and SNIPEIT_TOKEN.",
|
|
25
|
+
)
|
|
26
|
+
p.add_argument("--url", default=os.environ.get("SNIPEIT_URL"),
|
|
27
|
+
help="Snipe-IT base URL, e.g. https://snipe.example.com")
|
|
28
|
+
p.add_argument("--token", default=os.environ.get("SNIPEIT_TOKEN"),
|
|
29
|
+
help="Snipe-IT API token (prefer the SNIPEIT_TOKEN env var)")
|
|
30
|
+
p.add_argument("--format", choices=("text", "json", "csv"), default="text")
|
|
31
|
+
p.add_argument("--all", action="store_true",
|
|
32
|
+
help="include current and untracked models in the output")
|
|
33
|
+
p.add_argument("--output", "-o", help="write to a file instead of stdout")
|
|
34
|
+
p.add_argument("--timeout", type=int, default=30)
|
|
35
|
+
p.add_argument("--api-url", default=eosl.DEFAULT_API_URL,
|
|
36
|
+
help="override the EOSL.ai lookup URL (for a mirror or an air-gapped copy)")
|
|
37
|
+
p.add_argument("--insecure", action="store_true",
|
|
38
|
+
help="skip TLS verification for Snipe-IT (self-signed internal certs only)")
|
|
39
|
+
p.add_argument("--fail-on", choices=("never", "unsupported"), default="unsupported",
|
|
40
|
+
help="exit 1 when models past end of service life are found (default) or never")
|
|
41
|
+
p.add_argument("--version", action="version", version="%(prog)s " + __version__)
|
|
42
|
+
return p
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def main(argv=None):
|
|
46
|
+
args = build_parser().parse_args(argv)
|
|
47
|
+
if not args.url or not args.token:
|
|
48
|
+
print("error: --url and --token are required (or set SNIPEIT_URL / SNIPEIT_TOKEN)",
|
|
49
|
+
file=sys.stderr)
|
|
50
|
+
return 2
|
|
51
|
+
|
|
52
|
+
try:
|
|
53
|
+
client = SnipeIt(args.url, args.token, timeout=args.timeout, insecure=args.insecure)
|
|
54
|
+
models = client.models()
|
|
55
|
+
skus = eosl.fetch_lookup(api_url=args.api_url, timeout=args.timeout)
|
|
56
|
+
except (SnipeItError, eosl.EoslError) as e:
|
|
57
|
+
# Exit 2, never 0. An audit that could not run has not found "no problems".
|
|
58
|
+
print("error: %s" % e, file=sys.stderr)
|
|
59
|
+
return 2
|
|
60
|
+
|
|
61
|
+
if not models:
|
|
62
|
+
print("error: Snipe-IT returned no models — nothing to audit. This is reported as an error "
|
|
63
|
+
"rather than a clean result on purpose.", file=sys.stderr)
|
|
64
|
+
return 2
|
|
65
|
+
|
|
66
|
+
rep = report.build(models, skus)
|
|
67
|
+
|
|
68
|
+
if args.format == "json":
|
|
69
|
+
text = json.dumps(rep, indent=2, sort_keys=True)
|
|
70
|
+
elif args.format == "csv":
|
|
71
|
+
import io
|
|
72
|
+
buf = io.StringIO()
|
|
73
|
+
csv.writer(buf, lineterminator="\n").writerows(report.to_csv_rows(rep))
|
|
74
|
+
text = buf.getvalue()
|
|
75
|
+
else:
|
|
76
|
+
text = report.to_text(rep, show_all=args.all)
|
|
77
|
+
|
|
78
|
+
if args.output:
|
|
79
|
+
with open(args.output, "w", encoding="utf-8", newline="") as fh:
|
|
80
|
+
fh.write(text if text.endswith("\n") else text + "\n")
|
|
81
|
+
print("wrote %s" % args.output, file=sys.stderr)
|
|
82
|
+
else:
|
|
83
|
+
print(text)
|
|
84
|
+
|
|
85
|
+
if args.fail_on == "unsupported" and rep["summary"]["unsupported"]["models"]:
|
|
86
|
+
return 1
|
|
87
|
+
return 0
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
if __name__ == "__main__":
|
|
91
|
+
sys.exit(main())
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""HTTP client for the EOSL.ai lifecycle dataset. Stdlib only — no third-party dependencies.
|
|
2
|
+
|
|
3
|
+
ONE FETCH, NOT N. https://eosl.ai/data/lookup.json carries every tracked part number in a single
|
|
4
|
+
document (~93 KB gzipped), so auditing an inventory of any size is one round trip.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import gzip
|
|
8
|
+
import io
|
|
9
|
+
import json
|
|
10
|
+
import urllib.error
|
|
11
|
+
import urllib.request
|
|
12
|
+
|
|
13
|
+
from . import matching
|
|
14
|
+
|
|
15
|
+
DEFAULT_API_URL = "https://eosl.ai/data/lookup.json"
|
|
16
|
+
USER_AGENT = "snipeit-eosl (+https://eosl.ai/)"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class EoslError(Exception):
|
|
20
|
+
"""Raised for any failure to obtain or parse the lifecycle data."""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def fetch_lookup(api_url=DEFAULT_API_URL, timeout=30):
|
|
24
|
+
"""Fetch and parse the lifecycle lookup document. Returns the list of sku records."""
|
|
25
|
+
req = urllib.request.Request(
|
|
26
|
+
api_url,
|
|
27
|
+
headers={
|
|
28
|
+
"Accept": "application/json",
|
|
29
|
+
"User-Agent": USER_AGENT,
|
|
30
|
+
"Accept-Encoding": "gzip",
|
|
31
|
+
},
|
|
32
|
+
)
|
|
33
|
+
try:
|
|
34
|
+
with urllib.request.urlopen(req, timeout=timeout) as resp:
|
|
35
|
+
raw = resp.read()
|
|
36
|
+
except urllib.error.HTTPError as e:
|
|
37
|
+
raise EoslError("HTTP %s fetching %s" % (e.code, api_url)) from e
|
|
38
|
+
except urllib.error.URLError as e:
|
|
39
|
+
raise EoslError("could not reach %s: %s" % (api_url, e.reason)) from e
|
|
40
|
+
except Exception as e: # noqa: BLE001 - surface the cause, never proceed on partial data
|
|
41
|
+
raise EoslError("failed fetching %s: %s" % (api_url, e)) from e
|
|
42
|
+
|
|
43
|
+
# SNIFF THE BYTES, DO NOT TRUST Content-Encoding. Some clients decompress transparently but leave
|
|
44
|
+
# the header on, so branching on the header gunzips already-plain JSON. The magic number
|
|
45
|
+
# describes what the bytes ARE, which is the only thing that matters. (This exact bug shipped in
|
|
46
|
+
# ansible-eosl and was caught only in CI.)
|
|
47
|
+
if raw[:2] == b"\x1f\x8b":
|
|
48
|
+
raw = gzip.GzipFile(fileobj=io.BytesIO(raw)).read()
|
|
49
|
+
|
|
50
|
+
try:
|
|
51
|
+
data = json.loads(raw.decode("utf-8"))
|
|
52
|
+
except (ValueError, UnicodeDecodeError) as e:
|
|
53
|
+
raise EoslError("response from %s was not valid JSON: %s" % (api_url, e)) from e
|
|
54
|
+
|
|
55
|
+
skus = data.get("skus") if isinstance(data, dict) else None
|
|
56
|
+
if not isinstance(skus, list) or not skus:
|
|
57
|
+
# A 200 with an empty or truncated body is the exact failure that silently deleted 124
|
|
58
|
+
# families from this database in July 2026. Treat it as an error, NEVER as "no results" —
|
|
59
|
+
# otherwise every model in the inventory reports as untracked and the run looks clean.
|
|
60
|
+
raise EoslError(
|
|
61
|
+
"response from %s carried no part numbers — refusing to report an empty payload "
|
|
62
|
+
"as 'nothing tracked'" % api_url
|
|
63
|
+
)
|
|
64
|
+
return skus
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def resolve_many(parts, vendor_of=None, api_url=DEFAULT_API_URL, timeout=30, skus=None):
|
|
68
|
+
"""Resolve an iterable of part numbers to normalised records.
|
|
69
|
+
|
|
70
|
+
`vendor_of` is an optional callable part -> vendor name, used only to gate vendor-specific SKU
|
|
71
|
+
aliases. Returns {part_as_supplied: record_or_None}.
|
|
72
|
+
"""
|
|
73
|
+
if skus is None:
|
|
74
|
+
skus = fetch_lookup(api_url=api_url, timeout=timeout)
|
|
75
|
+
exact, loose_index = matching.build_index(skus)
|
|
76
|
+
out = {}
|
|
77
|
+
for p in parts:
|
|
78
|
+
if p is None or str(p).strip() == "":
|
|
79
|
+
continue
|
|
80
|
+
key = str(p)
|
|
81
|
+
vendor = vendor_of(key) if vendor_of else None
|
|
82
|
+
out[key] = matching.normalise(matching.match(key, vendor, exact, loose_index))
|
|
83
|
+
return out
|