Problem developing plugin


#1

I’m trying to develop a plugin for looking a folder size but I’ve some problems:
using bash scripts if I try to print a variable which have got its content from a file (for example varia=$(cat myFile.txt))
on the nagios server (using nrpe) it print nothing; using C it says:
unable to read output

These are my scripts:

check_vhost2.sh
#!/bin/bash
./check_vhostc
cia=$(cat check_vhost.txxt)
rm -f check_vhost.txxt
echo "$cia _"


check_vhostc.c
int main()
{
       char utile[300],ut[150];
       FILE *fp;
       system("./check_vhost.sh");
       fp=fopen("check_vhost.txxt","r");
       fscanf(fp,"%s",utile);
       strcat(utile," ");
       strcat(utile,ut);
       fclose(fp);
       /*system("rm -f check_vhost.txxt");
       printf(",utile");*/
       return 0;
}


check_vhost.sh
#!/bin/bash
du -h -l /var/www/vhosts/ribind.it > check_vhost.txt
tail -n 1 check_vhost.txt > check_vhost.txxt
rm -f check_vhost.txt


I use those lines commented if I call the script, and uncommented using directly the compiled program


#2

can’t help… but this could be what you are looking for:
exchange.nagios.org/index2.php?o … &Itemid=74