Take a basic mminfo query, add someone not familiar with how NetWorker stores and works with dates/times, and you have instant chaos*. In this post I want to help people who are just starting out with mminfo understand how it works with dates.
So let’s look at a basic query that tends to cause a lot of confusion:
# mminfo -q "client=archon,savetime<=2 weeks ago"
As a long-term NetWorker user, and implementation consultant/support consultant, not to mention a long term member of the NetWorker mailing list, this question seems to come up fairly frequently. The output appears “broken” – rather than being “savetime less than or equal to two weeks ago”, we instead get all backups for the client archon where the savetime is greater than or equal to two weeks ago.
‘Huh?’ I hear you ask.
Indeed, this is oft-used as an example of how “broken” NetWorker is. In fact, the real state is far more prosaic.
NetWorker stores and works with times as seconds since the(/an) epoch. When you supply dates to NetWorker – either in the fuzzy format above, or as a literal date string, it converts that date into a timestamp of seconds since the(/an) epoch. (You can if you want find out what a savetime is in seconds, rather than an interpreted date any time you wish in mminfo by choosing a report specification of ‘nsavetime’.)
So if you then think of the query:
# mminfo -q "client=archon,savetime<=2 weeks ago"
It has a different meaning. You’re actually asking NetWorker:
- Convert ’2 weeks ago’ into seconds offset from ‘now’. Let’s call that Z.
- Give me all the backups for the client ‘archon’ where the savetime is less than or equal to Z.
If you don’t like to think of it as all referring to seconds since an epoch, there’s another, perhaps simpler way of thinking about it – that being:
- Treat “<” as meaning before.
- Treat “>” as meaning after.
Thus, in this scenario, the query:
# mminfo -q "client=archon,savetime<=2 weeks ago"
Can be interpreted to mean, “give me all backups of the client archon taken before two weeks ago”.
You’re obviously welcome to use whichever interpretation you feel makes more sense – seconds/math or before/after – it doesn’t really matter which. Once you get the hang of this though mminfo will make a lot more sense.
–
* I’ve unfortunately seen someone who got < and > wrong (and didn’t check their results) relabel all tapes in a tape library that had backups younger than 3 months, rather than older than 3 months. Hence, ‘chaos’ is an appropriate term.












