Menu

#1 Patch to work with Nagios 3.0.2

open
nobody
None
5
2011-03-02
2011-03-02
Anonymous
No

I don't know what the difference is, but after a lil hacking around, I came up with the following patch.

Changes:
- JSON should be returned as an application/json mime-type
- hostgroupmember is not a object, changed to hostsmember
- servicegroupmember is not an object, changed to servicesmember

--- statusjson.c 2008-06-16 10:30:37.000000000 -0400
+++ statusjson.c 2011-03-01 17:57:19.000000000 -0500
@@ -146,7 +148,7 @@
get_time_string(&expire_time,date_time,(int)sizeof(date_time),HTTP_DATE_TIME);
printf("Expires: %s\r\n",date_time);

- printf("Content-type: text/json\r\n\r\n");
+ printf("Content-type: application/json\r\n\r\n");
printf("{");

@@ -163,7 +165,7 @@

void display_hostgroups () {
hostgroup * temp_hostgroup=NULL;
- hostgroupmember *temp_hostmember=NULL;
+ hostsmember *temp_hostmember=NULL;

printf("\"hostgroups\":{");
for(temp_hostgroup=hostgroup_list;temp_hostgroup!=NULL;temp_hostgroup=temp_hostgroup->next){
@@ -201,7 +203,7 @@

void display_servicegroups() {
servicegroup *temp_svg=NULL;
- servicegroupmember *temp_svgm=NULL;
+ servicesmember *temp_svgm=NULL;
printf("\"servicegroup\":{");
for(temp_svg=servicegroup_list;temp_svg!=NULL;temp_svg=temp_svg->next) {
printf("\"%s\":[",temp_svg->group_name);

Discussion


Log in to post a comment.