## Comment File Format

Introduction

In order to help share information among administrators, techs, etc., NetSaint allows comments to be added to all hosts and services that are being monitored. The comments are stored in the file specified by the comment_file directive in the main configuration file.

It should be noted that NetSaint "cleans" the comment file each time it restarts. During the cleaning process, NetSaint will remove all comments that are not marked as being persistent or that do not correspond to valid hosts or services that you have defined, and it will re-number all comment IDs.

Adding Comments

If you wish to use or write an external application that adds comments to hosts or services, you should not write comments directly to the comment file. Instead, use the ADD_SVC_COMMENT and ADD_HOST_COMMENT external commands. The commands should be written to the external command file. NetSaint will periodically scan the external command file and process any commands it finds in there.

Deleting Comments

Similiarly, if you want to delete one or more comments from the command file, use the DEL_SVC_COMMENT, DEL_HOST_COMMENT, DEL_ALL_SVC_COMMENTS, or DEL_ALL_HOST_COMMENTS external commands. Do not modify the contents of the comment file yourself!

File Format

The comment file contains two types of entries: host comments and service comments. The format for each type of comment it described below.

Host Comment Format:

[<timestamp>] HOST_COMMENT;<id>;<host_name>;<persistent>;<author>;<comment>

where...

- timestamp is the time in time_t format (seconds since UNIX epoch) that the comment was entered by the user.
- id is a comment identification number which is unique among other host and service comments. This number is generated by NetSaint and cannot be specified by the user.
- host_name is the short name of the host (as defined in the host configuration file) that the comment is associated with.
- persistent is a flag which indicated whether the comment is persistent or not. Persistent comments survive program restarts, while non-persistent comments are deleted when NetSaint is restarted. A value of 0 indicates that the comment is non-persistent, while a value of 1 indicates that it is persistent.
- author is a text field that contains the name of the person who entered the comment.
- comment is a text field that contains the actual comment.

Service Comment Format:

[<timestamp>] SERVICE_COMMENT;<id>;<host_name>;<svc_description>;<persistent>;<author>;<comment>

where...

- timestamp is the time in time_t format (seconds since UNIX epoch) that the comment was entered by the user.
- id is a comment identification number which is unique among other host and service comments. This number is generated by NetSaint and cannot be specified by the user.
- host_name is the short name of the host that the service is associated with.
- svc_descriptionis the description of the service (as defined in the host configuration file) that the comment is associated with. Together the host_name and svc_description uniquely identiry a particular service.
- persistent is a flag which indicated whether the comment is persistent or not. Persistent comments survive program restarts, while non-persistent comments are deleted when NetSaint is restarted. A value of 0 indicates that the comment is non-persistent, while a value of 1 indicates that it is persistent.
- author is a text field that contains the name of the person who entered the comment.
- comment is a text field that contains the actual comment.