|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
//
// Created by Imanol on 28-may-16.
//
#ifndef NAGIOS_PLUGINS_AUXILIAR_H
#define NAGIOS_PLUGINS_AUXILIAR_H
#include <sstream>
#include <iostream>
#include <exception>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
extern const char *servicename;
int str2int(const std::string& str);
std::string int2str(const int x);
double str2double(const std::string& str);
std::string double2str(const double x);
bool starts_with(const std::string& value, const std::string& begin);
bool ends_with(const std::string& value, const std::string& ending);
int exec(const std::string& cmd, std::string& output);
void timer_handler(int signum);
class ConversionException : public std::exception
{
private:
std::string s;
public:
ConversionException(std::string ss) : s(ss) {}
~ConversionException() throw () {}
const char* what() const throw() { return s.c_str(); }
};
#endif //NAGIOS_PLUGINS_AUXILIAR_H
|