This support forum board is for support questions relating to
Nagios XI , our flagship commercial network monitoring solution.
bennyboy
Posts: 157 Joined: Thu Oct 29, 2015 9:42 am
Post
by bennyboy » Wed Jan 11, 2017 3:40 pm
Hi,
I try to use the API to create couple host and use template for Notification setting. When I try to create it I have error: missing required variables.
Do you have a workaround to force that type of usage please.
Code: Select all
curl -XPOST "http://slpmon0034/nagiosxi/api/v1/config/host?apikey=APIKEY&pretty=1" -d "host_name=sldlog0398&address=172.26.14.7&use=xiwizard_linuxserver_host&max_check_attempts=5&check_intervalcheck_interval=5&retry_interval=1&check_period=xi_timeperiod_24x7&icon_imageicon_image=redhat.pngredhat.png&statusmap_image=redhat.png&_xiwizard=linux-server&&applyconfig=1"
{
"error": "Missing required variables",
"missing": [
"notification_interval",
"notification_period",
"contacts OR contact_groups"
]
}
Thank you!!
rkennedy
Posts: 6579 Joined: Mon Oct 05, 2015 11:45 am
Post
by rkennedy » Wed Jan 11, 2017 3:54 pm
Take a look at the attachment for a document I wrote that's really helpful in regards to the API.
Nagios-Automating-with-Nagios-XI.zip
What version of XI are you running?
The template
xiwizard_linuxserver_host does NOT have any notification information set, but the template assigned to it does - what happens if you use the direct
xiwizard_generic_host ?
You do not have the required permissions to view the files attached to this post.
Former Nagios Employee
bennyboy
Posts: 157 Joined: Thu Oct 29, 2015 9:42 am
Post
by bennyboy » Wed Jan 11, 2017 6:39 pm
XI 5.4.0
Code: Select all
curl -XPOST "http://slpmon0034/nagiosxi/api/v1/config/host?apikey=APIKEY&pretty=1" -d "host_name=sldlog0398&address=172.26.14.7&use=xiwizard_generic_host&max_check_attempts=5&check_intervalcheck_interval=5&retry_interval=1&check_period=xi_timeperiod_24x7&icon_imageicon_image=redhat.pngredhat.png&statusmap_image=redhat.png&_xiwizard=linux-server&applyconfig=1"
{
"error": "Missing required variables",
"missing": [
"notification_interval",
"notification_period",
"contacts OR contact_groups"
]
}
Same error
SteveBeauchemin
Posts: 524 Joined: Mon Oct 14, 2013 7:19 pm
Post
by SteveBeauchemin » Wed Jan 11, 2017 6:47 pm
You need to add...
To the curl statement if you are not supplying all the parameters.
I use templates heavily and do not use all the required parameters either. They are in a template and centrally controlled.
Good Luck!
Steve B
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
bennyboy
Posts: 157 Joined: Thu Oct 29, 2015 9:42 am
Post
by bennyboy » Wed Jan 11, 2017 7:02 pm
Thank you!!! It's working now
SteveBeauchemin wrote: You need to add...
To the curl statement if you are not supplying all the parameters.
I use templates heavily and do not use all the required parameters either. They are in a template and centrally controlled.
Good Luck!
Steve B
rkennedy
Posts: 6579 Joined: Mon Oct 05, 2015 11:45 am
Post
by rkennedy » Thu Jan 12, 2017 10:19 am
SteveBeauchemin wrote: You need to add...
To the curl statement if you are not supplying all the parameters.
I use templates heavily and do not use all the required parameters either. They are in a template and centrally controlled.
Good Luck!
Steve B
Thanks Steve!
@bennyboy - are we good to mark this one resolved?
Former Nagios Employee
bennyboy
Posts: 157 Joined: Thu Oct 29, 2015 9:42 am
Post
by bennyboy » Fri Jan 13, 2017 10:28 am
rkennedy wrote:
@bennyboy - are we good to mark this one resolved?
Yes!!!