auxiliar.h 794 Bytes
//
// Created by Imanol on 28-may-16.
//

#ifndef NAGIOS_PLUGINS_AUXILIAR_H
#define NAGIOS_PLUGINS_AUXILIAR_H

#include <sstream>
#include <iostream>
#include <exception>
#include <vector>

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>

using namespace std;

extern char *servicename;

int str2int(string str);
string int2str(int x);
int exec(string cmd, string *output);
void timer_handler (int signum);
void split(const string &s, const char* delim, vector<string> & v);

class integerConversionException : public exception
{
private:
    string s;
public:
    integerConversionException(std::string ss) : s(ss) {}
    ~integerConversionException() throw () {}
    const char* what() const throw() { return s.c_str(); }
};

#endif //NAGIOS_PLUGINS_AUXILIAR_H