Solaris 2.9 box

voodooo

01-03-2005 11:53:18

I'm Trying to install netmrg 0.18.2 on a solaris 2.9 box but i hang up in a few problems, when i run netmrg_cron.sh with ./netmrg_cron.sh it gave me
"./netmrg_cron.sh syntax error at line 24 `rundiff=$' unexpected"

netmrg_cron.sh

22 if [ -e $lockfile ] ; then
23 lastrun=`cat $lockfile`;
24 rundiff=$(($curdate - $lastrun));
25 echo "NetMRG died on its run $rundiff seconds ago. I'll remove the lockfile" | mail -s "NetMRG died at $lastrun" $mailto
26 mv -f $output $output.$lastrun
27 mv -f $error $error.$lastrun
28 rm -f $lockfile

So i haven't croned it yet.

Other thing is my netmrg-gatherer script ./netmrg-gatherer -a

[L 0032, C 0001] NetMRG starting.
[L 0128, C 0002] Locking Settings
[L 0128, C 0002] Unlocking Settings
[L 0064, C 0001] Creating Lockfile.
[L 0128, C 0002] Locking Settings
[L 0128, C 0002] Unlocking Settings
[L 0064, C 0257] Initializing SNMP library.
[L 0064, C 0129] Initializing RRDTOOL pipe.
[L 0128, C 0002] Locking Settings
[L 0128, C 0002] Unlocking Settings
.....
[L 0128, C 0002] Unlocking Settings
[L 0128, C 0002] Unlocking MySQL
[L 0128, C 1024] Mysql Query Succeeded. (SELECT version FROM versioninfo WHERE module = 'Main')
[L 0128, C 1024] Mysql Query Succeeded. (SELECT id FROM devices WHERE disabled=0 ORDER BY id)
[L 0128, C 0002] Locking Settings
[L 0128, C 0002] Unlocking Settings
[L 0128, C 0002] Locking ActiveThreads
[L 0064, C 0002] [ACTIVE] Last 0, Now 0
[L 0032, C 0004] [Dev 0001] Starting device thread at %F 163536.
[L 0128, C 0002] Locking Settings
[L 0128, C 0002] Unlocking Settings
....
[L 0128, C 0002] Unlocking Settings
[L 0128, C 0002] Unlocking MySQL
[L 0008, C 1024] MySQL Connection Failure. (Can't connect to MySQL server on 'xxx.xxx.xx.x' (0))
[L 0128, C 0002] Locking ActiveThreads
[L 0128, C 0002] Unlocking ActiveThreads
[L 0032, C 0002] Thread Ended.
[L 0128, C 0002] Unlocking ActiveThreads
[L 0064, C 0001] Closed MySQL connection.
[L 0064, C 0001] Runtime 0
[L 0128, C 0002] Locking Settings
[L 0128, C 0002] Unlocking Settings
[L 0064, C 0129] Closed RRDTOOL pipe.
[L 0064, C 0257] Cleaned up SNMP.
[L 0128, C 0002] Locking Settings
[L 0128, C 0002] Unlocking Settings

it seems to me that a query has succeed "Mysql Query Succeeded. (SELECT version FROM versioninfo WHERE module = 'Main')" so he connects to the DB but then the connection fails...

i'v allready tryed with -H -u -p -C flags but it gave me the same error... Help please... tks in advance

balleman

04-03-2005 18:25:32

Regarding the first problem... have you tried using bash instead of sh to run the script?

Regarding the second... what version of MySQL are you using? You might want to look at MySQL logs to see if it knows why the connection failed.

voodooo

07-03-2005 10:30:30

Tks for the hellp,

I'v tryed with kornshell, bash and sh shells and the script allways gave me the same error...

# ./netmrg_cron.sh
./netmrg_cron.sh syntax error at line 24 `rundiff=$' unexpected
# bash
bash-2.05# ./netmrg_cron.sh
./netmrg_cron.sh syntax error at line 24 `rundiff=$' unexpected
bash-2.05$ ksh
$ ./netmrg_cron.sh
./netmrg_cron.sh syntax error at line 24 `rundiff=$' unexpected

Mysql Ver 14.7 Distrib 4.1.10, for sun-solaris2.9 (sparc), you were tallking about client logs or server logs ? i'm a bit noob in mysql.
tks a lot!

silfreed

07-03-2005 11:39:45

To run the script [i9df6926851]using[/i9df6926851] bash, you have to preceed the script with 'bash' like so
[code19df6926851]$ bash netmrg_cron.sh[/code19df6926851]

Regarding MySQL stuff, have you verified that you can connect the the database with the username and password in netmrg.xml?
[code19df6926851]mysql -H <ip_address> -u <netmrg_user> -p netmrg
Enter password: <netmrg_pass>[/code19df6926851]

-Doug

voodooo

08-03-2005 07:05:39

yes, i'v allready tryed that

"bash-2.05$ netmrg_cron.sh
/usr/local/bin/netmrg_cron.sh syntax error at line 24 `rundiff=$' unexpected"

and

"bash-2.05$ mysql -h 192.168.40.6 -u netmrg -p netmrg
Enter password
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3591417 to server version 4.0.18-standard-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> quit
Bye"

I can make querys, view tables etc, mysql is working, the netmrg-gather make a sucefull query
"L 0128, C 1024] Mysql Query Succeeded. (SELECT version FROM versioninfo WHERE module = 'Main')
[L 0128, C 1024] Mysql Query Succeeded. (SELECT id FROM devices WHERE disabled=0 ORDER BY id) "

but then the connection fails
"[L 0008, C 1024] MySQL Connection Failure. (Can't connect to MySQL server on '192.168.40.6' (0)) "

tks for the help... i'v allready spend all my ideas

voodooo

08-03-2005 07:12:05

sorry my ignorance you mean runnign the script like this "$ bash netmrg_cron.sh" yes it works, no errors returned so now i can cron it. tks a lot D

voodooo

09-03-2005 06:19:11

Regarding to mysql "long time no luck.."

bash-2.05$ ./netmrg-gatherer -sm
NetMRG starting.
Creating Lockfile.
Initializing SNMP library.
Initializing RRDTOOL pipe.
[ACTIVE] Last 0, Now 0
[Dev 0002] Starting device thread at %F 110902.
MySQL Connection Failure. (Can't connect to MySQL server on '192.168.40.6' (0))
Thread Ended.
[Dev 0003] Starting device thread at %F 110902.
MySQL Connection Failure. (Can't connect to MySQL server on '192.168.40.6' (0))
Thread Ended.
[PASSIVE] Last 0, Now 0
Closed MySQL connection.
Runtime 0
Closed RRDTOOL pipe.
Cleaned up SNMP.

But with mysql client i can connect to the DB

bash-2.05$ mysql -h 192.168.40.6 -u netmrg -p
Enter password
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3652964 to server version 4.0.18-standard-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> quit
Bye

If anyone could help tks..

silfreed

10-03-2005 12:25:31

Do you have some sort of connection limit that you're reaching on you MySQL server? To find out, login to mysql, and issue the following command and let us know the output

[code168d44dc498]mysql> show variables like '%connection%';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| max_connections | 100 |
| max_user_connections | 0 |
+----------------------+-------+
2 rows in set (0.03 sec)[/code168d44dc498]

-Doug

voodooo

11-03-2005 11:23:43

Here is it

mysql> show variables like '%connection%';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| max_connections | 100 |
| max_user_connections | 0 |
+----------------------+-------+
2 rows in set (0.01 sec)

Manager SNMP

bash-2.05$ snmpget -V
NET-SNMP version 5.2.1
bash-2.05$ snmpget -v 2c -c <community> 192.168.40.8 sysUpTime.0
SNMPv2-MIBsysUpTime.0 = Timeticks (71702) 01157.02

Host SNMP

bash-2.03# snmpget -V
NET-SNMP version 5.0.8
bash-2.03# snmpget -v 2c -c <community> 192.168.13.100 sysUpTime.0
DISMAN-EVENT-MIBsysUpTimeInstance = Timeticks (107681) 01756.81

my manager and client snmp is up and running.

netmrg_cron.sh doesn't give any erros
bash-2.05$ bash netmrg_cron.sh


So now i only have this problem, i have tryed to remove my netmrg DB from server and re-run the script to create the DB again mysql -h xxx.xxx.xx.xx -u netmrg -pnetmrg < netmrg.mysql
After this the gatherer doesn't gave any erros but if i add a group and a sub-device to monitor, when e re-run the gatherer he gave me this output

bash-2.05$ ./netmrg-gatherer -sm
NetMRG starting.
Creating Lockfile.
Initializing SNMP library.
Initializing RRDTOOL pipe.
[ACTIVE] Last 0, Now 0
[Dev 0004] Starting device thread at %F 160541.
MySQL Connection Failure. (Can't connect to MySQL server on '192.168.40.6' (0))
Thread Ended.
Closed MySQL connection.
Runtime 0
Closed RRDTOOL pipe.
Cleaned up SNMP.

tks for your help

silfreed

11-03-2005 11:33:59

Sorry; I'm starting to run out of ideas. I doubt this is a problem in NetMRG, and more likely something in your configuration or network somewhere that is blocking the connection attempts.
If you're up to it, I would try doing some packet captures and make sure everything is talking correctly. If you have problems I'd look to make sure you don't have any firewalls that might be blocking traffic somewhere. Sorry I can't be of more help!

-Doug

voodooo

14-03-2005 12:36:49

well i solve the problem by installing a mysql server on my netmrg localhost, don't know why the gatherer fails connecting to a remote mysql server...

tks for you help