Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export gauge of last ZFS snapshot timestamp #1776

Closed
ddevault opened this issue Jul 3, 2020 · 12 comments
Closed

Export gauge of last ZFS snapshot timestamp #1776

ddevault opened this issue Jul 3, 2020 · 12 comments

Comments

@ddevault
Copy link

ddevault commented Jul 3, 2020

I like to set an alarm on the age of my backups to make sure that they're being taken, and I would similarly like to set an alarm on snapshot age.

@SuperQ
Copy link
Member

SuperQ commented Jul 6, 2020

Do you know where in the ZFS procfiles this can be found?

@ddevault
Copy link
Author

ddevault commented Jul 6, 2020

No, I'm not certain.

@ddevault
Copy link
Author

ddevault commented Jul 6, 2020

It looks like it might be read out of /dev/zfs with some internal API.

I use the following command to get the timestamp of the last snapshot:

zfs list -HS creation -o creation -t snapshot | head -n1

I think you can also get this info by linking to libzfs.

@SuperQ
Copy link
Member

SuperQ commented Jul 6, 2020

Unfortunately, there are two problems with that method.

  • The /dev/zfs device requires root. We do not allow features in the node_exporter that require root.
  • Linking to C libraries requires CGO, which we don't allow on Linux to avoid compatibility problems between distributions.

@ddevault
Copy link
Author

ddevault commented Jul 6, 2020

The /dev/zfs device requires root. We do not allow features in the node_exporter that require root.

Fair.

Linking to C libraries requires CGO, which we don't allow on Linux to avoid compatibility problems between distributions.

...sorry, what?

Another option would be executing the zfs command I mentioned above and parsing the output. The format is stable.

@SuperQ
Copy link
Member

SuperQ commented Jul 6, 2020

We also do not allow executing sub processes.

@ddevault
Copy link
Author

ddevault commented Jul 6, 2020

Okay, but the CGO limitation doesn't make any sense to me. Linking to CGO is something which is well-understood and well-supported on all Linux distros.

@SuperQ
Copy link
Member

SuperQ commented Jul 6, 2020

While it seems that way, it's not as great as it seems. There have been numerous bugs caused by CGO in the past. We try to avoid it as much as possible.

@ddevault
Copy link
Author

ddevault commented Jul 6, 2020

The only one I can think of is issues with musl. The main musl distribution is Alpine Linux, and this is resolved by using an Alpine Linux package to install node_exporter. The maintainer of that package is yours truly.

@SuperQ
Copy link
Member

SuperQ commented Jul 6, 2020

There have been several others, this one was great. We don't want CGO and all that comes with it.

@lstrojny
Copy link

lstrojny commented Feb 6, 2023

Here is a script to get ZFS snapshot metrics with the textfile collector: prometheus-community/node-exporter-textfile-collector-scripts#136

@discordianfish
Copy link
Member

Yeah I think a separate exporter or textfile collector script would be most appropriate, so closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants