Nagios Core 4 and EM01B sensor

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Nagios Core 4 and EM01B sensor

Postby Nagalot » Fri May 25, 2018 3:52 am

Dear Nagios community,

I've just finished installing Nagios Core 4 I'm now trying to install the plugin for the EM01B web sensor https://www.siretta.co.uk/lan-temperature-humidity-light-sensor_p_1225.php

When I run the compile command as per the install guide I get the errors listed below. Has anyone managed to install this successfully on Nagios 4? can you point me in the right direction please?

Thanks for the help,
Ash

Code: Select all
check_em01.c: In function ‘INThandler’:
check_em01.c:258:6: warning: implicit declaration of function ‘alarm’ [-Wimplici                                                                                                                               t-function-declaration]
      alarm(CONNECT_TIMEOUT);
      ^
check_em01.c: At top level:
check_em01.c:263:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
main(int argc, char **argv)
^
check_em01.c: In function ‘main’:
check_em01.c:277:3: warning: implicit declaration of function ‘print_help’ [-Wim                                                                                                                               plicit-function-declaration]
   print_help();
   ^
check_em01.c:299:4: warning: implicit declaration of function ‘usleep’ [-Wimplic                                                                                                                               it-function-declaration]
    usleep(5000);
    ^
check_em01.c:321:12: warning: implicit declaration of function ‘toupper’ [-Wimpl                                                                                                                               icit-function-declaration]
    switch (toupper(argv[2][0])){
            ^
check_em01.c:323:3: warning: implicit declaration of function ‘write’ [-Wimplici                                                                                                                               t-function-declaration]
   write(s, "GET /index.html?eR HTTP/1.1\r\nUser-Agent: EsensorsPlugin\r\nHost:
   ^
check_em01.c:344:7: warning: implicit declaration of function ‘read’ [-Wimplicit                                                                                                                               -function-declaration]
   l = read(s, iobuf, sizeof(iobuf));
       ^
check_em01.c:490:12: warning: unknown conversion type character ‘|’ in format [-                                                                                                                               Wformat=]
     printf("(No limits specified) %s% | Humid=%3.2f\n", datachar, data);
            ^
check_em01.c:494:12: warning: unknown conversion type character ‘|’ in format [-                                                                                                                               Wformat=]
     printf("CRITICAL ( %s< or >%s ) Humidity: %s% | Humid=%3.2f\n", argv[5], ar
            ^
check_em01.c:498:12: warning: unknown conversion type character ‘|’ in format [-                                                                                                                               Wformat=]
     printf("WARNING ( %s< or >%s ) Humidity: %s% | Humid=%3.2f\n", argv[3], arg
            ^
check_em01.c:502:12: warning: unknown conversion type character ‘|’ in format [-                                                                                                                               Wformat=]
     printf("OK Humidity: %s% | Humid=%3.2f\n", datachar, data);
            ^
check_em01.c:546:23: warning: too many arguments for format [-Wformat-extra-args                                                                                                                               ]
       fprintf(stderr, "Could not reset contact closure", NetErrStr());
                       ^
check_em01.c: In function ‘print_help’:
check_em01.c:638:2: warning: implicit declaration of function ‘print_usage’ [-Wi                                                                                                                               mplicit-function-declaration]
  print_usage ();
Attachments
check_em01.c
Plugin file
(16.41 KiB) Downloaded 84 times
Nagalot
 
Posts: 3
Joined: Fri May 25, 2018 3:39 am

Re: Nagios Core 4 and EM01B sensor

Postby mcapra » Fri May 25, 2018 10:51 am

Those look like compiler warnings, not errors. Have they prevented you from leveraging this plugin in some way? If so, which operating system are you attempting to compile this plugin on?

I didn't encounter any particular problems building the file you attached:
Code: Select all
[root@capra_nag tmp]# gcc -Wall check_em01.c -o check_em01
check_em01.c: In function ‘myatof’:
check_em01.c:206:3: warning: value computed is not used [-Wunused-value]
   *s++;
   ^
check_em01.c: In function ‘connectWebsensor’:
check_em01.c:234:6: warning: unused variable ‘i’ [-Wunused-variable]
  int i;
      ^
check_em01.c: In function ‘INThandler’:
check_em01.c:258:6: warning: implicit declaration of function ‘alarm’ [-Wimplicit-function-declaration]
      alarm(CONNECT_TIMEOUT);
      ^
check_em01.c: At top level:
check_em01.c:263:1: warning: return type defaults to ‘int’ [-Wreturn-type]
main(int argc, char **argv)
^
check_em01.c: In function ‘main’:
check_em01.c:277:3: warning: implicit declaration of function ‘print_help’ [-Wimplicit-function-declaration]
   print_help();
   ^
check_em01.c:299:4: warning: implicit declaration of function ‘usleep’ [-Wimplicit-function-declaration]
    usleep(5000);
    ^
check_em01.c:321:4: warning: implicit declaration of function ‘toupper’ [-Wimplicit-function-declaration]
    switch (toupper(argv[2][0])){
    ^
check_em01.c:323:3: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
   write(s, "GET /index.html?eR HTTP/1.1\r\nUser-Agent: EsensorsPlugin\r\nHost: localhost\r\n\r\n", 77);
   ^
check_em01.c:344:3: warning: implicit declaration of function ‘read’ [-Wimplicit-function-declaration]
   l = read(s, iobuf, sizeof(iobuf));
   ^
check_em01.c:490:5: warning: unknown conversion type character ‘|’ in format [-Wformat=]
     printf("(No limits specified) %s% | Humid=%3.2f\n", datachar, data);
     ^
check_em01.c:494:5: warning: unknown conversion type character ‘|’ in format [-Wformat=]
     printf("CRITICAL ( %s< or >%s ) Humidity: %s% | Humid=%3.2f\n", argv[5], argv[6], datachar, data);
     ^
check_em01.c:498:5: warning: unknown conversion type character ‘|’ in format [-Wformat=]
     printf("WARNING ( %s< or >%s ) Humidity: %s% | Humid=%3.2f\n", argv[3], argv[4], datachar, data);
     ^
check_em01.c:502:5: warning: unknown conversion type character ‘|’ in format [-Wformat=]
     printf("OK Humidity: %s% | Humid=%3.2f\n", datachar, data);
     ^
check_em01.c:546:7: warning: too many arguments for format [-Wformat-extra-args]
       fprintf(stderr, "Could not reset contact closure", NetErrStr());
       ^
check_em01.c:271:9: warning: unused variable ‘start_time’ [-Wunused-variable]
  time_t start_time, cur_time;
         ^
check_em01.c:270:22: warning: unused variable ‘calc_checksum’ [-Wunused-variable]
  char rcvd_checksum, calc_checksum;
                      ^
check_em01.c:270:7: warning: unused variable ‘rcvd_checksum’ [-Wunused-variable]
  char rcvd_checksum, calc_checksum;
       ^
check_em01.c:265:16: warning: unused variable ‘i’ [-Wunused-variable]
  int l, retry, i, random_backoff;
                ^
check_em01.c: In function ‘print_help’:
check_em01.c:638:2: warning: implicit declaration of function ‘print_usage’ [-Wimplicit-function-declaration]
  print_usage ();
  ^


Same warnings, but no problems using the binary:
Code: Select all
[root@capra_nag tmp]# ./check_em01
Copyright (c) 2005-2009 Esensors, Inc <TechHelp@eEsensors.com>
This plugin is written mainly for Nagios/Cacti/RRDTool, but can work standalone too.
It returns the HVAC data from the EM01 Websensor

usage:
./check_em01 [hostname] [T/H/I] [LowWarning HighWarning LowCritical HighCritical]

Only the hostname is mandatory. The rest of the arguments are optional
T is for Temperature data, H for Humidity Data and I for Illumination data
Examples:
This will return all HVAC data:
./check_em01 192.168.0.2

This will return only Illumination data:
./check_em01 192.168.0.2 I

This will return temperature data with status:
./check_em01 192.168.0.2 T 65 85 60 90

This will return humidity data with status:
./check_em01 192.168.0.2 H 25.5 50 15 70.5

This will return Cacti/RRDTool format:
./check_em01 192.168.0.2 G

For further information, please refer to the README file included with the package
or available for download from http://www.eesensors.com
Former Nagios employee
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 3423
Joined: Thu May 05, 2016 3:54 pm

Re: Nagios Core 4 and EM01B sensor

Postby scottwilkerson » Fri May 25, 2018 12:37 pm

thanks @mcapra
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12041
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Nagios Core 4 and EM01B sensor

Postby Nagalot » Tue Jun 12, 2018 4:11 am

Thank you for the help, it seems to be working now.

With what you said in mind, I removed all my config files and installed the plugin a second time. This time I just modified the files provided by Siretta and it seems to now register the readings in Nagios.

Plugin was compiled on Ubuntu Server 16.04.

Thanks again,
Ash
Nagalot
 
Posts: 3
Joined: Fri May 25, 2018 3:39 am

Re: Nagios Core 4 and EM01B sensor

Postby tmcdonald » Tue Jun 12, 2018 11:28 am

Did you have further (related) questions or are we good to lock this up?
Former Nagios employee
tmcdonald
 
Posts: 9118
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Core 4 and EM01B sensor

Postby Nagalot » Wed Jun 13, 2018 6:02 pm

Please close thread.

Thanks
Nagalot
 
Posts: 3
Joined: Fri May 25, 2018 3:39 am

Re: Nagios Core 4 and EM01B sensor

Postby scottwilkerson » Thu Jun 14, 2018 9:02 am

Glad to hear it is solved.

Locking
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12041
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core

Who is online

Users browsing this forum: Exabot [Bot] and 15 guests