NagiosXI host wizard - Bad Token (facepalm)
Posted: Thu Feb 13, 2020 9:59 am
I wanted to pass along a facepalm moment in installing NCPA client on new Linux machines. Might save some people from a headache.
I installed the rpm successfully. I edited the ncpa.conf file with our production community_string under the [api] section. I could see the service starts and runs fine, could even netcat the port from other boxes. But when I would try to add the host in NagiosXI via the wizard, I would inevitably get a Bad Token error in the pink box. Even trying from a browser yielded Bad Token!
After checking obvious things like routing or firewall, I got back to first principles. The problem ultimately was that a default template community_string exists in the api section below a block of comments that I didn't see in my editor. So when I added my community_string=ABCDEFG right under [api], it was getting clobbered by the template community_string=SOMETHINGELSE that's in the config file by default. Once I removed the template community_string and restarted the service, my NCPA agent answered just fine. Nagios added the host no problem.
I installed the rpm successfully. I edited the ncpa.conf file with our production community_string under the [api] section. I could see the service starts and runs fine, could even netcat the port from other boxes. But when I would try to add the host in NagiosXI via the wizard, I would inevitably get a Bad Token error in the pink box. Even trying from a browser yielded Bad Token!
After checking obvious things like routing or firewall, I got back to first principles. The problem ultimately was that a default template community_string exists in the api section below a block of comments that I didn't see in my editor. So when I added my community_string=ABCDEFG right under [api], it was getting clobbered by the template community_string=SOMETHINGELSE that's in the config file by default. Once I removed the template community_string and restarted the service, my NCPA agent answered just fine. Nagios added the host no problem.