Core config import - graphs needed
Core config import - graphs needed
Hello
I imported config files + scripts from a 3.5 Core instance using prep tool. Everything works nicely, but the old commands+their checks(scripts) doesn't create graphs, lets say for memory, cpu, disk. Now i can run a SNMP check on each host and create new duplicate service checks but this way i need to modify all the new services for check periods, servicegroups, contacts, etc. Having over few thousands services makes this huge work.
So my question: Is there a way to copy check settings and alarms settings from one service to another?
Mirgo
I imported config files + scripts from a 3.5 Core instance using prep tool. Everything works nicely, but the old commands+their checks(scripts) doesn't create graphs, lets say for memory, cpu, disk. Now i can run a SNMP check on each host and create new duplicate service checks but this way i need to modify all the new services for check periods, servicegroups, contacts, etc. Having over few thousands services makes this huge work.
So my question: Is there a way to copy check settings and alarms settings from one service to another?
Mirgo
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Core config import - graphs needed
What does the full command and output look like when run from the CLI?
Previous Nagios employee
Re: Core config import - graphs needed
I'll make example of linux disk and memory checks:
With old Core scripts:
/usr/local/nagios/libexec/check_nix_disk_snmp -w 1000 -c 500 -h 0.0.0.0 -s somecommunity /
DISK OK [10893 MB 70% free on 0.0.0.0:/]
/usr/local/nagios/libexec/check_nix_mem_snmp -w 95,0 -c 98,0 -H 0.0.0.0 -C somecommunity -2
Ram : 46%, Swap : 1% : ; OK
Created with Nagios XI wizard:
/usr/local/nagios/libexec/check_snmp_storage_wizard.pl -H 0.0.0.0 -C somecommunity --v2c -m "^/$" -w 80 -c 95 -f
/: 28%used(4524MB/15998MB) (<80%) : OK | '/'=4524MB;12798;15198;0;15998
/usr/local/nagios/libexec/check_snmp_storage_wizard.pl -H 0.0.0.0 -C somecommunity --v2c -m Memory -w 80 -c 90 -f
Memory buffers: 18%used(356MB/2002MB) (<80%) : OK | 'Memory_buffers'=356MB;1601;1801;0;2002
So question is:
Can i somehow copy service settings (common/check/alert) to another service?
Or somehow replace all the check commands and arguments on old services with commands/arguments created by XI wizard?
I have almost 3000 services, so doing one by one and replacing all the service settings is not really an option.
With old Core scripts:
/usr/local/nagios/libexec/check_nix_disk_snmp -w 1000 -c 500 -h 0.0.0.0 -s somecommunity /
DISK OK [10893 MB 70% free on 0.0.0.0:/]
/usr/local/nagios/libexec/check_nix_mem_snmp -w 95,0 -c 98,0 -H 0.0.0.0 -C somecommunity -2
Ram : 46%, Swap : 1% : ; OK
Created with Nagios XI wizard:
/usr/local/nagios/libexec/check_snmp_storage_wizard.pl -H 0.0.0.0 -C somecommunity --v2c -m "^/$" -w 80 -c 95 -f
/: 28%used(4524MB/15998MB) (<80%) : OK | '/'=4524MB;12798;15198;0;15998
/usr/local/nagios/libexec/check_snmp_storage_wizard.pl -H 0.0.0.0 -C somecommunity --v2c -m Memory -w 80 -c 90 -f
Memory buffers: 18%used(356MB/2002MB) (<80%) : OK | 'Memory_buffers'=356MB;1601;1801;0;2002
So question is:
Can i somehow copy service settings (common/check/alert) to another service?
Or somehow replace all the check commands and arguments on old services with commands/arguments created by XI wizard?
I have almost 3000 services, so doing one by one and replacing all the service settings is not really an option.
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Core config import - graphs needed
There is the bulk modification tool, but I think you may be better served by creating a service template then referencing that in your service. Templates can be pretty powerful, here is some documentation on those:Can i somehow copy service settings (common/check/alert) to another service?
https://assets.nagios.com/downloads/nag ... tance.html
https://support.nagios.com/kb/article.php?id=508
Previous Nagios employee
Re: Core config import - graphs needed
I don't think the templates help me in this case. As we have many contacts to send notifications to and often the notifications are sent to different persons within one host services. So creating an universal templates dont work in our case. My idea is either to do a bulk modification, switch the command/arguments from old Core checks to new XI checks but leave everything else the same. Is that possible? If not, then it would be good if i could somehow copy service settings (common/check/alert) from one service to another.
If those are not doable via XI, can i do that somehow via command line?
If those are not doable via XI, can i do that somehow via command line?
Re: Core config import - graphs needed
The Bulk Modifications tool wouldn't allow you to alter the check command definitions for services. Mostly because bulk modifying check commands can be incredibly dangerous and has pretty vast implications that would be difficult to account for. There also wouldn't be any way to account for specific thresholds within the Bulk Modifications tool.
You also use the back-end REST API. Essentially, you would use the REST API to get the service object, change the check_command, delete the old object, then re-create the new service object with all the same settings except for a different check_command. This would still be a non-trivial amount of work though since the arguments of the plugin need to be preserved/parsed. One of the downsides of accepting any and all plugins is Nagios doesn't really have a concept of what the plugin does or accepts as arguments; It just reads stdout and the unix exit code.
You also use the back-end REST API. Essentially, you would use the REST API to get the service object, change the check_command, delete the old object, then re-create the new service object with all the same settings except for a different check_command. This would still be a non-trivial amount of work though since the arguments of the plugin need to be preserved/parsed. One of the downsides of accepting any and all plugins is Nagios doesn't really have a concept of what the plugin does or accepts as arguments; It just reads stdout and the unix exit code.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Core config import - graphs needed
Ok, as i understand there is no easy way to do a replace commands or service settings nor can i just modify the .conf files.
Another idea what i got is that the XI instance isn't in live and i haven't put too much work into it yet, just to delete all the hosts + services. Take the nagios core conf files that prep tool prepared and use a script to replace the commands there.
Ok, so did few tests on that and no positive result, please give me some feedback. So, i took 1 host with its service check from Core, prep'd that, then replaced Core commands with XI ones and imported the config files.
check_linux_disk_snmp!1000!500!/ -> check_xi_service_snmp_linux_storage! -C somecommunity --v2c -m "^/$" -w 80 -c 95 -f
check_linux_load!9,8,7!10,9,8 -> check_xi_service_snmp_linux_load! -C somecommunity --v2c -w 80 -c 90 -f
check_linux_mem!95,0!98,0 -> check_xi_service_snmp_linux_storage! -C somecommunity --v2c -m Memory -w 80 -c 90 -f
And it still doesnt create graphs this way(it does give correct output). Can someone give info why is that? My thought was that old CORE commands and scripts were the problem but it seems that there is something else that is controlling if graph is generated or not.
Another idea what i got is that the XI instance isn't in live and i haven't put too much work into it yet, just to delete all the hosts + services. Take the nagios core conf files that prep tool prepared and use a script to replace the commands there.
Ok, so did few tests on that and no positive result, please give me some feedback. So, i took 1 host with its service check from Core, prep'd that, then replaced Core commands with XI ones and imported the config files.
check_linux_disk_snmp!1000!500!/ -> check_xi_service_snmp_linux_storage! -C somecommunity --v2c -m "^/$" -w 80 -c 95 -f
check_linux_load!9,8,7!10,9,8 -> check_xi_service_snmp_linux_load! -C somecommunity --v2c -w 80 -c 90 -f
check_linux_mem!95,0!98,0 -> check_xi_service_snmp_linux_storage! -C somecommunity --v2c -m Memory -w 80 -c 90 -f
And it still doesnt create graphs this way(it does give correct output). Can someone give info why is that? My thought was that old CORE commands and scripts were the problem but it seems that there is something else that is controlling if graph is generated or not.
Re: Core config import - graphs needed
Can you PM (or attach to your post) a system profile? From the Nagios XI GUI, you can gather a profile via Admin -> System Profile -> Download Profile.
Can you also share the outputs of these commands:
Can you also share the outputs of these commands:
Code: Select all
ls /usr/local/nagios/var/spool/perfdata/ | wc -l
ls /usr/local/nagios/var/spool/xidpe/ | wc -l
service npcd status
ls -lrt /usr/local/nagios/share/perfdataFormer Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Core config import - graphs needed
ls /usr/local/nagios/var/spool/perfdata/ | wc -l = 0
ls /usr/local/nagios/var/spool/xidpe/ | wc -l = 0
service npcd status = NPCD running (pid 514)
ls -lrt /usr/local/nagios/share/perfdata = not posting the outcome as this holds the list of servers, but there are 679 files there
And i can't post the system profile to a open forum.
Overall the graphs are generated if i create checks from scratch with XI wizards and even some old Core checks that have been imported are generating graphs, but the ones i need the most, are not, like disk or memory.
ls /usr/local/nagios/var/spool/xidpe/ | wc -l = 0
service npcd status = NPCD running (pid 514)
ls -lrt /usr/local/nagios/share/perfdata = not posting the outcome as this holds the list of servers, but there are 679 files there
And i can't post the system profile to a open forum.
Overall the graphs are generated if i create checks from scratch with XI wizards and even some old Core checks that have been imported are generating graphs, but the ones i need the most, are not, like disk or memory.
Re: Core config import - graphs needed
Found a solution. Deleted all services from XI, Core confs had value process_perf_data that needs to be enabled and some Core scripts don't create graphs. Those needed to be changed in core service configuration files. Once the core conf files were modified and prep'd, imported those and voila, graphs were done.