You are here

Can I export / unload definitions from a opsview TEST environment and load/import those in Opsview production

4 posts / 0 new
Last post
EricDeRegt
EricDeRegt's picture
Can I export / unload definitions from a opsview TEST environment and load/import those in Opsview production

I am trying to find oud how we can unload/load Opsview definitions from one Opsview to another Opsview.

The utilities "opsview_rest" and "export_host_template" are able to export to JSON and put replace definitions, but in the json generated file there are references by attributes "name" and "ref" to attribute, checktype, hosttemplate, keyword, plugin, servicecheck, servicegroup and timeperiod!

On another Opsview environment those refences will not match, or are not resolved.

 

Is there a solution to clone selected defnitions from one Opsview to another Opsview?
 

Duncan Ferguson
dferguson's picture
In a word, yes.

In a word, yes.

Have a look at OpsPacks on https://knowledge.opsview.com/articles/opsview-monitor-500/423-opspacks.... to create your own on your test system and then import on your production one.

  Duncs

EricDeRegt
EricDeRegt's picture
The create_opspack and install_opspack do not include checks

<p>Base on the description I tries using /usr/local/nagios/bin/create_opspack and /usr/local/nagios/bin/install_opspack to migrate a host template ith all checks to another Opsview environment.</p>

<p>Sadly this does not work.</p>

<p>How can I create op opspack including also the service checks?</p>

smarsh
smarsh's picture
Hi Eric,

Hi Eric,

The Opspack does include checks thats the entire point :) If you look closely at the config.json of a host template converted into an Opspack, you will see something similar to this (taken from 'Application - Docker'): 

"hosttemplate" : [
  37       {
  38          "description" : "Apply this template to all servers running docker. Then add a 'DOCKER_CONTAINER' variable for each docker container you wish to monitor.",
  39          "has_icon" : "1431515750",
  40          "managementurls" : [],
  41          "name" : "Application - Docker",
  42          "servicechecks" : [
  43             {
  44                "event_handler" : null,
  45                "exception" : null,
  46                "name" : "Docker - Container CPU usage",
  47                "timed_exception" : null
  48             },
  49             {
  50                "event_handler" : null,
  51                "exception" : null,
  52                "name" : "Docker - Container memory usage",
  53                "timed_exception" : null
  54             },
  55             {
  56                "event_handler" : null,
  57                "exception" : null,
  58                "name" : "Docker - Container size",
  59                "timed_exception" : null
  60             },
  61             {
  62                "event_handler" : null,
  63                "exception" : null,
  64                "name" : "Docker - Container top output",
  65                "timed_exception" : null
  66             },
  67             {
  68                "event_handler" : null,
  69                "exception" : null,
  70                "name" : "Docker - Container uptime",
  71                "timed_exception" : null
  72             },
  73             {
  74                "event_handler" : null,
  75                "exception" : null,
  76                "name" : "Docker - List all containers",
  77                "timed_exception" : null
  78             },
  79             {
  80                "event_handler" : null,
  81                "exception" : null,
  82                "name" : "Docker - Overall status",
  83                "timed_exception" : null
  84             }
  85          ]
  86       }
  87    ],
  88    "servicecheck" : [
  89       {
  90          "alert_from_failure" : "1",
  91          "args" : "-H $HOSTADDRESS$ -c check_docker -a '-l CPU -C %DOCKER_CONTAINER% -c 95 -w 75 -t %DOCKER_OPTS:1% --port=%DOCKER_OPTS:2% --url_prefix=%DOCKER_OPTS:3%' -C '%NRPE_CERTIFICATES:1%' -k '%NRPE_CERTIFICATES:2%' -r '%NRPE_CERTIFICATES:3%'",
  92          "attribute" : {
  93             "name" : "DOCKER_CONTAINER"
  94          },
  95          "calculate_rate" : null,
  96          "cascaded_from" : null,
  97          "check_attempts" : "3",
  98          "check_freshness" : "0",
  99          "check_interval" : "300",
 100          "checktype" : {
 101             "name" : "Active Plugin"
 102          },
 103          "critical_comparison" : null,
 104          "critical_value" : null,
 105          "dependencies" : [],
 106          "description" : "Measures the CPU usage of each docker container on the Docker host",
 107          "event_handler" : "",
 108          "flap_detection_enabled" : "1",
 109          "freshness_type" : "renotify",
 110          "invertresults" : "0",
 111          "label" : null,
 112          "level" : 0,
 113          "markdown_filter" : "0",
 114          "name" : "Docker - Container CPU usage",
 115          "notification_interval" : "0",
 116          "notification_options" : "w,c,r,u,f",
 117          "oid" : null,
 118          "plugin" : {
 119             "name" : "check_nrpe"
 120          },
 121          "retry_check_interval" : "60",
 122          "sensitive_arguments" : "1",
 123          "servicegroup" : {
 124             "name" : "Application - Docker"
 125          },
 126          "snmptraprules" : [],
 127          "stale_state" : "0",
 128          "stale_text" : "",
 129          "stale_threshold_seconds" : "3600",
 130          "stalking" : "",
 131          "volatile" : "0",
 132          "warning_comparison" : null,
 133          "warning_value" : null
 134       },

Can you copy and paste the common you ran and the output?