counterd is a small daemon that is intended to be simpler than jnx-example. Like helloworldd, it is a good starting point for newbies to JUNOS daemons. It demonstrates DDL, ODL, DAX and the minimal amount of APIs from libjunos-sdk. It also uses patricia trees from libjuniper to store the configuration.
This application simply allows a message to be configured and provides a command to print that message back out like helloworldd. However, it also keeps a counter of the number of times the current configured message is viewed. This counter is persistent across restarts of counterd. It is also persistent between RE switchovers when GRES is enabled by doing a (set chassis redundancy graceful-switchover). When doing this "commit synchronize" must be used to commit, and then the configured message will be the same on both REs.
Viewing the message also shows the current counter value.
Here's sample output:
{master} user@router> show sync counter message Current Message and Counter: Message: HELLO! Times viewed: 12