Skip to content
Discussion options

You must be logged in to vote

Well, this is definitely possible. You need to define a NameSet to import the required libraries (at least datetime).

The test generally should look like this:

datetime.strptime(device.state.show_license["expire_date"], "your_format_here") - datetime.now() > timedelta(days=15)

You can use django.utils.timezone.now() as well to get timezone aware datetime (timezone is set inside netbox settings)

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@olivertwin
Comment options

@amyasnikov
Comment options

Answer selected by olivertwin
@olivertwin
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants