Recently on the Networker Mailing List, a windows admin was venturing into the promised land of cli access to networker and wanted some points in the right direction. Since I typed it up, I figure I'll post it here as well so I can find it next time someone asks.
In nsradmin you set a query and then act on it. A query is any set of key and value pairs (attributes). To set the query you use the `.` or `print` command. The benefit of `print` being that it sets the current query and then prints out the attributes returned by that query. Examples are probably easier to understand than theory.
(As I don't have a networker installation to access at the moment all the example output is from memory, the exact output of the various commands may vary)
- To print a client's config:
nsradmin> print type: nsr client; name: client.example.org
This sets the query to any resources that match the named attributes. Here we are using the `type` attribute to restrict to `nsr client` and the `name` attribute to restrict the query to only those matching `client.example.org`. Since we used the `print` command, the results of the query are immediately displayed. The exact same output can be achieved by using:
nsradmin> . type: nsr client; name: client.example.org Current query set. nsradmin> print
- To update a client's config:
nsradmin> . type: nsr client; name: client.example.org Current query set. nsradmin> update aliases: "www.example.org"
First the query is set with the `.` command, and then the resources modified are updated. IMPORTANT: if you set a query that returns more than one resource you will update all those resources! Be careful with your queries and be as restrictive as possible. Doing something like:
nsradmin> . type: nsr client; schedule: default Current query set. nsradmin> update aliases: "bad.example.org"
Will set the alias for every client with the `default` schedule. Many a first time nsradmin adventurer have made mistakes like this.
You could just as well use `print` instead of `.`, and I in fact recommend it as a safeguard to accidentally having to stay up for days fixing client configs. ;)
- Deleting a group:
nsradmin> delete type: nsr group; name: MyGroup <output of query> Delete? yes
You could also split this out using the `.` command to set the query and then the `delete` command to act upon the query.
If you can, I would recommend setting up a linux box (or installing cygwin) and installing the Networker man pages. The syntax of nsradmin is very well documented in the nsr_resource man page.
posted at: 04:47 | permanent link to this entry