How do i remove Autodiscovery Jobs Completely from CMD

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
matt.lilek
Posts: 137
Joined: Wed Aug 07, 2013 11:53 am

How do i remove Autodiscovery Jobs Completely from CMD

Post by matt.lilek »

Hello Team,

I tried to remove from the command line all autodiscoveries that were more than 365 days old but for some reason i must have missed something cause they still show in the GUI and are all just spinning. The ones older than a year do not list a date and they are spinning and the ones a year or newer are spinning too.

I did a find -mtime +365 -delete in cd /usr/local/nagiosxi/html/includes/components/autodiscovery/jobs
One thing that looked odd to me is the screenshot that i will attach. Fore some reason there are a bunch of entries that didnt get deleted cause the date stamp looks like a time stamp. Please advise on this as well.
Please let me know what i missed.

Thank you,

Matt
matt.lilek
Posts: 137
Joined: Wed Aug 07, 2013 11:53 am

Re: How do i remove Autodiscovery Jobs Completely from CMD

Post by matt.lilek »

I added a Discovery Job and all jobs that are less than 1 year have now stopped spinning.
matt.lilek
Posts: 137
Joined: Wed Aug 07, 2013 11:53 am

Re: How do i remove Autodiscovery Jobs Completely from CMD

Post by matt.lilek »

The ones on top are older than a year the ones on the bottom are less than a year. I need to completely remove all more than 365 days old and had to resort to the command line to accomplish this as there are no bulk removals for Autodiscovery Jobs and hitting the red X hundreds of times while waiting for the page to refresh between each was a dreadful option.
You do not have the required permissions to view the files attached to this post.
matt.lilek
Posts: 137
Joined: Wed Aug 07, 2013 11:53 am

Re: How do i remove Autodiscovery Jobs Completely from CMD

Post by matt.lilek »

Sorry, uploaded the screenshot that i should have attached to the first reply. This is the one that i meant to post last
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: How do i remove Autodiscovery Jobs Completely from CMD

Post by ssax »

Yo! How goes it brother?

I looked into this and you'll likely need to click the red X next to them unfortunately, the reason why is that the autodiscovery jobs are stored in the DB, the result files are stored on the filesystem but the jobs would still be listed regardless.

Code: Select all

echo "select * from xi_options where name = 'autodiscovery_jobs';" | mysql -uroot -pnagiosxi nagiosxi
Or if you're using postgresql:

Code: Select all

echo "select * from xi_options where name = 'autodiscovery_jobs';" | psql nagiosxi nagiosxi
It's actually stored as a php serialized object:

Code: Select all

[root@xid nagios]# echo "select * from xi_options where name = 'autodiscovery_jobs';" | mysql -uroot -pnagiosxi nagiosxi
option_id       name    value
31      autodiscovery_jobs      a:3:{s:6:"b5H2FE";a:10:{s:7:"address";s:17:"192.168.232.10/16";s:15:"exclude_address";s:0:"";s:12:"os_detection";s:2:"on";s:18:"topology_detection";s:2:"on";s:10:"system_dns";s:2:"on";s:9:"initiator";s:11:"nagiosadmin";s:10:"start_date";i:1539374940;s:9:"scandelay";s:0:"";s:9:"frequency";s:5:"Daily";s:8:"schedule";a:5:{s:4:"hour";s:2:"09";s:6:"minute";s:2:"00";s:4:"ampm";s:2:"AM";s:9:"dayofweek";s:1:"1";s:10:"dayofmonth";s:1:"1";}}s:6:"DGHg2a";a:10:{s:7:"address";s:17:"192.168.232.20/16";s:15:"exclude_address";s:0:"";s:12:"os_detection";s:2:"on";s:18:"topology_detection";s:2:"on";s:10:"system_dns";s:2:"on";s:9:"initiator";s:11:"nagiosadmin";s:10:"start_date";i:1539374977;s:9:"scandelay";s:0:"";s:9:"frequency";s:4:"Once";s:8:"schedule";a:5:{s:4:"hour";s:2:"09";s:6:"minute";s:2:"00";s:4:"ampm";s:2:"AM";s:9:"dayofweek";s:1:"1";s:10:"dayofmonth";s:1:"1";}}s:6:"sOpXf2";a:10:{s:7:"address";s:17:"192.168.232.21/16";s:15:"exclude_address";s:0:"";s:12:"os_detection";s:2:"on";s:18:"topology_detection";s:2:"on";s:10:"system_dns";s:2:"on";s:9:"initiator";s:11:"nagiosadmin";s:10:"start_date";i:1539375005;s:9:"scandelay";s:0:"";s:9:"frequency";s:5:"Daily";s:8:"schedule";a:5:{s:4:"hour";s:2:"09";s:6:"minute";s:2:"02";s:4:"ampm";s:2:"AM";s:9:"dayofweek";s:1:"1";s:10:"dayofmonth";s:1:"1";}}}
You can take a look at what it un-serializes to uses this:

https://www.unserialize.com
matt.lilek
Posts: 137
Joined: Wed Aug 07, 2013 11:53 am

Re: How do i remove Autodiscovery Jobs Completely from CMD

Post by matt.lilek »

Mr. Sax, so we meet again.

I was really hoping you were going to have an out for me on this. Not much more that i can say that i have not said already on this. Maybe one day when everything in Nagios is Green and i got nothing to do for hours on end ill start hitting the red X. ;) . Thanks for the reply and try to have a good weekend.

Talk soon,

Matt
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: How do i remove Autodiscovery Jobs Completely from CMD

Post by ssax »

What about if we deleted them all and then had you just recreate the ones you want, would that work for you or do you have a ton of them that you'd have to recreate?
Locked