Hello,
I'm looking for a bash command to list the comments of a service to list old comments of more than 30 days.
This would allow me to delete them with the following command --> /bin/printf "[%lu] DEL_SVC_COMMENT;1\n" $now > $commandfile
thank you in advance.
(excuse me for my English because I am French)
Gba
list the comments of a service to remove them
list the comments of a service to remove them
Last edited by gba on Wed Oct 23, 2019 3:40 am, edited 1 time in total.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: list the comments of a service to remove them
You can get them in JSON with the API
Help -> Objects Reference -> objects/comment
Help -> Objects Reference -> objects/comment
Code: Select all
/nagiosxi/api/v1/objects/comment?apikey=APIKEY&pretty=1&comment_time=gt:2019-09-21
Re: list the comments of a service to remove them
You can also try this plugin:
https://exchange.nagios.org/directory/A ... ld/details
Hope this helps.
https://exchange.nagios.org/directory/A ... ld/details
Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: list the comments of a service to remove them
Hello,
I can not exploit this command ; /nagiosxi/api/v1/objects/comment?apikey=APIKEY&pretty=1&comment_time=gt:2019-09-21
For info I use Thruk.
I looked at your lmiltchev link but it does not work at home.
I would like to list the comments from more than 30 days or the last comments based on a service and delete them with the command printf "[% lu] DEL_SVC_COMMENT; 1 \ n" $now > $commandfile
I really can not ..
Thank you
I can not exploit this command ; /nagiosxi/api/v1/objects/comment?apikey=APIKEY&pretty=1&comment_time=gt:2019-09-21
For info I use Thruk.
I looked at your lmiltchev link but it does not work at home.
I would like to list the comments from more than 30 days or the last comments based on a service and delete them with the command printf "[% lu] DEL_SVC_COMMENT; 1 \ n" $now > $commandfile
I really can not ..
Thank you
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: list the comments of a service to remove them
You had posted on the NAgios XI group... I moved it to Nagios Core.gba wrote:I can not exploit this command ; /nagiosxi/api/v1/objects/comment?apikey=APIKEY&pretty=1&comment_time=gt:2019-09-21
For info I use Thruk.
If you are using Core you should have the Core JSON CGI and you can get them with a query like the fillowing
Code: Select all
http://xxx.xxx.xxx.xxx/nagios/cgi-bin/statusjson.cgi?query=commentlist&commenttimefield=entrytime&starttime=1569151359&endtime=1571742401
Re: list the comments of a service to remove them
Sorry I made a mistake !You had posted on the NAgios XI group... I moved it to Nagios Core.
statusjson.cgi shows me a page not found
I found the page containing all comments. By cons I can not sorted them with variables in the URL. Maybe that is not possible.
TY !
Last edited by gba on Wed Oct 23, 2019 3:39 am, edited 1 time in total.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: list the comments of a service to remove them
Sorry we do not provide support for thruk, just nagios.
The link I posted exists in a nagios installation.
The link I posted exists in a nagios installation.
Again, not sure as we have no knowledge of Thruk as we are not the authorsgba wrote:I found the page containing all comments. By cons I can not sorted them with variables in the URL. Maybe that is not possible.
Code: Select all
http://xx.xx.xx.xxx/thruk/#cgi-bin/extinfo.cgi?type=3#SERVICECOMMENTS
Re: list the comments of a service to remove them
thanks anyway
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: list the comments of a service to remove them
good luck!gba wrote:thanks anyway