Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - BlackMamba

#1
General Support / Reports
July 11, 2013, 01:57:51 PM
Hi to all!
I'm trying to understand how Reports work and i followed step by step this guide just to start.
The part "Steps to teach your server to generate reports" goes right or, at least, I don't get any error but then, when I try to generate a report, I get a compilation error. The output I get is:

XXX@YYY:~/Reports# "/usr/bin/java" -cp "/opt/netxms/java-lib/report-generator.jar" org.netxms.report.Generator "/etc/netxmsd.conf" "/opt/xml-reports/daily.jrxml" "/opt/reports/daily.output"
Error: Could not find or load main class org.netxms.report.Generator

What am I doing wrong? Could someone suggest me a solution?
#2
Hi to all.
After configuring in the right way the ExternalParameterShellExec, here, I decided to run a test script and to collect the script's result using a DCI.
So, in my Data Collection Configuration I can set ProvaExternal as DCI collected by NetXMS Agent but the data type expected is different from the one I expect to obtain from the script (the script should return an int but Data Type in NetXMS is set as String). Anyway, this isn't the main issue. My script is written in perl. It should write a string on an hypothetical log file (already created) and, once the the file is closed, it should return an int but, opening the log file, I understood that nothing is written on the file. The standalone script works, I've tested it. My agent configuration file is:

MasterServers = XXX, YYY
EnableSubagentAutoload = yes
LogFile = /var/log/nxagentd.log
FileStore = /tmp
ListenAddress = 0.0.0.0
EnableActions = yes
SubAgent=portcheck.nsm

ExternalParameterShellExec=ProvaExternal:/PATH/WriteLog.pl


Instead, the script WriteLog.pl (now I'm trying without return value) is:

#!/usr/bin/perl
use Time::localtime;

open(LOG,">>", "/PATH/hdsl_monitoring_script.log");
print LOG ctime().":start test \n";
close LOG;

Still nothing written in "hdsl_monitoring_script.log". Any suggestions? What is going wrong?
#3
Hi to all!
I'm trying to set up the ExternalParameterShellExec in my NetXMS, but I'm having some issues in accomplish my goal. Before you ask, I already read this post and I followed the instructions in it, but I need help anyway.
First of all, I'm working on a test system, set up in this way:
1) A virtual machine, where NetXMS server and agent are installed.
2) A phisical local machine, where NetXMS consolle and agent are installed.
Just to test the ExternalParameterShellExec, I want to create a parameter in the phisical machine (2) which executes a Perl script. This script is very simple and executes a ls on the virtual machine using ssh. This is my perl script's code:

#!/usr/bin/perl

use Net::SSH::Perl;

my $host = "IP";
my $usr = "USER";
my $pwd = "PASSWORD";
my $ssh = Net::SSH::Perl->new($host);
my $command ="ls -l";
$ssh->login($usr,$pwd);
print+($ssh->cmd($command))[0], "\n";
__END__

This script works, I've tested it running it directly from unix shell in the local machine (2). So, as written in this post, i set up the local machine's agent to execute this script. Agent's config file is:

MasterServers = XXX, YYY
EnableSubagentAutoload = yes
LogFile = /var/log/nxagentd.log
FileStore = /tmp
ListenAddress = 0.0.0.0
EnableActions = yes
SubAgent=portcheck.nsm

ExternalParameterShellExec ProvaExternal:/PATH/ProvaSSH.pl

I execute the node's poll and then, in DCI, I expect to find ProvaExternal as parameter provided by the agent. But I can't find ProvaExternal anywhere in the DCI. What's the issue here? What am I doing wrong?

Thanks in advance for the help!
#4
Hi to all!

I'm trying to create a script for nxShell which will allow me to set the primary name of some hosts in my network. Both primary name to set and hostnames to be modified are stored in two files. I created this script:

# coding: utf-8

class SetPrimaryName:
def out(self):
i=0
PrimaryNames = open("/PATH/TO/FILE/PRIMARYNAME").readlines()
for nome in open("/PATH/TO/FILE/HOSTNAMESTOMODIFY").readlines():
nodo = session.findObjectByName(nome.strip())
primaryName = PrimaryNames[i]
if nodo:
nodeID =nodo.getObjectId()
print "To node %s with id %d I want to set Primary Name %s"%(nome.strip(), nodeID, primaryName)
modificatore = NXCObjectModificationData(nodeID)
print
modificatore.setPrimaryName(primaryName)
i+=1
spn = SetPrimaryName()
spn.out()


Everything works fine but nothing happens in NetXMS and the primary name of the selected hosts stays the same. Am I doing something wrong? My doubt is focused on "modificatore", because it's the second time I try to modify data already stored in NetXMS (does anyone remember my still unresolved problem posted here? ) but I'm unable to accomplish this goal.
Thanks in advance for the support!
#5
General Support / nxShell and jython[Solved]
May 29, 2013, 02:15:06 PM
Hi to all!

I'm sorry if this is the wrong section, but I didn't know where I had to open this topic!

I'm starting using nxShell just how it is suggested in the wiki. I'm trying to create a script which will let me set a custom attribute (End User Info) on some interfaces in some map's nodes. My problem is the setting of the modification data. I understood that I should use a Map imported from java.util, but I'm new in python programming so I'm having problem in setting the Constructor of the Map in the right way. Once I run the script I get a "java.lang.ArrayIndexOutOfBoundsException: -3". Here is my code:

# coding: utf-8
import csv
import time
from java.util import Map
from java.lang import String
class XXX:
def YYY(self):
listaNodi = []
listaNodi = session.getAllObjects()
for nodo in listaNodi:
IPlista = nodo.getPrimaryIP()
#print "IPlista: "+str(IPlista)
for infoIP in open("RIGHT/PATH/IP.txt").readlines():
#print "infoIP: "+infoIP
#time.sleep(0.2)
if str(IPlista) == infoIP:
for interface in nodo.getAllChilds(objects.GenericObject.OBJECT_INTERFACE):
ID = interface.getObjectId()
IDinterfaccia=str(ID)
#print "IDinterfaccia: "+IDinterfaccia
for interfaccia in open("RIGHT/PATH/INTERFACCIA.TXT").readlines():
#print "interfaccia: "+str(interfaccia)
if IDinterfaccia == interfaccia:
print "Sono in IDinterfaccia == interfaccia"
info = open("RIGHT/PATH/EndUserInfo.txt").readlines()
#print "info: "+str(info)
modificatore = NXCObjectModificationData(ID)
#print "modificatore: "+str(modificatore)
Map<String,String> modifica = """new""" Map() # I SUPPOSE THE MISTAKE IS HERE!!!
modifica.put("End user Info",info)
#print "modifica: "+str(modifica)
modificatore = setCustomAttributes(modifica)
g = XXX()
g.YYY()

Could anyone help me to understand where is my mistake?
Thanks in advance!
#6
General Support / Monitoring FTP daemon[Solved]
May 21, 2013, 01:43:42 PM
Hello everybody!

I'm a new NetXMS user (very noob) and I'm sorry if the question has been already made, but I was unable to find an answer.

My goal is to monitor a FTP daemon (in particular, I'm using vsftpd) using NetXMS. My configuration is:

a) NetXMS server+agent installed on a virtual machine with Debian and only with the command line
b) NetXMS agent installed on a local machine (Xubuntu) where I have my FTP daemon installed and which I use to connect to the NetXMS client through web interface or Management Console.

I have this strange configuration only because I'm testing my skills, and I'm trying to "learn" NetXMS.

So, I've tried to monitor the FTP daemon using similar passages of this tutorial http://wiki.netxms.org/wiki/How_to_send_e-mail_notification_when_disk_space_is_low but I haven't been able to set up the right value on Data-Parameter in the general voice of the DCI.
Now my questions are:
1) What should I put on the Parameter voice in the DCI configuration window?
2) Is there an easiest, or righter, method to monitor a FTP daemon? If yes, could someone please explain me this method?

Thanks to all for the support!